diff --git a/change_log.txt b/change_log.txt index 7c07c90831..94a257d842 100644 --- a/change_log.txt +++ b/change_log.txt @@ -4,6 +4,19 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. + +2007-Aug-22 UPDATE Dick Hollenbeck +================================================================================ ++ 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 ================================================================================ + eeschema & pcbnew @@ -15,6 +28,7 @@ email address. ================================================================================ + administrative 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 diff --git a/common/base_screen.cpp b/common/base_screen.cpp index 9ca8ce3760..de1d5f452c 100644 --- a/common/base_screen.cpp +++ b/common/base_screen.cpp @@ -557,5 +557,10 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList( void ) void BASE_SCREEN::SetCurItem( EDA_BaseStruct* aCurItem ) { + +#if defined(DEBUG) + printf( "SetCurItem(%p)\n", aCurItem ); +#endif + m_CurrentItem = aCurItem; } diff --git a/common/base_struct.cpp b/common/base_struct.cpp index 64560c0874..21b9e48472 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -106,6 +106,7 @@ void EDA_BaseStruct::InitVars( void ) m_TimeStamp = 0; // Time stamp used for logical links m_Status = 0; 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 ) { - m_Layer = 0; m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; /* XY size of font */ m_Orient = 0; /* Orient in 0.1 degrees */ m_Attributs = 0; diff --git a/common/common.cpp b/common/common.cpp index a6005be9f0..e2b5535697 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -1,8 +1,8 @@ - /**********************************************************/ - /* Routines d'affichage de parametres et caracteristiques */ - /**********************************************************/ +/**********************************************************/ +/* Routines d'affichage de parametres et caracteristiques */ +/**********************************************************/ - /* Fichier common.cpp */ +/* Fichier common.cpp */ #include "fctsys.h" #include "gr_basic.h" @@ -14,402 +14,454 @@ #include "build_version.h" /*****************************/ -wxString GetBuildVersion(void) +wxString GetBuildVersion( void ) /*****************************/ + /* 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 - m_Size = size; m_Offset = offset, m_Name = name; - // Adjust the default value for margins to 400 mils (0,4 inch or 10 mm) - m_LeftMargin = m_RightMargin = m_TopMargin = m_BottomMargin = 400; + // All sizes are in 1/1000 inch + m_Size = size; m_Offset = offset, m_Name = name; + + // Adjust the default value for margins to 400 mils (0,4 inch or 10 mm) + m_LeftMargin = m_RightMargin = m_TopMargin = m_BottomMargin = 400; } + /************************************/ -wxString ReturnUnitSymbol(int Units ) +wxString ReturnUnitSymbol( int Units ) /************************************/ { -wxString label; + wxString label; - switch ( Units ) - { - case INCHES: - label = _(" (\"):"); - break; + switch( Units ) + { + case INCHES: + label = _( " (\"):" ); + break; - case MILLIMETRE: - label = _(" (mm):"); - break; + case MILLIMETRE: + label = _( " (mm):" ); + break; - default: - break; - } - - return label; + default: + break; + } + + return label; } + /**************************************************/ -void AddUnitSymbol(wxStaticText & Stext, int Units) +void AddUnitSymbol( wxStaticText& Stext, int Units ) /**************************************************/ + /* 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); - Stext.SetLabel(msg); + wxString msg = Stext.GetLabel() + ReturnUnitSymbol( Units ); + + 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 - 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); - TextCtr.SetValue(msg); + wxString msg = ReturnStringFromValue( g_UnitMetric, Value, Internal_Unit ); + + 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, - according to the internal units and the selected unit (g_UnitMetric) -*/ + * according to the internal units and the selected unit (g_UnitMetric) + */ { -int value; -wxString msg = TextCtr.GetValue(); - value = ReturnValueFromString(g_UnitMetric, msg, Internal_Unit); - - return value; + int value; + wxString msg = TextCtr.GetValue(); + + value = ReturnValueFromString( g_UnitMetric, msg, Internal_Unit ); + + return value; } -/****************************************************************************/ -wxString ReturnStringFromValue(int Units, int Value, int Internal_Unit) -/****************************************************************************/ -/* Return the string from Value, according to units (inch, mm ...) for display, - and the initial unit for value - Unit = display units (INCH, MM ..) - Value = value in Internal_Unit - Internal_Unit = units per inch for Value -*/ -{ -wxString StringValue; -double value_to_print; - - if ( Units >= CENTIMETRE ) StringValue << Value; - else - { - value_to_print = To_User_Unit(Units, Value,Internal_Unit); - StringValue.Printf( ( Internal_Unit > 1000 ) ? wxT("%.4f") : wxT("%.3f"), - value_to_print ); - } - - return StringValue; -} /****************************************************************************/ -int ReturnValueFromString(int Units, const wxString & TextValue, int Internal_Unit) +wxString ReturnStringFromValue( int Units, int Value, int Internal_Unit ) /****************************************************************************/ + /* Return the string from Value, according to units (inch, mm ...) for display, - and the initial unit for value - Unit = display units (INCH, MM ..) - Value = text - Internal_Unit = units per inch for computed value -*/ + * and the initial unit for value + * Unit = display units (INCH, MM ..) + * Value = value in Internal_Unit + * Internal_Unit = units per inch for Value + */ { -int Value; -double dtmp = 0; - - TextValue.ToDouble(&dtmp); - if ( Units >= CENTIMETRE ) Value = (int) round(dtmp); - else Value = From_User_Unit(Units, dtmp, Internal_Unit); - - return Value; + wxString StringValue; + double value_to_print; + + if( Units >= CENTIMETRE ) + StringValue << Value; + else + { + value_to_print = To_User_Unit( Units, Value, Internal_Unit ); + StringValue.Printf( ( Internal_Unit > 1000 ) ? wxT( "%.4f" ) : wxT( "%.3f" ), + value_to_print ); + } + + return StringValue; } + + +/****************************************************************************/ +int ReturnValueFromString( int Units, const wxString& TextValue, int Internal_Unit ) +/****************************************************************************/ + +/* Return the string from Value, according to units (inch, mm ...) for display, + * and the initial unit for value + * Unit = display units (INCH, MM ..) + * Value = text + * Internal_Unit = units per inch for computed value + */ +{ + int Value; + double dtmp = 0; + + TextValue.ToDouble( &dtmp ); + if( Units >= CENTIMETRE ) + Value = (int) round( dtmp ); + else + Value = From_User_Unit( Units, dtmp, Internal_Unit ); + + 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 -*/ + */ { -double value; + double value; - if (is_metric) - value = (double) (val) * 25.4 / internal_unit_value; - else value = (double) (val) / internal_unit_value; + if( is_metric ) + value = (double) (val) * 25.4 / 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 -*/ + */ { -double value; + double value; - if (is_metric) value = val * internal_unit_value / 25.4 ; - else value = val * internal_unit_value; + if( is_metric ) + 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" -*/ + */ { -wxString mois[12] = - { - wxT("jan"), wxT("feb"), wxT("mar"), wxT("apr"), wxT("may"), wxT("jun"), - wxT("jul"), wxT("aug"), wxT("sep"), wxT("oct"), wxT("nov"), wxT("dec") - }; -time_t buftime; -struct tm * Date; -wxString string_date; + static const wxString mois[12] = + { + wxT( "jan" ), wxT( "feb" ), wxT( "mar" ), wxT( "apr" ), wxT( "may" ), wxT( "jun" ), + wxT( "jul" ), wxT( "aug" ), wxT( "sep" ), wxT( "oct" ), wxT( "nov" ), wxT( "dec" ) + }; + time_t buftime; + struct tm* Date; + wxString string_date; - time(&buftime); - Date = gmtime(&buftime); - string_date.Printf( wxT("%d %s %d"), Date->tm_mday, - mois[Date->tm_mon].GetData(), - Date->tm_year + 1900); - return(string_date); + time( &buftime ); + Date = gmtime( &buftime ); + string_date.Printf( wxT( "%d %s %d" ), Date->tm_mday, + mois[Date->tm_mon].GetData(), + Date->tm_year + 1900 ); + return string_date; } + /***********************************/ -void * MyMalloc (size_t nb_octets) +void* MyMalloc( size_t nb_octets ) /***********************************/ /* My memory allocation */ { -void * pt_mem; - if (nb_octets == 0) - { - DisplayError(NULL, wxT("Allocate 0 bytes !!")); - return(NULL); - } - pt_mem = malloc(nb_octets); - if (pt_mem == NULL) - { - wxString msg; - msg.Printf( wxT("Out of memory: allocation %d bytes"), nb_octets); - DisplayError(NULL, msg); - } - return(pt_mem); + void* pt_mem; + + if( nb_octets == 0 ) + { + DisplayError( NULL, wxT( "Allocate 0 bytes !!" ) ); + return NULL; + } + pt_mem = malloc( nb_octets ); + if( pt_mem == NULL ) + { + wxString msg; + msg.Printf( wxT( "Out of memory: allocation %d bytes" ), nb_octets ); + DisplayError( NULL, msg ); + } + return pt_mem; } + /************************************/ -void * MyZMalloc (size_t nb_octets) +void* MyZMalloc( size_t nb_octets ) /************************************/ + /* My memory allocation, memory space is cleared -*/ + */ { - void * pt_mem = MyMalloc (nb_octets); - if ( pt_mem) memset(pt_mem, 0, nb_octets); - return(pt_mem); + void* pt_mem = MyMalloc( nb_octets ); + + 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". - if "is_filefame" == TRUE, the name can be used for a file name - (not internatinalized, no space) -*/ + * if "is_filefame" == TRUE, the name can be used for a file name + * (not internatinalized, no space) + */ { -wxString layer_name; -wxString layer_name_list[] = { - _("Copper "), _("Inner L1 "), _("Inner L2 "), _("Inner L3 "), - _("Inner L4 "), _("Inner L5 "), _("Inner L6 "), _("Inner L7 "), - _("Inner L8 "), _("Inner L9 "), _("Inner L10"), _("Inner L11"), - _("Inner L12"), _("Inner L13"), _("Inner L14"), _("Component"), - _("Adhes Cop"), _("Adhes Cmp"), _("SoldP Cop"), _("SoldP Cmp"), - _("SilkS Cop"), _("SilkS Cmp"), _("Mask Cop "), _("Mask Cmp "), - _("Drawings "), _("Comments "), _("Eco1 "), _("Eco2 "), - _("Edges Pcb"), _("--- "), _("--- "), _("--- ") - }; - + wxString layer_name; + static const wxString layer_name_list[] = { + _( "Copper " ), _( "Inner L1 " ), _( "Inner L2 " ), _( "Inner L3 " ), + _( "Inner L4 " ), _( "Inner L5 " ), _( "Inner L6 " ), _( "Inner L7 " ), + _( "Inner L8 " ), _( "Inner L9 " ), _( "Inner L10" ), _( "Inner L11" ), + _( "Inner L12" ), _( "Inner L13" ), _( "Inner L14" ), _( "Component" ), + _( "Adhes Cop" ), _( "Adhes Cmp" ), _( "SoldP Cop" ), _( "SoldP Cmp" ), + _( "SilkS Cop" ), _( "SilkS Cmp" ), _( "Mask Cop " ), _( "Mask Cmp " ), + _( "Drawings " ), _( "Comments " ), _( "Eco1 " ), _( "Eco2 " ), + _( "Edges Pcb" ), _( "--- " ), _( "--- " ), _( "--- " ) + }; + // Same as layer_name_list, without space, not internationalized -wxString layer_name_list_for_filename[] = { - wxT("Copper"), wxT("InnerL1"), wxT("InnerL2"), wxT("InnerL3"), - wxT("InnerL4"), wxT("InnerL5"), wxT("InnerL6"), wxT("InnerL7"), - wxT("InnerL8"), wxT("InnerL9"), wxT("InnerL10"), wxT("InnerL11"), - wxT("InnerL12"), wxT("InnerL13"), wxT("InnerL14"), wxT("Component"), - wxT("AdhesCop"), wxT("AdhesCmp"), wxT("SoldPCop"), wxT("SoldPCmp"), - wxT("SilkSCop"), wxT("SilkSCmp"), wxT("MaskCop"), wxT("MaskCmp"), - wxT("Drawings"), wxT("Comments"), wxT("Eco1"), wxT("Eco2"), - wxT("EdgesPcb"), wxT("---"), wxT("---"), wxT("---") - }; - if ( layer_number >= 31 ) layer_number = 31; + static const wxString layer_name_list_for_filename[] = { + wxT( "Copper" ), wxT( "InnerL1" ), wxT( "InnerL2" ), wxT( "InnerL3" ), + wxT( "InnerL4" ), wxT( "InnerL5" ), wxT( "InnerL6" ), wxT( "InnerL7" ), + wxT( "InnerL8" ), wxT( "InnerL9" ), wxT( "InnerL10" ), wxT( "InnerL11" ), + wxT( "InnerL12" ), wxT( "InnerL13" ), wxT( "InnerL14" ), wxT( "Component" ), + wxT( "AdhesCop" ), wxT( "AdhesCmp" ), wxT( "SoldPCop" ), wxT( "SoldPCmp" ), + wxT( "SilkSCop" ), wxT( "SilkSCmp" ), wxT( "MaskCop" ), wxT( "MaskCmp" ), + wxT( "Drawings" ), wxT( "Comments" ), wxT( "Eco1" ), wxT( "Eco2" ), + wxT( "EdgesPcb" ), wxT( "---" ), wxT( "---" ), wxT( "---" ) + }; - if ( is_filename ) layer_name = layer_name_list_for_filename[layer_number]; - else layer_name = layer_name_list[layer_number]; - - if( is_gui ){ - wxString hotkey_list[] = { - wxT("(PgDn)"), wxT("(F5)"), wxT("(F6)"), wxT("(F7)"), - wxT("(F8)"), wxT("(F9)"), wxT("(F10)"), wxT(" "), - wxT(" "), wxT(" "), wxT(" "), wxT(" "), - wxT(" "), wxT(" "), wxT(" "), wxT(" (PgUp)"), - wxT(" "), wxT(" "), wxT(" "), wxT(" "), - wxT(" "), wxT(" "), wxT(" "), wxT(" "), - wxT(" "), wxT(" "), wxT(" "), wxT(" "), - wxT(" "), wxT(" "), wxT(" "), wxT(" ") - }; - layer_name += wxT(" ") + hotkey_list[layer_number]; - } - - return layer_name; + if( layer_number >= 31 ) + layer_number = 31; + if( is_filename ) + 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( "(F8)" ), wxT( "(F9)" ), wxT( "(F10)" ), wxT( " " ), + wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " ), + wxT( " " ), wxT( " " ), wxT( " " ), wxT( " (PgUp)" ), + wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " ), + wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " ), + wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " ), + wxT( " " ), wxT( " " ), wxT( " " ), wxT( " " ) + }; + layer_name += wxT( " " ) + hotkey_list[layer_number]; + } + + return layer_name; } enum textbox { - ID_TEXTBOX_LIST = 8010 + ID_TEXTBOX_LIST = 8010 }; -BEGIN_EVENT_TABLE(WinEDA_TextFrame, wxDialog) - EVT_LISTBOX_DCLICK(ID_TEXTBOX_LIST, WinEDA_TextFrame::D_ClickOnList) - EVT_LISTBOX(ID_TEXTBOX_LIST, WinEDA_TextFrame::D_ClickOnList) - EVT_CLOSE( WinEDA_TextFrame::OnClose ) +BEGIN_EVENT_TABLE( WinEDA_TextFrame, wxDialog ) +EVT_LISTBOX_DCLICK( ID_TEXTBOX_LIST, WinEDA_TextFrame::D_ClickOnList ) +EVT_LISTBOX( ID_TEXTBOX_LIST, WinEDA_TextFrame::D_ClickOnList ) +EVT_CLOSE( WinEDA_TextFrame::OnClose ) END_EVENT_TABLE() /***************************************************************************/ -WinEDA_TextFrame::WinEDA_TextFrame(wxWindow * parent, const wxString & title): - wxDialog(parent, -1, title, wxPoint(-1,-1), wxSize(250,350), - wxDEFAULT_DIALOG_STYLE| wxFRAME_FLOAT_ON_PARENT ) +WinEDA_TextFrame::WinEDA_TextFrame( wxWindow* parent, const wxString& title ) : + wxDialog( parent, -1, title, wxPoint( -1, -1 ), wxSize( 250, 350 ), + wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT ) /***************************************************************************/ { -wxSize size; + wxSize size; - m_Parent = parent; + m_Parent = parent; - CentreOnParent(); + CentreOnParent(); - size = GetClientSize(); - m_List = new wxListBox(this, ID_TEXTBOX_LIST, - wxPoint(0,0), size, - 0, NULL, - wxLB_ALWAYS_SB|wxLB_SINGLE); - m_List->SetBackgroundColour(wxColour(200,255,255)); - SetReturnCode(-1); + size = GetClientSize(); + m_List = new wxListBox( this, ID_TEXTBOX_LIST, + wxPoint( 0, 0 ), size, + 0, NULL, + wxLB_ALWAYS_SB | wxLB_SINGLE ); + + m_List->SetBackgroundColour( wxColour( 200, 255, 255 ) ); + SetReturnCode( -1 ); } + /***************************************************/ -void WinEDA_TextFrame::Append( const wxString & text) +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(); - EndModal(ii); + int ii = m_List->GetSelection(); + + EndModal( ii ); } + /*************************************************/ -void WinEDA_TextFrame::OnClose(wxCloseEvent& event) +void WinEDA_TextFrame::OnClose( wxCloseEvent& event ) /*************************************************/ { - EndModal(-1); + EndModal( -1 ); } - /*****************************************************************************/ -void Affiche_1_Parametre(WinEDA_DrawFrame * frame , int pos_X, - const wxString & texte_H,const wxString & texte_L,int color) +void Affiche_1_Parametre( WinEDA_DrawFrame* frame, int pos_X, + const wxString& texte_H, const wxString& texte_L, int color ) /*****************************************************************************/ -/* - Routine d'affichage d'un parametre. - pos_X = cadrage horizontal - si pos_X < 0 : la position horizontale est la derniere - valeur demandee >= 0 - texte_H = texte a afficher en ligne superieure. - si "", par d'affichage sur cette ligne - texte_L = texte a afficher en ligne inferieure. - si "", par d'affichage sur cette ligne - color = couleur d'affichage -*/ -{ - frame->MsgPanel->Affiche_1_Parametre(pos_X, texte_H,texte_L, color); -} -/****************************************************************************/ -void AfficheDoc(WinEDA_DrawFrame * frame, const wxString & Doc, const wxString & KeyW) -/****************************************************************************/ /* - Routine d'affichage de la documentation associee a un composant -*/ + * Routine d'affichage d'un parametre. + * pos_X = cadrage horizontal + * si pos_X < 0 : la position horizontale est la derniere + * valeur demandee >= 0 + * texte_H = texte a afficher en ligne superieure. + * si "", par d'affichage sur cette ligne + * texte_L = texte a afficher en ligne inferieure. + * si "", par d'affichage sur cette ligne + * color = couleur d'affichage + */ { -wxString Line1( wxT("Doc: ")), Line2( wxT("KeyW: ")); -int color = BLUE; - - if ( frame && frame->MsgPanel) - { - frame->MsgPanel->EraseMsgBox(); - Line1 += Doc; - Line2 += KeyW; - frame->MsgPanel->Affiche_1_Parametre(10, Line1, Line2, color); - } + frame->MsgPanel->Affiche_1_Parametre( pos_X, texte_H, texte_L, color ); } +/****************************************************************************/ +void AfficheDoc( WinEDA_DrawFrame* frame, const wxString& Doc, const wxString& KeyW ) +/****************************************************************************/ + +/* + * Routine d'affichage de la documentation associee a un composant + */ +{ + wxString Line1( wxT( "Doc: " ) ), Line2( wxT( "KeyW: " ) ); + + int color = BLUE; + + if( frame && frame->MsgPanel ) + { + frame->MsgPanel->EraseMsgBox(); + Line1 += Doc; + Line2 += KeyW; + frame->MsgPanel->Affiche_1_Parametre( 10, Line1, Line2, color ); + } +} /***********************/ -int GetTimeStamp(void) +int GetTimeStamp( void ) /***********************/ -/* - Retourne une identification temporelle (Time stamp) differente a chaque appel -*/ -{ -static int OldTimeStamp, NewTimeStamp; - NewTimeStamp = time(NULL); - if(NewTimeStamp <= OldTimeStamp) NewTimeStamp = OldTimeStamp + 1; - OldTimeStamp = NewTimeStamp; - return(NewTimeStamp); +/* + * Retourne une identification temporelle (Time stamp) differente a chaque appel + */ +{ + static int OldTimeStamp, NewTimeStamp; + + NewTimeStamp = time( NULL ); + if( NewTimeStamp <= OldTimeStamp ) + NewTimeStamp = OldTimeStamp + 1; + OldTimeStamp = 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 - entree : valeur en mils , buffer de texte - retourne en buffer : texte : valeur exprimee en pouces ou millimetres - suivie de " ou mm -*/ + * entree : valeur en mils , buffer de texte + * retourne en buffer : texte : valeur exprimee en pouces ou millimetres + * suivie de " ou mm + */ { - if ( g_UnitMetric ) - { - buf_texte.Printf( wxT("%3.3f "),(float) valeur * 0.00254); - buf_texte << wxT("mm") ; - } - else - { - buf_texte.Printf( wxT("%2.4f "),(float) valeur * 0.0001); - buf_texte << wxT("\" "); - } + if( g_UnitMetric ) + { + buf_texte.Printf( wxT( "%3.3f " ), (float) valeur * 0.00254 ); + buf_texte << wxT( "mm" ); + } + else + { + buf_texte.Printf( wxT( "%2.4f " ), (float) valeur * 0.0001 ); + buf_texte << wxT( "\" " ); + } } - diff --git a/eeschema/class_screen.h b/eeschema/class_screen.h index 29f1c88dcb..6c75d28ccd 100644 --- a/eeschema/class_screen.h +++ b/eeschema/class_screen.h @@ -141,7 +141,6 @@ public: int m_FileNameSize; wxPoint m_Pos; wxSize m_Size; /* Position and Size of sheet symbol */ - int m_Layer; DrawSheetLabelStruct* m_Label; /* Points de connection */ int m_NbLabel; /* Nombre de points de connexion */ diff --git a/eeschema/program.h b/eeschema/program.h index afc6e65351..9d1e1f467a 100644 --- a/eeschema/program.h +++ b/eeschema/program.h @@ -106,7 +106,6 @@ class DrawBusEntryStruct: public EDA_BaseStruct /* Struct de descr 1 raccord a 45 degres de BUS ou WIRE */ { public: - int m_Layer; int m_Width; wxPoint m_Pos; wxSize m_Size; @@ -122,7 +121,6 @@ public: class DrawPolylineStruct: public EDA_BaseStruct /* Polyligne (serie de segments) */ { public: - int m_Layer; int m_Width; int m_NumOfPoints; /* Number of XY pairs in Points array. */ int *m_Points; /* XY pairs that forms the polyline. */ @@ -137,7 +135,6 @@ public: class DrawJunctionStruct: public EDA_BaseStruct { public: - int m_Layer; wxPoint m_Pos; /* XY coordinates of connection. */ public: diff --git a/include/base_struct.h b/include/base_struct.h index 66dde6a429..e8cbc01a42 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -154,6 +154,7 @@ public: unsigned long m_TimeStamp; // Time stamp used for logical links int m_Selected; /* Used by block commands, and selective editing */ + int m_Layer; ///< used by many derived classes, so make common private: int m_Status; @@ -347,7 +348,6 @@ class EDA_TextStruct { public: wxString m_Text; /* text! */ - int m_Layer; /* couche d'appartenance */ wxPoint m_Pos; /* XY position of anchor text. */ wxSize m_Size; /* XY size of text */ int m_Width; /* epaisseur du trait */ @@ -389,7 +389,6 @@ public: class EDA_BaseLineStruct : public EDA_BaseStruct { public: - int m_Layer; // Layer number int m_Width; // 0 = line, > 0 = tracks, bus ... wxPoint m_Start; // Line start point wxPoint m_End; // Line end point diff --git a/include/pcbstruct.h b/include/pcbstruct.h index 2047c9660c..da6868165c 100644 --- a/include/pcbstruct.h +++ b/include/pcbstruct.h @@ -276,7 +276,7 @@ public: /** * Function FindNet * 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. */ EQUIPOT* FindNet( int anetcode ); diff --git a/kicad/buildmnu.cpp b/kicad/buildmnu.cpp index 1c64b196b3..eecf7b9769 100644 --- a/kicad/buildmnu.cpp +++ b/kicad/buildmnu.cpp @@ -27,7 +27,7 @@ #include "New_Project.xpm" #include "Open_Project.xpm" #include "../bitmaps/icon_python.xpm" -#include "../bitmaps/reload.xpm" +#include "../bitmaps/Reload.xpm" #include "id.h" diff --git a/pcbnew/class_cotation.h b/pcbnew/class_cotation.h index d77fa8bbb9..601fa69e46 100644 --- a/pcbnew/class_cotation.h +++ b/pcbnew/class_cotation.h @@ -9,7 +9,6 @@ class COTATION : public EDA_BaseStruct { public: - int m_Layer; // 0.. 32 ( NON bit a bit) int m_Width; wxPoint m_Pos; int m_Shape; diff --git a/pcbnew/class_mire.h b/pcbnew/class_mire.h index ee1f5279be..248159737e 100644 --- a/pcbnew/class_mire.h +++ b/pcbnew/class_mire.h @@ -10,7 +10,6 @@ class MIREPCB : public EDA_BaseStruct { public: - int m_Layer; // 0.. 32 ( NON bit a bit) int m_Width; wxPoint m_Pos; int m_Shape; // bit 0 : 0 = forme +, 1 = forme X diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 5053f0f211..c6016b3e0e 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -38,7 +38,6 @@ enum Mod_Attribut /* Attributs d'un module */ class MODULE : public EDA_BaseStruct { public: - int m_Layer; // layer number wxPoint m_Pos; // Real coord on board D_PAD* m_Pads; /* Pad list (linked list) */ EDA_BaseStruct* m_Drawings; /* Graphic items list (linked list) */ diff --git a/pcbnew/class_pcb_text.h b/pcbnew/class_pcb_text.h index f2c4eed508..e06173f774 100644 --- a/pcbnew/class_pcb_text.h +++ b/pcbnew/class_pcb_text.h @@ -35,6 +35,18 @@ public: * @param frame A WinEDA_BasePcbFrame in which to print status information. */ 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) diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index 0d6944ea22..829b934cc4 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -16,7 +16,6 @@ class TEXTE_MODULE : public EDA_BaseStruct { public: - int m_Layer; // layer number int m_Width; wxPoint m_Pos; // Real coord wxPoint m_Pos0; // coord du debut du texte /ancre, orient 0 diff --git a/pcbnew/locate.cpp b/pcbnew/locate.cpp index a8448ebef0..a8ed428ec6 100644 --- a/pcbnew/locate.cpp +++ b/pcbnew/locate.cpp @@ -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 ) -/********************************************************/ - -/* - * localisation d'une empreinte par son rectangle d'encadrement - * Si plusieurs empreintes sont possibles, la priorite est: - * - sur la couche active - * - la plus petite +/** + * 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 + * to performe hit-testing. + * + * @param Pcb The BOARD to search within. + * @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; 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 ) { - // because HitTest() is present in both base classes of TEXTE_PCB - // use a clarifying cast to tell compiler which HitTest() - // to call. - if( static_cast(pt_txt_pcb)->HitTest( ref ) ) + if( pt_txt_pcb->HitTest( ref ) ) { return pt_txt_pcb; } diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 80d9b02ddb..6c5199f619 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -134,7 +134,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) wxString msg; int flags = 0; bool locate_track = FALSE; - bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE); + bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE); wxClientDC dc( DrawPanel ); DrawPanel->CursorOff( &dc ); @@ -202,6 +202,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) ADD_MENUITEM( PopMenu, ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST, _( "Get and Move Footprint" ), Move_Module_xpm ); } + if( DrawStruct ) { switch( DrawStruct->m_StructType ) diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 0043bfeac8..987ee57de6 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -12,7 +12,7 @@ #include "id.h" #if defined(DEBUG) -#include +#include "class_collector.h" #endif @@ -69,8 +69,8 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, wxFrame ) EVT_MENU( ID_CONFIG_REQ, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_COLORS_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_OPTIONS_SETUP, WinEDA_PcbFrame::Process_Config ) - EVT_MENU(ID_PREFERENCES_CREATE_CONFIG_HOTKEYS, WinEDA_PcbFrame::Process_Config) - EVT_MENU(ID_PREFERENCES_READ_CONFIG_HOTKEYS, WinEDA_PcbFrame::Process_Config) + EVT_MENU( ID_PREFERENCES_CREATE_CONFIG_HOTKEYS, WinEDA_PcbFrame::Process_Config ) + EVT_MENU( ID_PREFERENCES_READ_CONFIG_HOTKEYS, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_PCB_TRACK_SIZE_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config ) @@ -172,11 +172,77 @@ END_EVENT_TABLE() #if defined(DEBUG) class RAT1COLLECTOR : 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 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 diff --git a/share/drawpanel.cpp b/share/drawpanel.cpp index 582b36fc82..3264b5df60 100644 --- a/share/drawpanel.cpp +++ b/share/drawpanel.cpp @@ -14,931 +14,1009 @@ #include "id.h" // defines locaux -#define CURSOR_SIZE 12 // taille de la croix du curseur PCB +#define CURSOR_SIZE 12 // taille de la croix du curseur PCB // Variables locales // table des evenements captes par un WinEDA_DrawPanel BEGIN_EVENT_TABLE( WinEDA_DrawPanel, EDA_DRAW_PANEL ) - EVT_LEAVE_WINDOW(WinEDA_DrawPanel::OnMouseLeaving) - EVT_MOUSE_EVENTS(WinEDA_DrawPanel::OnMouseEvent) - EVT_CHAR(WinEDA_DrawPanel::OnKeyEvent) - EVT_CHAR_HOOK(WinEDA_DrawPanel::OnKeyEvent) - EVT_PAINT(WinEDA_DrawPanel::OnPaint) - EVT_SIZE(WinEDA_DrawPanel::OnSize) - EVT_ERASE_BACKGROUND(WinEDA_DrawPanel::OnEraseBackground) - EVT_SCROLLWIN(WinEDA_DrawPanel::OnScroll) - EVT_ACTIVATE(WinEDA_DrawPanel::OnActivate) - - EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE, - WinEDA_DrawPanel::Process_Popup_Zoom) + EVT_LEAVE_WINDOW( WinEDA_DrawPanel::OnMouseLeaving ) + EVT_MOUSE_EVENTS( WinEDA_DrawPanel::OnMouseEvent ) + EVT_CHAR( WinEDA_DrawPanel::OnKeyEvent ) + EVT_CHAR_HOOK( WinEDA_DrawPanel::OnKeyEvent ) + EVT_PAINT( WinEDA_DrawPanel::OnPaint ) + EVT_SIZE( WinEDA_DrawPanel::OnSize ) + EVT_ERASE_BACKGROUND( WinEDA_DrawPanel::OnEraseBackground ) + EVT_SCROLLWIN( WinEDA_DrawPanel::OnScroll ) + EVT_ACTIVATE( WinEDA_DrawPanel::OnActivate ) + + EVT_MENU_RANGE( ID_POPUP_ZOOM_START_RANGE, ID_POPUP_ZOOM_END_RANGE, + WinEDA_DrawPanel::Process_Popup_Zoom ) END_EVENT_TABLE() - /***********************************************************/ - /* Fonctions de base de WinEDA_DrawPanel: l'ecran de trace */ - /***********************************************************/ +/***********************************************************/ +/* Fonctions de base de WinEDA_DrawPanel: l'ecran de trace */ +/***********************************************************/ -WinEDA_DrawPanel::WinEDA_DrawPanel(WinEDA_DrawFrame *parent, int id, - const wxPoint& pos, const wxSize& size): - EDA_DRAW_PANEL(parent, id, pos, size, - wxBORDER|wxNO_FULL_REPAINT_ON_RESIZE) +WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, + const wxPoint& pos, const wxSize& size ) : + EDA_DRAW_PANEL( parent, id, pos, size, + wxBORDER | wxNO_FULL_REPAINT_ON_RESIZE ) { - m_Parent = parent; - m_Ident = m_Parent->m_Ident; - m_Scroll_unit = 1; - m_ScrollButt_unit = 40; - SetBackgroundColour(wxColour(ColorRefs[g_DrawBgColor].m_Red, - ColorRefs[g_DrawBgColor].m_Green, - ColorRefs[g_DrawBgColor].m_Blue ) ); - EnableScrolling(TRUE,TRUE); - m_ClipBox.SetSize(size); - m_ClipBox.SetX(0); - m_ClipBox.SetY(0); - m_CanStartBlock = -1; // Command block can start if >= 0 - m_AbortEnable = m_AbortRequest = FALSE; - m_AutoPAN_Enable = TRUE; - m_IgnoreMouseEvents = FALSE; + m_Parent = parent; + m_Ident = m_Parent->m_Ident; + m_Scroll_unit = 1; + m_ScrollButt_unit = 40; + SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red, + ColorRefs[g_DrawBgColor].m_Green, + ColorRefs[g_DrawBgColor].m_Blue ) ); + EnableScrolling( TRUE, TRUE ); + m_ClipBox.SetSize( size ); + m_ClipBox.SetX( 0 ); + m_ClipBox.SetY( 0 ); + m_CanStartBlock = -1; // Command block can start if >= 0 + m_AbortEnable = m_AbortRequest = FALSE; + m_AutoPAN_Enable = TRUE; + m_IgnoreMouseEvents = FALSE; - ManageCurseur = NULL; - ForceCloseManageCurseur = NULL; + ManageCurseur = NULL; + ForceCloseManageCurseur = NULL; - if ( m_Parent->m_Parent->m_EDA_Config ) - m_AutoPAN_Enable = m_Parent->m_Parent->m_EDA_Config->Read(wxT("AutoPAN"), TRUE); - m_AutoPAN_Request = FALSE; - m_Block_Enable = FALSE; - m_PanelDefaultCursor = m_PanelCursor = wxCURSOR_ARROW; - m_CursorLevel = 0; + if( m_Parent->m_Parent->m_EDA_Config ) + m_AutoPAN_Enable = m_Parent->m_Parent->m_EDA_Config->Read( wxT( "AutoPAN" ), TRUE ); + m_AutoPAN_Request = FALSE; + m_Block_Enable = FALSE; + m_PanelDefaultCursor = m_PanelCursor = wxCURSOR_ARROW; + m_CursorLevel = 0; } /*********************************************************************************/ -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) { - return; - } + if( m_CursorLevel != 0 ) + { + return; + } -wxPoint Cursor = GetScreen()->m_Curseur; - - if ( DC == NULL ) return; - - GRSetDrawMode(DC, GR_XOR); - if( g_CursorShape == 1 ) /* Trace d'un reticule */ - { - int dx = m_ClipBox.GetWidth() * GetZoom(); - int dy = m_ClipBox.GetHeight() * GetZoom(); - GRLine(&m_ClipBox, DC, Cursor.x - dx, Cursor.y, - Cursor.x + dx, Cursor.y, 0, color); // axe Y - GRLine(&m_ClipBox, DC, Cursor.x, Cursor.y - dx, - Cursor.x, Cursor.y + dy, 0, color); // axe X - } + wxPoint Cursor = GetScreen()->m_Curseur; - else - { - int len = CURSOR_SIZE * GetZoom(); - GRLine(&m_ClipBox, DC, Cursor.x - len, Cursor.y, - Cursor.x + len, Cursor.y, 0, color); - GRLine(&m_ClipBox, DC, Cursor.x, Cursor.y - len, - Cursor.x, Cursor.y + len, 0, color); - } + if( DC == NULL ) + return; + + GRSetDrawMode( DC, GR_XOR ); + if( g_CursorShape == 1 ) /* Trace d'un reticule */ + { + int dx = m_ClipBox.GetWidth()* GetZoom(); + + int dy = m_ClipBox.GetHeight()* GetZoom(); + + GRLine( &m_ClipBox, DC, Cursor.x - dx, Cursor.y, + Cursor.x + dx, Cursor.y, 0, color ); // axe Y + GRLine( &m_ClipBox, DC, Cursor.x, Cursor.y - dx, + Cursor.x, Cursor.y + dy, 0, color ); // axe X + } + else + { + int len = CURSOR_SIZE* GetZoom(); + + GRLine( &m_ClipBox, DC, Cursor.x - len, Cursor.y, + Cursor.x + len, Cursor.y, 0, color ); + GRLine( &m_ClipBox, DC, Cursor.x, Cursor.y - len, + Cursor.x, Cursor.y + len, 0, color ); + } } /*******************************************************************/ -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); - --m_CursorLevel; + Trace_Curseur( DC ); + --m_CursorLevel; } /*******************************************************************/ -void WinEDA_DrawPanel::CursorOn(wxDC * DC) +void WinEDA_DrawPanel::CursorOn( wxDC* DC ) /*******************************************************************/ -/* - Display the grid cursor -*/ -{ - ++m_CursorLevel; - Trace_Curseur(DC); - if (m_CursorLevel > 0) // Shouldn't happen, but just in case .. - m_CursorLevel = 0; +/* + * Display the grid cursor + */ +{ + ++m_CursorLevel; + Trace_Curseur( DC ); + + if( m_CursorLevel > 0 ) // Shouldn't happen, but just in case .. + m_CursorLevel = 0; } /***********************************/ -int WinEDA_DrawPanel::GetZoom(void) +int WinEDA_DrawPanel::GetZoom( void ) /***********************************/ { - return GetScreen()->GetZoom(); + return GetScreen()->GetZoom(); } /***************************************/ -void WinEDA_DrawPanel::SetZoom(int zoom) +void WinEDA_DrawPanel::SetZoom( int zoom ) /***************************************/ { - GetScreen()->SetZoom(zoom); + GetScreen()->SetZoom( zoom ); } /************************************/ -wxSize WinEDA_DrawPanel::GetGrid(void) +wxSize WinEDA_DrawPanel::GetGrid( void ) /************************************/ { - return GetScreen()->GetGrid(); + return GetScreen()->GetGrid(); } /******************************************************/ -void WinEDA_DrawPanel::PrepareGraphicContext(wxDC * DC) +void WinEDA_DrawPanel::PrepareGraphicContext( wxDC* DC ) /******************************************************/ { - GRResetPenAndBrush(DC); - DC->SetBackgroundMode(wxTRANSPARENT); + GRResetPenAndBrush( DC ); + DC->SetBackgroundMode( wxTRANSPARENT ); #ifdef WX_ZOOM -int zoom = GetZoom(); -double f_scale = 1.0/(double)zoom; + int zoom = GetZoom(); + double f_scale = 1.0 / (double) zoom; - DC->SetUserScale(f_scale, f_scale); - PrepareDC(*DC); + DC->SetUserScale( f_scale, f_scale ); + PrepareDC( *DC ); #endif - SetBoundaryBox(); + SetBoundaryBox(); } /*********************************************************************/ -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, -donnée en position relative scrollée (en pixel) -*/ + * donnée en position relative scrollée (en pixel) + */ { -wxPoint pos; + wxPoint pos; #ifdef WX_ZOOM - CalcUnscrolledPosition( rel_pos.x, rel_pos.y, &pos.x, &pos.y ); + CalcUnscrolledPosition( rel_pos.x, rel_pos.y, &pos.x, &pos.y ); #else -int ii, jj; - GetViewStart(&pos.x, &pos.y); - GetScrollPixelsPerUnit(&ii, &jj); - pos.x *= ii; pos.y *= jj; - pos.x += rel_pos.x; - pos.y += rel_pos.y; + int ii, jj; + GetViewStart( &pos.x, &pos.y ); + GetScrollPixelsPerUnit( &ii, &jj ); + pos.x *= ii; pos.y *= jj; + pos.x += rel_pos.x; + pos.y += rel_pos.y; #endif - return pos; + return pos; } /**********************************************************************/ -wxPoint WinEDA_DrawPanel::CursorRealPosition(const wxPoint & ScreenPos) +wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos ) /**********************************************************************/ + /* 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; - curpos = GetScreen()->CursorRealPosition(ScreenPos); + curpos = GetScreen()->CursorRealPosition( ScreenPos ); - return curpos; + return 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 - est visible sur l'ecran, c'est a dire: - si ref_pos est sur la partie du schema ou pcb affichee a l'ecran -*/ + * est visible sur l'ecran, c'est a dire: + * si ref_pos est sur la partie du schema ou pcb affichee a l'ecran + */ { -wxPoint pos; -EDA_Rect display_rect; + wxPoint pos; + EDA_Rect display_rect; - SetBoundaryBox(); - display_rect = m_ClipBox; + SetBoundaryBox(); + display_rect = m_ClipBox; - // Reduction legere des dimension de l'ecran utile pour eviter cadrage - // en limite d'ecran - #define PIXEL_MARGIN 8 - display_rect.Inflate(-PIXEL_MARGIN,-PIXEL_MARGIN); + // Reduction legere des dimension de l'ecran utile pour eviter cadrage + // en limite d'ecran + #define PIXEL_MARGIN 8 + display_rect.Inflate( -PIXEL_MARGIN, -PIXEL_MARGIN ); - // Conversion en coord physiques - pos = CalcAbsolutePosition( display_rect.GetPosition() ); - pos.x *= GetZoom(); - pos.y *= GetZoom(); - pos.x += GetScreen()->m_DrawOrg.x; - pos.y += GetScreen()->m_DrawOrg.y; - display_rect.SetX(pos.x); display_rect.SetY(pos.y); - display_rect.SetWidth( display_rect.GetWidth() * GetZoom() ); - display_rect.SetHeight( display_rect.GetHeight() * GetZoom() ); + // Conversion en coord physiques + pos = CalcAbsolutePosition( display_rect.GetPosition() ); + pos.x *= GetZoom(); + pos.y *= GetZoom(); + pos.x += GetScreen()->m_DrawOrg.x; + pos.y += GetScreen()->m_DrawOrg.y; + display_rect.SetX( pos.x ); display_rect.SetY( pos.y ); + display_rect.SetWidth( display_rect.GetWidth() * GetZoom() ); + display_rect.SetHeight( display_rect.GetHeight() * GetZoom() ); - return display_rect.Inside(ref_pos); + return display_rect.Inside( ref_pos ); } /********************************************************/ -wxPoint WinEDA_DrawPanel::CursorScreenPosition(void) +wxPoint WinEDA_DrawPanel::CursorScreenPosition( void ) /********************************************************/ + /* 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; - curpos.x -= GetScreen()->m_DrawOrg.x; - curpos.y -= GetScreen()->m_DrawOrg.y; + curpos.x -= GetScreen()->m_DrawOrg.x; + curpos.y -= GetScreen()->m_DrawOrg.y; - curpos.x /= GetZoom(); - curpos.y /= GetZoom(); + curpos.x /= GetZoom(); + curpos.y /= GetZoom(); - return curpos; + return curpos; } /*********************************************************/ -wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition(void) +wxPoint WinEDA_DrawPanel::GetScreenCenterRealPosition( void ) /*********************************************************/ { -wxSize size; -wxPoint realpos; + wxSize size; + wxPoint realpos; - size = GetClientSize(); - size.x /= 2; size.y /= 2; + size = GetClientSize(); + size.x /= 2; size.y /= 2; - realpos = CalcAbsolutePosition( wxPoint(size.x, size.y) ); - realpos.x *= GetZoom(); - realpos.y *= GetZoom(); - realpos.x += GetScreen()->m_DrawOrg.x; - realpos.y += GetScreen()->m_DrawOrg.y; + realpos = CalcAbsolutePosition( wxPoint( size.x, size.y ) ); + realpos.x *= GetZoom(); + realpos.y *= GetZoom(); + realpos.x += GetScreen()->m_DrawOrg.x; + realpos.y += GetScreen()->m_DrawOrg.y; - return realpos; + return realpos; } /**********************************************/ -void WinEDA_DrawPanel::MouseToCursorSchema(void) +void WinEDA_DrawPanel::MouseToCursorSchema( void ) /**********************************************/ + /* place le curseur souris sur la position du curseur schema -*/ + */ { -wxPoint Mouse = CursorScreenPosition(); - MouseTo(Mouse); + wxPoint Mouse = CursorScreenPosition(); + + MouseTo( Mouse ); } /****************************************************/ -void WinEDA_DrawPanel::MouseTo(const wxPoint & Mouse) +void WinEDA_DrawPanel::MouseTo( const wxPoint& Mouse ) /****************************************************/ + /* place le curseur souris sur la position Mouse -*/ + */ { -wxPoint mouse; + wxPoint mouse; + #ifdef WX_ZOOM - CalcScrolledPosition(Mouse.x, Mouse.y, &mouse.x, &mouse.y); + CalcScrolledPosition( Mouse.x, Mouse.y, &mouse.x, &mouse.y ); #else - mouse = Mouse; - mouse.x -= GetScreen()->m_StartVisu.x; - mouse.y -= GetScreen()->m_StartVisu.y; + mouse = Mouse; + mouse.x -= GetScreen()->m_StartVisu.x; + mouse.y -= GetScreen()->m_StartVisu.y; #endif - GRMouseWarp(this, mouse); + GRMouseWarp( this, mouse ); } + /********************************************************/ -void WinEDA_DrawPanel::OnActivate(wxActivateEvent& event) +void WinEDA_DrawPanel::OnActivate( wxActivateEvent& event ) /********************************************************/ { - m_CanStartBlock = -1; // Commande block can't start - event.Skip(); + m_CanStartBlock = -1; // Commande block can't start + event.Skip(); } /***********************************************************/ -void WinEDA_DrawPanel::OnEraseBackground(wxEraseEvent& event) +void WinEDA_DrawPanel::OnEraseBackground( wxEraseEvent& event ) /***********************************************************/ { - event.Skip(); + event.Skip(); } + /*********************************************************/ -void WinEDA_DrawPanel::OnScroll( wxScrollWinEvent &event ) +void WinEDA_DrawPanel::OnScroll( wxScrollWinEvent& event ) /*********************************************************/ { -int id = event.GetEventType(); -int dir, value = 0; -int x,y; + int id = event.GetEventType(); + int dir, value = 0; + int x, y; - GetViewStart( &x, &y ); - dir = event.GetOrientation(); // wxHORIZONTAL ou wxVERTICAL + GetViewStart( &x, &y ); + 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 ) - { - value = event.GetPosition(); - if ( dir == wxHORIZONTAL ) Scroll( value, -1 ); - else Scroll( -1, value ); - return; - } + else if( id == wxEVT_SCROLLWIN_THUMBTRACK ) + { + value = event.GetPosition(); + if( dir == wxHORIZONTAL ) + Scroll( value, -1 ); + else + Scroll( -1, value ); + return; + } + else + { + event.Skip(); + return; + } - else - { - event.Skip(); - return; - } - - if ( dir == wxHORIZONTAL ) - { - Scroll( x + value, -1 ); - } - else - { - Scroll( -1, y + value ); - } - event.Skip(); + if( dir == wxHORIZONTAL ) + { + Scroll( x + value, -1 ); + } + else + { + Scroll( -1, y + value ); + } + event.Skip(); } /*************************************************/ -void WinEDA_DrawPanel::OnSize(wxSizeEvent & event) +void WinEDA_DrawPanel::OnSize( wxSizeEvent& event ) /*************************************************/ { - SetBoundaryBox(); - event.Skip(); + SetBoundaryBox(); + event.Skip(); } + /******************************************/ -void WinEDA_DrawPanel::SetBoundaryBox(void) +void WinEDA_DrawPanel::SetBoundaryBox( void ) /******************************************/ { -BASE_SCREEN * Screen = GetScreen();; -wxPoint org; -int ii, jj; + BASE_SCREEN* Screen = GetScreen();; - Screen->m_SizeVisu = GetClientSize(); - GetViewStart(&org.x, &org.y); + wxPoint org; + int ii, jj; - GetScrollPixelsPerUnit(&ii, &jj); - org.x *= ii; org.y *= jj; - Screen->m_StartVisu = org; + Screen->m_SizeVisu = GetClientSize(); + GetViewStart( &org.x, &org.y ); - m_ClipBox.SetOrigin(org); - m_ClipBox.SetSize(GetClientSize()); + GetScrollPixelsPerUnit( &ii, &jj ); + org.x *= ii; org.y *= jj; + Screen->m_StartVisu = org; + + m_ClipBox.SetOrigin( org ); + m_ClipBox.SetSize( GetClientSize() ); #ifdef WX_ZOOM - m_ClipBox.m_Pos.x *= GetZoom(); - m_ClipBox.m_Pos.y *= GetZoom(); - m_ClipBox.m_Size.x *= GetZoom(); - m_ClipBox.m_Size.y *= GetZoom(); + m_ClipBox.m_Pos.x *= GetZoom(); + m_ClipBox.m_Pos.y *= GetZoom(); + m_ClipBox.m_Size.x *= GetZoom(); + m_ClipBox.m_Size.y *= GetZoom(); #else - m_ClipBox.m_Pos.x -= GetScreen()->m_StartVisu.x; - m_ClipBox.m_Pos.y -= GetScreen()->m_StartVisu.y; + m_ClipBox.m_Pos.x -= GetScreen()->m_StartVisu.x; + m_ClipBox.m_Pos.y -= GetScreen()->m_StartVisu.y; #endif - m_ScrollButt_unit = MIN( Screen->m_SizeVisu.x, Screen->m_SizeVisu.y ) / 4; - if ( m_ScrollButt_unit < 2 ) m_ScrollButt_unit = 2; + m_ScrollButt_unit = MIN( Screen->m_SizeVisu.x, Screen->m_SizeVisu.y ) / 4; + if( m_ScrollButt_unit < 2 ) + m_ScrollButt_unit = 2; - Screen->m_ScrollbarPos.x = GetScrollPos(wxHORIZONTAL); - Screen->m_ScrollbarPos.y = GetScrollPos(wxVERTICAL); + Screen->m_ScrollbarPos.x = GetScrollPos( wxHORIZONTAL ); + Screen->m_ScrollbarPos.y = GetScrollPos( wxVERTICAL ); } /*********************************************/ -void WinEDA_DrawPanel::EraseScreen(wxDC * DC) +void WinEDA_DrawPanel::EraseScreen( wxDC* DC ) /*********************************************/ { - GRSetDrawMode(DC, GR_COPY); - GRSFilledRect(&m_ClipBox, DC, m_ClipBox.GetX(), m_ClipBox.GetY(), - m_ClipBox.GetRight(), m_ClipBox.GetBottom(), - g_DrawBgColor, g_DrawBgColor); + GRSetDrawMode( DC, GR_COPY ); + GRSFilledRect( &m_ClipBox, DC, m_ClipBox.GetX(), m_ClipBox.GetY(), + m_ClipBox.GetRight(), m_ClipBox.GetBottom(), + g_DrawBgColor, g_DrawBgColor ); } + /***************************************************/ -void WinEDA_DrawPanel::OnPaint(wxPaintEvent & event) +void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event ) /***************************************************/ { -wxPaintDC paintDC(this); -EDA_Rect tmp; -wxRect PaintClipBox; -wxPoint org; + wxPaintDC paintDC( this ); + EDA_Rect tmp; + wxRect PaintClipBox; + wxPoint org; - PrepareGraphicContext(&paintDC); - tmp = m_ClipBox; + PrepareGraphicContext( &paintDC ); + tmp = m_ClipBox; - org = m_ClipBox.GetOrigin(); + org = m_ClipBox.GetOrigin(); - wxRegionIterator upd(GetUpdateRegion()); // get the update rect list + wxRegionIterator upd( GetUpdateRegion() ); // get the update rect list - while ( upd ) - { - PaintClipBox = upd.GetRect(); - upd++; + while( upd ) + { + PaintClipBox = upd.GetRect(); + upd++; - PaintClipBox.x += org.x; - PaintClipBox.y += org.y; + PaintClipBox.x += org.x; + PaintClipBox.y += org.y; #ifdef WX_ZOOM - m_ClipBox.m_Pos.x = PaintClipBox.x * GetZoom(); - m_ClipBox.m_Pos.y = PaintClipBox.y * GetZoom(); - m_ClipBox.m_Size.x = PaintClipBox.m_Size.x * GetZoom(); - m_ClipBox.m_Size.y = PaintClipBox.m_Size.y * GetZoom(); - PaintClipBox = m_ClipBox; + m_ClipBox.m_Pos.x = PaintClipBox.x* GetZoom(); + + m_ClipBox.m_Pos.y = PaintClipBox.y* GetZoom(); + + m_ClipBox.m_Size.x = PaintClipBox.m_Size.x* GetZoom(); + + m_ClipBox.m_Size.y = PaintClipBox.m_Size.y* GetZoom(); + + PaintClipBox = m_ClipBox; #else - m_ClipBox.SetX(PaintClipBox.GetX()); - m_ClipBox.SetY(PaintClipBox.GetY()); - m_ClipBox.SetWidth(PaintClipBox.GetWidth()); - m_ClipBox.SetHeight(PaintClipBox.GetHeight()); + m_ClipBox.SetX( PaintClipBox.GetX() ); + m_ClipBox.SetY( PaintClipBox.GetY() ); + m_ClipBox.SetWidth( PaintClipBox.GetWidth() ); + m_ClipBox.SetHeight( PaintClipBox.GetHeight() ); #endif - wxDCClipper * dcclip = new wxDCClipper(paintDC, PaintClipBox); - ReDraw(&paintDC, TRUE); - delete dcclip; - } + wxDCClipper* dcclip = new wxDCClipper( paintDC, PaintClipBox ); + ReDraw( &paintDC, TRUE ); + delete dcclip; + } - m_ClipBox = tmp; - event.Skip(); + m_ClipBox = tmp; + event.Skip(); } + /****************************************************/ void WinEDA_DrawPanel::ReDraw( wxDC* DC, bool erasebg ) /****************************************************/ { - BASE_SCREEN * Screen = GetScreen(); + BASE_SCREEN* Screen = GetScreen(); - if( Screen == NULL ) + if( Screen == NULL ) return; - if( (g_DrawBgColor != WHITE) && (g_DrawBgColor != BLACK) ) + if( (g_DrawBgColor != WHITE) && (g_DrawBgColor != BLACK) ) g_DrawBgColor = BLACK; - - if( g_DrawBgColor == WHITE ) - { - g_XorMode = GR_NXOR; - g_GhostColor = BLACK; - } - else - { - g_XorMode = GR_XOR; - g_GhostColor = WHITE; - } + + if( g_DrawBgColor == WHITE ) + { + g_XorMode = GR_NXOR; + g_GhostColor = BLACK; + } + else + { + g_XorMode = GR_XOR; + g_GhostColor = WHITE; + } #ifdef WX_ZOOM - int zoom = GetZoom(); - double f_scale = 1.0/(double)zoom; - DC->SetUserScale(f_scale, f_scale); + int zoom = GetZoom(); + double f_scale = 1.0 / (double) zoom; + DC->SetUserScale( f_scale, f_scale ); #endif - if(erasebg) - PrepareGraphicContext(DC); - - DC->SetFont( *g_StdFont ); - - SetBackgroundColour( wxColour(ColorRefs[g_DrawBgColor].m_Red, - ColorRefs[g_DrawBgColor].m_Green, - ColorRefs[g_DrawBgColor].m_Blue ) ); + if( erasebg ) + PrepareGraphicContext( DC ); - GRResetPenAndBrush( DC ); + DC->SetFont( *g_StdFont ); - DC->SetBackground( *wxBLACK_BRUSH ); - DC->SetBackgroundMode( wxTRANSPARENT ); - m_Parent->RedrawActiveWindow( DC, erasebg ); + SetBackgroundColour( wxColour( ColorRefs[g_DrawBgColor].m_Red, + ColorRefs[g_DrawBgColor].m_Green, + ColorRefs[g_DrawBgColor].m_Blue ) ); + + GRResetPenAndBrush( DC ); + + DC->SetBackground( *wxBLACK_BRUSH ); + DC->SetBackgroundMode( wxTRANSPARENT ); + m_Parent->RedrawActiveWindow( DC, erasebg ); } /***********************************************/ -void WinEDA_DrawPanel::DrawBackGround(wxDC * DC) +void WinEDA_DrawPanel::DrawBackGround( wxDC* DC ) /***********************************************/ + /* Trace les axes X et Y et la grille - La grille n'est affichee que si elle peut etre facilement visible - La grille passe toujours par le centre de l'ecran -*/ + * La grille n'est affichee que si elle peut etre facilement visible + * La grille passe toujours par le centre de l'ecran + */ { -int Color = BLUE; -BASE_SCREEN * screen = GetScreen(); -int ii,jj ,xg , yg , color; -wxSize pas_grille_affichee; -bool drawgrid = FALSE; -int zoom = GetZoom(); -wxSize size; -wxPoint org; -double pasx, pasy; + int Color = BLUE; + BASE_SCREEN* screen = GetScreen(); + int ii, jj, xg, yg, color; + wxSize pas_grille_affichee; + bool drawgrid = FALSE; + int zoom = GetZoom(); + wxSize size; + wxPoint org; + double pasx, pasy; - color = g_GridColor; - GRSetDrawMode(DC, GR_COPY); + color = g_GridColor; + GRSetDrawMode( DC, GR_COPY ); - /* le pas d'affichage doit etre assez grand pour avoir une grille visible */ - drawgrid = m_Parent->m_Draw_Grid; - pas_grille_affichee = screen->GetGrid(); + /* le pas d'affichage doit etre assez grand pour avoir une grille visible */ + drawgrid = m_Parent->m_Draw_Grid; + pas_grille_affichee = screen->GetGrid(); - ii = pas_grille_affichee.x / zoom; - if (ii < 5 ) { pas_grille_affichee.x *= 2 ; ii *= 2; } - if( ii < 5 ) drawgrid = FALSE; // grille trop petite - ii = pas_grille_affichee.y / zoom; - if (ii < 5 ) { pas_grille_affichee.y *= 2 ; ii *= 2; } - if( ii < 5 ) drawgrid = FALSE; // grille trop petite + ii = pas_grille_affichee.x / zoom; + if( ii < 5 ) + { + pas_grille_affichee.x *= 2; ii *= 2; + } + if( ii < 5 ) + drawgrid = FALSE; // grille trop petite + ii = pas_grille_affichee.y / zoom; + if( ii < 5 ) + { + pas_grille_affichee.y *= 2; ii *= 2; + } + if( ii < 5 ) + drawgrid = FALSE; // grille trop petite - GetViewStart(&org.x, &org.y); - GetScrollPixelsPerUnit(&ii, &jj); - org.x *= ii; org.y *= jj; - screen->m_StartVisu = org; + GetViewStart( &org.x, &org.y ); + GetScrollPixelsPerUnit( &ii, &jj ); + org.x *= ii; org.y *= jj; + screen->m_StartVisu = org; - org.x *= zoom; org.y *= zoom; - org.x += screen->m_DrawOrg.x; org.y += screen->m_DrawOrg.y; + org.x *= zoom; org.y *= zoom; + org.x += screen->m_DrawOrg.x; org.y += screen->m_DrawOrg.y; - size = GetClientSize(); - size.x *= zoom; size.y *= zoom; - pasx = screen->m_UserGrid.x * m_Parent->m_InternalUnits; - pasy = screen->m_UserGrid.y * m_Parent->m_InternalUnits; - if ( screen->m_UserGridUnit != INCHES ) - { - pasx /= 25.4; pasy /= 25.4; - } + size = GetClientSize(); + size.x *= zoom; size.y *= zoom; + pasx = screen->m_UserGrid.x * m_Parent->m_InternalUnits; + pasy = screen->m_UserGrid.y * m_Parent->m_InternalUnits; + if( screen->m_UserGridUnit != INCHES ) + { + pasx /= 25.4; pasy /= 25.4; + } - if( drawgrid) - { - m_Parent->PutOnGrid(&org) ; + if( drawgrid ) + { + m_Parent->PutOnGrid( &org ); - GRSetColorPen(DC, color ); - for ( ii = 0 ; ; ii++ ) - { - xg = screen->m_UserGridIsON ? (int)( (ii * pasx) + 0.5) - :ii * pas_grille_affichee.x; - int xpos = org.x + xg; - for ( jj = 0 ; ; jj++ ) - { - yg = screen->m_UserGridIsON ? (int)( (jj * pasy) + 0.5) - : jj * pas_grille_affichee.y; - GRPutPixel(&m_ClipBox, DC, xpos, org.y + yg, color); - if ( yg > size.y ) break; - } - if ( xg > size.x ) break; - } - } + GRSetColorPen( DC, color ); + for( ii = 0; ; ii++ ) + { + xg = screen->m_UserGridIsON ? (int) ( (ii * pasx) + 0.5 ) + : ii * pas_grille_affichee.x; + int xpos = org.x + xg; + for( jj = 0; ; jj++ ) + { + yg = screen->m_UserGridIsON ? (int) ( (jj * pasy) + 0.5 ) + : jj * pas_grille_affichee.y; + GRPutPixel( &m_ClipBox, DC, xpos, org.y + yg, color ); + if( yg > size.y ) + break; + } - /* trace des axes principaux */ - if ( m_Parent->m_Draw_Axis ) - { - /* Trace de l'axe vertical */ - GRDashedLine(&m_ClipBox, DC, 0, -screen->ReturnPageSize().y, - 0, screen->ReturnPageSize().y, 0, Color ); + if( xg > size.x ) + break; + } + } - /* Trace de l'axe horizontal */ - GRDashedLine(&m_ClipBox, DC, -screen->ReturnPageSize().x, 0, - screen->ReturnPageSize().x, 0, 0, Color ); - } + /* trace des axes principaux */ + if( m_Parent->m_Draw_Axis ) + { + /* Trace de l'axe vertical */ + GRDashedLine( &m_ClipBox, DC, 0, -screen->ReturnPageSize().y, + 0, screen->ReturnPageSize().y, 0, Color ); - /* trace des axes auxiliaires */ - if ( m_Parent->m_Draw_Auxiliary_Axis) - { - m_Draw_Auxiliary_Axis(DC, FALSE); - } + /* Trace de l'axe horizontal */ + GRDashedLine( &m_ClipBox, DC, -screen->ReturnPageSize().x, 0, + screen->ReturnPageSize().x, 0, 0, Color ); + } + + /* trace des axes auxiliaires */ + if( m_Parent->m_Draw_Auxiliary_Axis ) + { + m_Draw_Auxiliary_Axis( DC, FALSE ); + } } + /********************************************************************/ -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 && - m_Parent->m_Auxiliary_Axis_Position.y == 0 ) - return; + if( m_Parent->m_Auxiliary_Axis_Position.x == 0 + && m_Parent->m_Auxiliary_Axis_Position.y == 0 ) + return; -int Color = DARKRED; -BASE_SCREEN * screen = GetScreen(); + int Color = DARKRED; + BASE_SCREEN* screen = GetScreen(); - GRSetDrawMode(DC, drawmode); + GRSetDrawMode( DC, drawmode ); - /* Trace de l'axe vertical */ - GRDashedLine(&m_ClipBox, DC, - m_Parent->m_Auxiliary_Axis_Position.x, -screen->ReturnPageSize().y, - m_Parent->m_Auxiliary_Axis_Position.x, screen->ReturnPageSize().y, - 0, Color ); + /* Trace de l'axe vertical */ + GRDashedLine( &m_ClipBox, DC, + m_Parent->m_Auxiliary_Axis_Position.x, -screen->ReturnPageSize().y, + m_Parent->m_Auxiliary_Axis_Position.x, screen->ReturnPageSize().y, + 0, Color ); - /* Trace de l'axe horizontal */ - GRDashedLine(&m_ClipBox, DC, - -screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axis_Position.y, - screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axis_Position.y, - 0, Color ); + /* Trace de l'axe horizontal */ + GRDashedLine( &m_ClipBox, DC, + -screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axis_Position.y, + screen->ReturnPageSize().x, m_Parent->m_Auxiliary_Axis_Position.y, + 0, Color ); } /*******************************************************/ -void WinEDA_DrawPanel::OnRightClick(wxMouseEvent& event) +void WinEDA_DrawPanel::OnRightClick( wxMouseEvent& event ) /*******************************************************/ + /* Construit et affiche un menu Popup lorsque on actionne le bouton droit - de la souris -*/ + * de la souris + */ { -wxPoint pos; -wxMenu MasterMenu; + wxPoint pos; + wxMenu MasterMenu; - pos.x = event.GetX(); pos.y = event.GetY(); - m_Parent->OnRightClick(pos, &MasterMenu); - AddMenuZoom(&MasterMenu); - m_IgnoreMouseEvents = TRUE; - PopupMenu( &MasterMenu, pos); - MouseToCursorSchema(); - m_IgnoreMouseEvents = FALSE; + pos.x = event.GetX(); + pos.y = event.GetY(); + + m_Parent->OnRightClick( pos, &MasterMenu ); + + AddMenuZoom( &MasterMenu ); + + m_IgnoreMouseEvents = TRUE; + PopupMenu( &MasterMenu, pos ); + MouseToCursorSchema(); + m_IgnoreMouseEvents = FALSE; } /******************************************************/ -void WinEDA_DrawPanel::OnMouseLeaving(wxMouseEvent& event) +void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event ) /*******************************************************/ + // Called when the canvas receives a mouse event leaving frame. // { - if (ManageCurseur == NULL ) // Pas de commande encours - m_AutoPAN_Request = FALSE; + if( ManageCurseur == NULL ) // Pas de commande encours + m_AutoPAN_Request = FALSE; - if ( ! m_AutoPAN_Enable || ! m_AutoPAN_Request || m_IgnoreMouseEvents) - return; - // Auto pan if mouse is leave working aera: - wxSize size = GetClientSize(); - if ( (size.x < event.GetX() ) || - (size.y < event.GetY() ) || - ( event.GetX() <= 0) || ( event.GetY() <= 0 ) ) - m_Parent->OnZoom(ID_POPUP_ZOOM_CENTER); + if( !m_AutoPAN_Enable || !m_AutoPAN_Request || m_IgnoreMouseEvents ) + return; + + // Auto pan if mouse is leave working aera: + wxSize size = GetClientSize(); + if( ( size.x < event.GetX() ) + || ( size.y < event.GetY() ) + || ( event.GetX() <= 0) || ( event.GetY() <= 0 ) ) + m_Parent->OnZoom( ID_POPUP_ZOOM_CENTER ); } /******************************************************/ -void WinEDA_DrawPanel::OnMouseEvent(wxMouseEvent& event) +void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event ) /*******************************************************/ + // Called when the canvas receives a mouse event. // { -int localrealbutt = 0, localbutt = 0, localkey = 0; -BASE_SCREEN * screen = GetScreen(); -static WinEDA_DrawPanel * LastPanel; - - if ( event.Leaving() || event.Entering() ) - { - m_CanStartBlock = -1; - } + int localrealbutt = 0, localbutt = 0, localkey = 0; + BASE_SCREEN* screen = GetScreen(); + static WinEDA_DrawPanel* LastPanel; - if (ManageCurseur == NULL ) // Pas de commande en cours - m_AutoPAN_Request = FALSE; + if( event.Leaving() || event.Entering() ) + { + m_CanStartBlock = -1; + } - if ( m_Parent->m_FrameIsActive ) SetFocus(); - else return; + if( ManageCurseur == NULL ) // Pas de commande en cours + m_AutoPAN_Request = FALSE; - // Mouse Wheel is a zoom command: - if ( event.m_wheelRotation ) - { - // This is a zoom in ou out command - if ( event.GetWheelRotation() > 0 ) - { - if( event.ShiftDown() ) localkey = EDA_PANNING_UP_KEY; - else if( event.ControlDown() ) localkey = EDA_PANNING_LEFT_KEY; - else localkey = WXK_F1; - } - else - { - if( event.ShiftDown() ) localkey = EDA_PANNING_DOWN_KEY; - else if( event.ControlDown() ) localkey = EDA_PANNING_RIGHT_KEY; - else localkey = WXK_F2; - } - } + if( m_Parent->m_FrameIsActive ) + SetFocus(); + else + return; - if( !event.IsButton() && !event.Moving() && - !event.Dragging() && ! localkey ) - { - return; - } + // Mouse Wheel is a zoom command: + if( event.m_wheelRotation ) + { + // This is a zoom in ou out command + if( event.GetWheelRotation() > 0 ) + { + if( event.ShiftDown() ) + localkey = EDA_PANNING_UP_KEY; + else if( event.ControlDown() ) + localkey = EDA_PANNING_LEFT_KEY; + else + localkey = WXK_F1; + } + else + { + if( event.ShiftDown() ) + localkey = EDA_PANNING_DOWN_KEY; + else if( event.ControlDown() ) + localkey = EDA_PANNING_RIGHT_KEY; + else + localkey = WXK_F2; + } + } - if( event.RightDown() ) - { - OnRightClick(event); return; - } + if( !event.IsButton() && !event.Moving() + && !event.Dragging() && !localkey ) + { + return; + } - if ( m_IgnoreMouseEvents ) return; + if( event.RightDown() ) + { + OnRightClick( event ); return; + } - if( event.LeftIsDown() ) localrealbutt |= GR_M_LEFT_DOWN; - if( event.MiddleIsDown() ) localrealbutt |= GR_M_MIDDLE_DOWN; + if( m_IgnoreMouseEvents ) + return; - if( event.LeftDown()) localbutt = GR_M_LEFT_DOWN; + if( event.LeftIsDown() ) + localrealbutt |= GR_M_LEFT_DOWN; + if( event.MiddleIsDown() ) + localrealbutt |= GR_M_MIDDLE_DOWN; - if( event.ButtonDClick(1)) localbutt = GR_M_LEFT_DOWN|GR_M_DCLICK; - if( event.MiddleDown()) localbutt = GR_M_MIDDLE_DOWN; - if( event.ButtonDClick(2)) {}; // Unused + if( event.LeftDown() ) + localbutt = GR_M_LEFT_DOWN; - localrealbutt |= localbutt; /* compensation defaut wxGTK */ + if( event.ButtonDClick( 1 ) ) + localbutt = GR_M_LEFT_DOWN | GR_M_DCLICK; + if( event.MiddleDown() ) + localbutt = GR_M_MIDDLE_DOWN; + if( event.ButtonDClick( 2 ) ) + { + } + ; // Unused - /* Compute absolute m_MousePosition in pixel units: */ - screen->m_MousePositionInPixels = CalcAbsolutePosition(wxPoint(event.GetX(), event.GetY())); - /* Compute absolute m_MousePosition in user units: */ - screen->m_MousePosition = CursorRealPosition(screen->m_MousePositionInPixels); + localrealbutt |= localbutt; /* compensation defaut wxGTK */ -wxClientDC DC(this); -int kbstat = 0; + /* Compute absolute m_MousePosition in pixel units: */ + screen->m_MousePositionInPixels = CalcAbsolutePosition( wxPoint( event.GetX(), event.GetY() ) ); + /* Compute absolute m_MousePosition in user units: */ + screen->m_MousePosition = CursorRealPosition( screen->m_MousePositionInPixels ); - DC.SetBackground(*wxBLACK_BRUSH ); - PrepareGraphicContext(&DC); + wxClientDC DC( this ); + int kbstat = 0; - g_KeyPressed = localkey; + DC.SetBackground( *wxBLACK_BRUSH ); + PrepareGraphicContext( &DC ); - if( event.ShiftDown() ) kbstat |= GR_KB_SHIFT; - if( event.ControlDown() ) kbstat |= GR_KB_CTRL; - if( event.AltDown() ) kbstat |= GR_KB_ALT; + g_KeyPressed = localkey; - g_MouseOldButtons = localrealbutt; + if( event.ShiftDown() ) + kbstat |= GR_KB_SHIFT; + if( event.ControlDown() ) + kbstat |= GR_KB_CTRL; + if( event.AltDown() ) + kbstat |= GR_KB_ALT; - // Appel des fonctions liées au Double Click ou au Click - if( localbutt == (int)(GR_M_LEFT_DOWN|GR_M_DCLICK) ) - m_Parent->OnLeftDClick(&DC, screen->m_MousePositionInPixels); + g_MouseOldButtons = localrealbutt; - else if ( event.LeftDown() ) - m_Parent->OnLeftClick(&DC, screen->m_MousePositionInPixels); + // Appel des fonctions liées au Double Click ou au Click + if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) ) + m_Parent->OnLeftDClick( &DC, screen->m_MousePositionInPixels ); - if( event.ButtonUp(2) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) ) - { // The middle button has been relached, with no block command: - // We use it for a zoom center command - g_KeyPressed = localkey = WXK_F4; - } - + else if( event.LeftDown() ) + m_Parent->OnLeftClick( &DC, screen->m_MousePositionInPixels ); - /* Appel de la fonction generale de gestion des mouvements souris - et commandes clavier */ - m_Parent->GeneralControle(&DC, screen->m_MousePositionInPixels); + if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) ) + { // The middle button has been relached, with no block command: + // We use it for a zoom center command + g_KeyPressed = localkey = WXK_F4; + } - /*******************************/ - /* Control of block commands : */ - /*******************************/ - - // Command block can't start if mouse is dragging a new panel - if (LastPanel != this ) m_CanStartBlock = -1; + /* Appel de la fonction generale de gestion des mouvements souris + * et commandes clavier */ + m_Parent->GeneralControle( &DC, screen->m_MousePositionInPixels ); - // A new command block can start after a release buttons - // Avoid a false start block when a dialog bos is demiss, - // or when changing panels in hierachy navigation - if ( !event.LeftIsDown() && !event.MiddleIsDown()) - { - m_CanStartBlock = 0; - } - if( m_Block_Enable && !(localbutt & GR_M_DCLICK) ) - { - if ( (screen->BlockLocate.m_Command == BLOCK_IDLE) || - (screen->BlockLocate.m_State == STATE_NO_BLOCK)) - { - m_CursorStartPos = screen->m_Curseur; - screen->BlockLocate.SetOrigin(m_CursorStartPos); - } - if ( event.LeftDown() || event.MiddleDown() ) - { - m_CursorStartPos = screen->m_Curseur; - if ( screen->BlockLocate.m_State == STATE_BLOCK_MOVE ) - { - m_AutoPAN_Request = FALSE; - m_Parent->HandleBlockPlace(&DC); - } - } - else if( (m_CanStartBlock >= 0 ) && - ( event.LeftIsDown() || event.MiddleIsDown() ) - && ManageCurseur == NULL - && ForceCloseManageCurseur == NULL ) - { - if ( screen->BlockLocate.m_State == STATE_NO_BLOCK ) - { - int cmd_type = kbstat; - if ( event.MiddleIsDown() ) cmd_type |= MOUSE_MIDDLE; - if ( ! m_Parent->HandleBlockBegin(&DC, cmd_type, m_CursorStartPos) ) - { // error - m_Parent->DisplayToolMsg( wxT("WinEDA_DrawPanel::OnMouseEvent() Block Error") ); - } - else - { - m_AutoPAN_Request = TRUE; - SetCursor(m_PanelCursor = wxCURSOR_SIZING); - } - } - } - - - 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 - du block ainsi delimite (MOVE, COPY). - Cependant bloc est annule si sa taille est trop petite*/ - bool BlockIsSmall = - ( ABS(screen->BlockLocate.GetWidth()/GetZoom()) < 3) && - ( ABS(screen->BlockLocate.GetHeight()/GetZoom()) < 3); - - if ( (screen->BlockLocate.m_State != STATE_NO_BLOCK) && BlockIsSmall ) - { - if( ForceCloseManageCurseur ) - { - ForceCloseManageCurseur(this, &DC); - m_AutoPAN_Request = FALSE; - } - SetCursor(m_PanelCursor = m_PanelDefaultCursor); - } - else if ( screen->BlockLocate.m_State == STATE_BLOCK_END ) - { - m_AutoPAN_Request = FALSE; - m_Parent->HandleBlockEnd(&DC); - SetCursor(m_PanelCursor = m_PanelDefaultCursor); - if ( screen->BlockLocate.m_State == STATE_BLOCK_MOVE ) - { - m_AutoPAN_Request = TRUE; - SetCursor(m_PanelCursor = wxCURSOR_HAND); - } - } - } + /*******************************/ + /* Control of block commands : */ + /*******************************/ - } + // Command block can't start if mouse is dragging a new panel + if( LastPanel != this ) + m_CanStartBlock = -1; - // Arret de block sur un double click ( qui peut provoquer un move block - // si on déplace la souris dans ce double click - if ( localbutt == (int)(GR_M_LEFT_DOWN|GR_M_DCLICK) ) - { - if ( screen->BlockLocate.m_Command != BLOCK_IDLE ) - { - if( ForceCloseManageCurseur ) - { - ForceCloseManageCurseur(this, &DC); - m_AutoPAN_Request = FALSE; - } - } - } + // A new command block can start after a release buttons + // Avoid a false start block when a dialog bos is demiss, + // or when changing panels in hierachy navigation + if( !event.LeftIsDown() && !event.MiddleIsDown() ) + { + m_CanStartBlock = 0; + } + + if( m_Block_Enable && !(localbutt & GR_M_DCLICK) ) + { + if( (screen->BlockLocate.m_Command == BLOCK_IDLE) + || (screen->BlockLocate.m_State == STATE_NO_BLOCK) ) + { + m_CursorStartPos = screen->m_Curseur; + screen->BlockLocate.SetOrigin( m_CursorStartPos ); + } + if( event.LeftDown() || event.MiddleDown() ) + { + m_CursorStartPos = screen->m_Curseur; + if( screen->BlockLocate.m_State == STATE_BLOCK_MOVE ) + { + m_AutoPAN_Request = FALSE; + m_Parent->HandleBlockPlace( &DC ); + } + } + else if( (m_CanStartBlock >= 0 ) + && ( event.LeftIsDown() || event.MiddleIsDown() ) + && ManageCurseur == NULL + && ForceCloseManageCurseur == NULL ) + { + if( screen->BlockLocate.m_State == STATE_NO_BLOCK ) + { + int cmd_type = kbstat; + if( event.MiddleIsDown() ) + cmd_type |= MOUSE_MIDDLE; + if( !m_Parent->HandleBlockBegin( &DC, cmd_type, m_CursorStartPos ) ) + { // error + m_Parent->DisplayToolMsg( wxT( "WinEDA_DrawPanel::OnMouseEvent() Block Error" ) + ); + } + else + { + m_AutoPAN_Request = TRUE; + SetCursor( m_PanelCursor = wxCURSOR_SIZING ); + } + } + } + + + 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 + * du block ainsi delimite (MOVE, COPY). + * Cependant bloc est annule si sa taille est trop petite + */ + bool BlockIsSmall = + ( ABS( screen->BlockLocate.GetWidth() / GetZoom() ) < 3) + && ( ABS( screen->BlockLocate.GetHeight() / GetZoom() ) < 3); + + if( (screen->BlockLocate.m_State != STATE_NO_BLOCK) && BlockIsSmall ) + { + if( ForceCloseManageCurseur ) + { + ForceCloseManageCurseur( this, &DC ); + m_AutoPAN_Request = FALSE; + } + SetCursor( m_PanelCursor = m_PanelDefaultCursor ); + } + else if( screen->BlockLocate.m_State == STATE_BLOCK_END ) + { + m_AutoPAN_Request = FALSE; + m_Parent->HandleBlockEnd( &DC ); + SetCursor( m_PanelCursor = m_PanelDefaultCursor ); + if( screen->BlockLocate.m_State == STATE_BLOCK_MOVE ) + { + m_AutoPAN_Request = TRUE; + SetCursor( m_PanelCursor = wxCURSOR_HAND ); + } + } + } + } + + // Arret de block sur un double click ( qui peut provoquer un move block + // si on déplace la souris dans ce double click + if( localbutt == (int) (GR_M_LEFT_DOWN | GR_M_DCLICK) ) + { + if( screen->BlockLocate.m_Command != BLOCK_IDLE ) + { + if( ForceCloseManageCurseur ) + { + ForceCloseManageCurseur( this, &DC ); + m_AutoPAN_Request = FALSE; + } + } + } #if 0 - wxString msg_debug; - msg_debug.Printf(" block state %d, cmd %d", - screen->BlockLocate.m_State, screen->BlockLocate.m_Command); - m_Parent->PrintMsg(msg_debug); + wxString msg_debug; + msg_debug.Printf( " block state %d, cmd %d", + screen->BlockLocate.m_State, screen->BlockLocate.m_Command ); + m_Parent->PrintMsg( msg_debug ); #endif - LastPanel = this; - m_Parent->SetToolbars(); + LastPanel = this; + m_Parent->SetToolbars(); } + /****************************************************/ -void WinEDA_DrawPanel::OnKeyEvent(wxKeyEvent& event) +void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event ) /****************************************************/ { -long key, localkey; -bool escape = FALSE; + long key, localkey; + bool escape = FALSE; - key = localkey = event.GetKeyCode(); + key = localkey = event.GetKeyCode(); - switch( localkey ) - { - case WXK_CONTROL: - case WXK_CAPITAL: - case WXK_SHIFT: - case WXK_NUMLOCK: - case WXK_LBUTTON: - case WXK_RBUTTON: - case 0x0135: /* Alt key */ - return; + switch( localkey ) + { + case WXK_CONTROL: + case WXK_CAPITAL: + case WXK_SHIFT: + case WXK_NUMLOCK: + case WXK_LBUTTON: + case WXK_RBUTTON: + case 0x0135: /* Alt key */ + return; - case WXK_ESCAPE: - escape = m_AbortRequest = TRUE; - break; - } + case WXK_ESCAPE: + escape = m_AbortRequest = TRUE; + break; + } - if( event.ControlDown() ) localkey |= GR_KB_CTRL; - if( event.AltDown() ) localkey |= GR_KB_ALT; - if( event.ShiftDown() && (key > 256) ) localkey |= GR_KB_SHIFT; + if( event.ControlDown() ) + localkey |= GR_KB_CTRL; + if( event.AltDown() ) + localkey |= GR_KB_ALT; + if( event.ShiftDown() && (key > 256) ) + localkey |= GR_KB_SHIFT; -wxClientDC DC(this); -BASE_SCREEN * Screen = GetScreen(); + wxClientDC DC( this ); + BASE_SCREEN* Screen = GetScreen(); - PrepareGraphicContext(&DC); + PrepareGraphicContext( &DC ); - g_KeyPressed = localkey; + g_KeyPressed = localkey; - if ( escape ) - { - if( ManageCurseur && ForceCloseManageCurseur ) - { - SetCursor(m_PanelCursor = m_PanelDefaultCursor); - ForceCloseManageCurseur(this, &DC); - SetCursor(m_PanelCursor = m_PanelDefaultCursor); - } - else + if( escape ) + { + if( ManageCurseur && ForceCloseManageCurseur ) + { + SetCursor( m_PanelCursor = m_PanelDefaultCursor ); + ForceCloseManageCurseur( this, &DC ); + SetCursor( m_PanelCursor = m_PanelDefaultCursor ); + } + else { m_PanelCursor = m_PanelDefaultCursor = wxCURSOR_ARROW; - m_Parent->SetToolID(0, m_PanelCursor, wxEmptyString); + m_Parent->SetToolID( 0, m_PanelCursor, wxEmptyString ); } - } + } - m_Parent->GeneralControle(&DC, Screen->m_MousePositionInPixels); + m_Parent->GeneralControle( &DC, Screen->m_MousePositionInPixels ); -#if 0 - event.Skip(); // Allow menu shortcut processing +#if 0 + event.Skip(); // Allow menu shortcut processing #endif } diff --git a/share/zoom.cpp b/share/zoom.cpp index ba249f166f..dde58e49cf 100644 --- a/share/zoom.cpp +++ b/share/zoom.cpp @@ -329,7 +329,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu ) int ii; wxString line; - grid_list_struct grid_list_pcb[] = + static const grid_list_struct grid_list_pcb[] = { { 1000, ID_POPUP_GRID_LEVEL_1000, wxT( " 100" ) }, { 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" ) } }; - grid_list_struct grid_list_schematic[] = + static const grid_list_struct grid_list_schematic[] = { { 50, ID_POPUP_GRID_LEVEL_50, wxT( " 50" ) }, { 25, ID_POPUP_GRID_LEVEL_25, wxT( " 25" ) },