Loading eeschema/dialog_edit_label.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,8 @@ void DialogLabelEditor::OnInitDialog( wxInitDialogEvent& event ) { { wxString msg; wxString msg; SetFont(*g_DialogFont); m_TextLabel->SetValue(m_CurrentText->m_Text); m_TextLabel->SetValue(m_CurrentText->m_Text); m_TextLabel->SetFocus(); m_TextLabel->SetFocus(); Loading Loading @@ -65,8 +67,6 @@ wxString msg; msg = ReturnStringFromValue(g_UnitMetric, m_CurrentText->m_Size.x, m_Parent->m_InternalUnits); msg = ReturnStringFromValue(g_UnitMetric, m_CurrentText->m_Size.x, m_Parent->m_InternalUnits); m_TextSize->SetValue(msg); m_TextSize->SetValue(msg); SetFocus(); if (m_CurrentText->Type() != TYPE_SCH_GLOBALLABEL && if (m_CurrentText->Type() != TYPE_SCH_GLOBALLABEL && m_CurrentText->Type() != TYPE_SCH_HIERLABEL) m_CurrentText->Type() != TYPE_SCH_HIERLABEL) m_TextShape->Show(false); m_TextShape->Show(false); Loading include/wxPcbStruct.h +1 −2 Original line number Original line Diff line number Diff line Loading @@ -453,8 +453,7 @@ public: void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ); void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ); void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); void InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, void InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC ); wxDC* DC, const wxPoint& pos ); // Graphic Segments type DRAWSEGMENT // Graphic Segments type DRAWSEGMENT void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ); void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ); Loading pcbnew/CMakeLists.txt +2 −1 Original line number Original line Diff line number Diff line Loading @@ -56,6 +56,7 @@ set(PCBNEW_SRCS # dialog_graphic_items_options.cpp # dialog_graphic_items_options.cpp # dialog_initpcb.cpp # dialog_initpcb.cpp # dialog_netlist.cpp # dialog_netlist.cpp dialog_pcb_text_properties.cpp zones_non_copper_type_functions.cpp zones_non_copper_type_functions.cpp dialog_non_copper_zones_properties_base.cpp dialog_non_copper_zones_properties_base.cpp dialog_pad_properties.cpp dialog_pad_properties.cpp Loading @@ -74,6 +75,7 @@ set(PCBNEW_SRCS editmod.cpp editmod.cpp editrack.cpp editrack.cpp editrack-part2.cpp editrack-part2.cpp edit_pcb_text.cpp edit_track_width.cpp edit_track_width.cpp edtxtmod.cpp edtxtmod.cpp export_gencad.cpp export_gencad.cpp Loading Loading @@ -114,7 +116,6 @@ set(PCBNEW_SRCS pcbframe.cpp pcbframe.cpp pcbnew.cpp pcbnew.cpp pcbplot.cpp pcbplot.cpp pcbtexte.cpp plotgerb.cpp plotgerb.cpp plothpgl.cpp plothpgl.cpp plotps.cpp plotps.cpp Loading pcbnew/class_pcb_text.cpp +16 −8 Original line number Original line Diff line number Diff line /************************************/ /*********************************************************/ /* fonctions de la classe TEXTE_PCB */ /* class TEXTE_PCB : texts on copper or technical layers */ /************************************/ /*********************************************************/ #include "fctsys.h" #include "fctsys.h" #include "wxstruct.h" #include "wxstruct.h" Loading Loading @@ -53,7 +53,7 @@ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum ) /****************************************************************/ /****************************************************************/ { { char text[1024], Line[1024]; char text[1024], Line[1024]; int dummy; char style[256]; while( GetLine( File, Line, LineNum ) != NULL ) while( GetLine( File, Line, LineNum ) != NULL ) { { Loading @@ -77,13 +77,18 @@ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum ) } } if( strncmp( Line, "De", 2 ) == 0 ) if( strncmp( Line, "De", 2 ) == 0 ) { { sscanf( Line + 2, " %d %d %lX %d\n", &m_Layer, &m_Miroir, style[0] = 0; &m_TimeStamp, &dummy ); sscanf( Line + 2, " %d %d %lX %s\n", &m_Layer, &m_Miroir, &m_TimeStamp, style ); if( m_Layer < FIRST_COPPER_LAYER ) if( m_Layer < FIRST_COPPER_LAYER ) m_Layer = FIRST_COPPER_LAYER; m_Layer = FIRST_COPPER_LAYER; if( m_Layer > LAST_NO_COPPER_LAYER ) if( m_Layer > LAST_NO_COPPER_LAYER ) m_Layer = LAST_NO_COPPER_LAYER; m_Layer = LAST_NO_COPPER_LAYER; if ( strnicmp( style, "Italic", 6) == 0 ) m_Italic = 1; else m_Italic = 0; continue; continue; } } } } Loading @@ -92,7 +97,9 @@ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum ) } } /*****************************************/ bool TEXTE_PCB::Save( FILE* aFile ) const bool TEXTE_PCB::Save( FILE* aFile ) const /*****************************************/ { { if( GetState( DELETED ) ) if( GetState( DELETED ) ) return true; return true; Loading @@ -101,6 +108,7 @@ bool TEXTE_PCB::Save( FILE* aFile ) const return true; return true; bool rc = false; bool rc = false; const char * style = m_Italic ? "Italic" : "Normal"; if( fprintf( aFile, "$TEXTPCB\n" ) != sizeof("$TEXTPCB\n")-1 ) if( fprintf( aFile, "$TEXTPCB\n" ) != sizeof("$TEXTPCB\n")-1 ) goto out; goto out; Loading @@ -108,7 +116,7 @@ bool TEXTE_PCB::Save( FILE* aFile ) const fprintf( aFile, "Te \"%s\"\n", CONV_TO_UTF8( m_Text ) ); fprintf( aFile, "Te \"%s\"\n", CONV_TO_UTF8( m_Text ) ); fprintf( aFile, "Po %d %d %d %d %d %d\n", fprintf( aFile, "Po %d %d %d %d %d %d\n", m_Pos.x, m_Pos.y, m_Size.x, m_Size.y, m_Width, m_Orient ); m_Pos.x, m_Pos.y, m_Size.x, m_Size.y, m_Width, m_Orient ); fprintf( aFile, "De %d %d %lX %d\n", m_Layer, m_Miroir, m_TimeStamp, 0 ); fprintf( aFile, "De %d %d %lX %s\n", m_Layer, m_Miroir, m_TimeStamp, style ); if( fprintf( aFile, "$EndTEXTPCB\n" ) != sizeof("$EndTEXTPCB\n")-1 ) if( fprintf( aFile, "$EndTEXTPCB\n" ) != sizeof("$EndTEXTPCB\n")-1 ) goto out; goto out; Loading pcbnew/pcbtexte.cpp→pcbnew/dialog_pcb_text_properties.cpp +29 −200 Original line number Original line Diff line number Diff line /**************************************************/ /***************************************************************************/ /* traitement des editions des textes sur modules */ /* Dialog editor for text on copper and technical layers (TEXTE_PCB class) */ /**************************************************/ /***************************************************************************/ #include "fctsys.h" #include "fctsys.h" #include "gr_basic.h" #include "gr_basic.h" Loading @@ -8,18 +8,6 @@ #include "common.h" #include "common.h" #include "pcbnew.h" #include "pcbnew.h" #include "protos.h" #define L_MIN_DESSIN 1 /* seuil de largeur des segments pour trace autre que filaire */ /* Routines Locales */ static void Move_Texte_Pcb( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void Exit_Texte_Pcb( WinEDA_DrawPanel* Panel, wxDC* DC ); /* Variables locales : */ static wxPoint old_pos; // position originelle du texte selecte enum id_TextPCB_properties { enum id_TextPCB_properties { ID_TEXTPCB_SELECT_LAYER = 1900 ID_TEXTPCB_SELECT_LAYER = 1900 }; }; Loading @@ -41,13 +29,14 @@ private: WinEDA_ValueCtrl* m_TxtWidthCtlr; WinEDA_ValueCtrl* m_TxtWidthCtlr; wxRadioBox* m_Orient; wxRadioBox* m_Orient; wxRadioBox* m_Mirror; wxRadioBox* m_Mirror; wxRadioBox* m_Style; WinEDAChoiceBox* m_SelLayerBox; WinEDAChoiceBox* m_SelLayerBox; public: public: // Constructor and destructor // Constructor and destructor WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* parent, WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* parent, TEXTE_PCB* TextPCB, wxDC* DC, const wxPoint& pos ); TEXTE_PCB* TextPCB, wxDC* DC ); ~WinEDA_TextPCBPropertiesFrame() ~WinEDA_TextPCBPropertiesFrame() { { } } Loading @@ -66,14 +55,12 @@ EVT_BUTTON( wxID_CANCEL, WinEDA_TextPCBPropertiesFrame::OnCancelClick ) END_EVENT_TABLE() END_EVENT_TABLE() /********************************************************************/ /******************************************************************************/ void WinEDA_PcbFrame::InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, void WinEDA_PcbFrame::InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC ) wxDC* DC, const wxPoint& pos ) /*******************************************************************************/ /********************************************************************/ { { DrawPanel->m_IgnoreMouseEvents = TRUE; DrawPanel->m_IgnoreMouseEvents = TRUE; WinEDA_TextPCBPropertiesFrame* frame = new WinEDA_TextPCBPropertiesFrame( this, WinEDA_TextPCBPropertiesFrame* frame = new WinEDA_TextPCBPropertiesFrame( this, TextPCB, DC ); TextPCB, DC, pos ); frame->ShowModal(); frame->ShowModal(); frame->Destroy(); frame->Destroy(); DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema(); Loading @@ -83,10 +70,8 @@ void WinEDA_PcbFrame::InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, /************************************************************************************/ /************************************************************************************/ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* parent, WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* parent, TEXTE_PCB* TextPCB, wxDC* DC, TEXTE_PCB* TextPCB, wxDC* DC ) : const wxPoint& framepos ) : wxDialog( parent, -1, _( "TextPCB properties" ), wxDefaultPosition, wxSize( 390, 340 ) ) wxDialog( parent, -1, _( "TextPCB properties" ), framepos, wxSize( 390, 340 ), DIALOG_STYLE ) /************************************************************************************/ /************************************************************************************/ { { wxButton* Button; wxButton* Button; Loading @@ -94,7 +79,6 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p m_Parent = parent; m_Parent = parent; SetFont( *g_DialogFont ); SetFont( *g_DialogFont ); m_DC = DC; m_DC = DC; Centre(); Centre(); Loading @@ -110,6 +94,7 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p MainBoxSizer->Add( MiddleBoxSizer, 0, wxGROW | wxALL, 5 ); MainBoxSizer->Add( MiddleBoxSizer, 0, wxGROW | wxALL, 5 ); MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); /* Creation des boutons de commande */ /* Creation des boutons de commande */ Button = new wxButton( this, wxID_OK, _( "OK" ) ); Button = new wxButton( this, wxID_OK, _( "OK" ) ); Button->SetForegroundColour( *wxRED ); Button->SetForegroundColour( *wxRED ); Loading Loading @@ -185,6 +170,16 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p m_Mirror->SetSelection( 1 ); m_Mirror->SetSelection( 1 ); MiddleBoxSizer->Add( m_Mirror, 0, wxGROW | wxALL, 5 ); MiddleBoxSizer->Add( m_Mirror, 0, wxGROW | wxALL, 5 ); int style = 0; if (CurrentTextPCB->m_Italic ) style = 1; wxString style_msg[] = { _( "Normal" ), _( "Italic" ) }; m_Style = new wxRadioBox( this, -1, _( "Style" ), wxDefaultPosition, wxSize( -1, -1 ), 2, style_msg, 1, wxRA_SPECIFY_COLS ); m_Style->SetSelection(style); MiddleBoxSizer->Add( m_Style, 0, wxGROW | wxALL, 5 ); GetSizer()->Fit( this ); GetSizer()->Fit( this ); GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this ); } } Loading Loading @@ -213,7 +208,7 @@ void WinEDA_TextPCBPropertiesFrame::OnOkClick( wxCommandEvent& event ) if ( newsize.y > TEXTS_MAX_WIDTH ) if ( newsize.y > TEXTS_MAX_WIDTH ) newsize.y = TEXTS_MAX_WIDTH; newsize.y = TEXTS_MAX_WIDTH; if( m_DC ) // Effacement ancien texte if( m_DC ) // Erase old text on screen { { CurrentTextPCB->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); CurrentTextPCB->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); } } Loading @@ -227,187 +222,21 @@ void WinEDA_TextPCBPropertiesFrame::OnOkClick( wxCommandEvent& event ) CurrentTextPCB->m_Width = m_TxtWidthCtlr->GetValue(); CurrentTextPCB->m_Width = m_TxtWidthCtlr->GetValue(); // test for acceptable values for parameters: // test for acceptable values for parameters: if ( CurrentTextPCB->m_Width > TEXTS_MAX_WIDTH) int max_tickness = min( CurrentTextPCB->m_Size.x, CurrentTextPCB->m_Size.y); CurrentTextPCB->m_Width = TEXTS_MAX_WIDTH; max_tickness /= 4; if ( CurrentTextPCB->m_Width > max_tickness) CurrentTextPCB->m_Width = max_tickness; CurrentTextPCB->m_Miroir = (m_Mirror->GetSelection() == 0) ? 1 : 0; CurrentTextPCB->m_Miroir = (m_Mirror->GetSelection() == 0) ? 1 : 0; CurrentTextPCB->m_Orient = m_Orient->GetSelection() * 900; CurrentTextPCB->m_Orient = m_Orient->GetSelection() * 900; CurrentTextPCB->SetLayer( m_SelLayerBox->GetChoice() ); CurrentTextPCB->SetLayer( m_SelLayerBox->GetChoice() ); CurrentTextPCB->m_Italic = m_Style->GetSelection() ? 1 : 0; if( m_DC ) // Affichage nouveau texte if( m_DC ) // Displya new text { { /* Redessin du Texte */ CurrentTextPCB->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); CurrentTextPCB->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); } } m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify(); EndModal( 1 ); EndModal( 1 ); } } /******************************************************/ void Exit_Texte_Pcb( WinEDA_DrawPanel* Panel, wxDC* DC ) /*******************************************************/ /* * Routine de sortie du menu edit texte Pcb * Si un texte est selectionne, ses coord initiales sont regenerees */ { TEXTE_PCB* TextePcb; TextePcb = (TEXTE_PCB*) Panel->GetScreen()->GetCurItem(); if( TextePcb ) { TextePcb->Draw( Panel, DC, GR_XOR ); TextePcb->m_Pos = old_pos; TextePcb->Draw( Panel, DC, GR_OR ); TextePcb->m_Flags = 0; } Panel->ManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL; ((WinEDA_PcbFrame*)Panel->m_Parent)->SetCurItem( NULL ); } /*********************************************************************/ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) /*********************************************************************/ /* * Routine de placement du texte en cours de deplacement */ { if( TextePcb == NULL ) return; TextePcb->Draw( DrawPanel, DC, GR_OR ); DrawPanel->ManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL; SetCurItem( NULL ); GetScreen()->SetModify(); TextePcb->m_Flags = 0; } /***********************************************************************/ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ) /***********************************************************************/ /* Routine de preparation du deplacement d'un texte */ { if( TextePcb == NULL ) return; old_pos = TextePcb->m_Pos; TextePcb->Draw( DrawPanel, DC, GR_XOR ); TextePcb->m_Flags |= IS_MOVED; TextePcb->Display_Infos( this ); DrawPanel->ManageCurseur = Move_Texte_Pcb; DrawPanel->ForceCloseManageCurseur = Exit_Texte_Pcb; SetCurItem( TextePcb ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); } /*************************************************************************/ static void Move_Texte_Pcb( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) /*************************************************************************/ /* Routine deplacant le texte PCB suivant le curseur de la souris */ { TEXTE_PCB* TextePcb = (TEXTE_PCB*) panel->GetScreen()->GetCurItem(); if( TextePcb == NULL ) return; /* effacement du texte : */ if( erase ) TextePcb->Draw( panel, DC, GR_XOR ); TextePcb->m_Pos = panel->GetScreen()->m_Curseur; /* Redessin du Texte */ TextePcb->Draw( panel, DC, GR_XOR ); } /**********************************************************************/ void WinEDA_PcbFrame::Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) /**********************************************************************/ { if( TextePcb == NULL ) return; TextePcb->Draw( DrawPanel, DC, GR_XOR ); /* Suppression du texte en Memoire*/ TextePcb ->DeleteStructure(); DrawPanel->ManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL; SetCurItem( NULL ); } /*******************************************************/ TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC ) /*******************************************************/ { TEXTE_PCB* TextePcb; TextePcb = new TEXTE_PCB( m_Pcb ); /* Chainage de la nouvelle structure en debut de liste */ m_Pcb->Add( TextePcb ); /* Mise a jour des caracteristiques */ TextePcb->m_Flags = IS_NEW; TextePcb->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer ); TextePcb->m_Miroir = 1; if( TextePcb->GetLayer() == COPPER_LAYER_N ) TextePcb->m_Miroir = 0; TextePcb->m_Size = g_DesignSettings.m_PcbTextSize; TextePcb->m_Pos = GetScreen()->m_Curseur; TextePcb->m_Width = g_DesignSettings.m_PcbTextWidth; InstallTextPCBOptionsFrame( TextePcb, DC, TextePcb->m_Pos ); if( TextePcb->m_Text.IsEmpty() ) { TextePcb ->DeleteStructure(); TextePcb = NULL; } else StartMoveTextePcb( TextePcb, DC ); return TextePcb; } /***********************************************************************/ void WinEDA_PcbFrame::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) /***********************************************************************/ { int angle = 900; int drawmode = GR_XOR; if( TextePcb == NULL ) return; /* effacement du texte : */ TextePcb->Draw( DrawPanel, DC, GR_XOR ); TextePcb->m_Orient += angle; if( TextePcb->m_Orient >= 3600 ) TextePcb->m_Orient -= 3600; if( TextePcb->m_Orient < 0 ) TextePcb->m_Orient += 3600; /* Redessin du Texte */ TextePcb->Draw( DrawPanel, DC, drawmode ); TextePcb->Display_Infos( this ); GetScreen()->SetModify(); } Loading
eeschema/dialog_edit_label.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,8 @@ void DialogLabelEditor::OnInitDialog( wxInitDialogEvent& event ) { { wxString msg; wxString msg; SetFont(*g_DialogFont); m_TextLabel->SetValue(m_CurrentText->m_Text); m_TextLabel->SetValue(m_CurrentText->m_Text); m_TextLabel->SetFocus(); m_TextLabel->SetFocus(); Loading Loading @@ -65,8 +67,6 @@ wxString msg; msg = ReturnStringFromValue(g_UnitMetric, m_CurrentText->m_Size.x, m_Parent->m_InternalUnits); msg = ReturnStringFromValue(g_UnitMetric, m_CurrentText->m_Size.x, m_Parent->m_InternalUnits); m_TextSize->SetValue(msg); m_TextSize->SetValue(msg); SetFocus(); if (m_CurrentText->Type() != TYPE_SCH_GLOBALLABEL && if (m_CurrentText->Type() != TYPE_SCH_GLOBALLABEL && m_CurrentText->Type() != TYPE_SCH_HIERLABEL) m_CurrentText->Type() != TYPE_SCH_HIERLABEL) m_TextShape->Show(false); m_TextShape->Show(false); Loading
include/wxPcbStruct.h +1 −2 Original line number Original line Diff line number Diff line Loading @@ -453,8 +453,7 @@ public: void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ); void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ); void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); void InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, void InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC ); wxDC* DC, const wxPoint& pos ); // Graphic Segments type DRAWSEGMENT // Graphic Segments type DRAWSEGMENT void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ); void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ); Loading
pcbnew/CMakeLists.txt +2 −1 Original line number Original line Diff line number Diff line Loading @@ -56,6 +56,7 @@ set(PCBNEW_SRCS # dialog_graphic_items_options.cpp # dialog_graphic_items_options.cpp # dialog_initpcb.cpp # dialog_initpcb.cpp # dialog_netlist.cpp # dialog_netlist.cpp dialog_pcb_text_properties.cpp zones_non_copper_type_functions.cpp zones_non_copper_type_functions.cpp dialog_non_copper_zones_properties_base.cpp dialog_non_copper_zones_properties_base.cpp dialog_pad_properties.cpp dialog_pad_properties.cpp Loading @@ -74,6 +75,7 @@ set(PCBNEW_SRCS editmod.cpp editmod.cpp editrack.cpp editrack.cpp editrack-part2.cpp editrack-part2.cpp edit_pcb_text.cpp edit_track_width.cpp edit_track_width.cpp edtxtmod.cpp edtxtmod.cpp export_gencad.cpp export_gencad.cpp Loading Loading @@ -114,7 +116,6 @@ set(PCBNEW_SRCS pcbframe.cpp pcbframe.cpp pcbnew.cpp pcbnew.cpp pcbplot.cpp pcbplot.cpp pcbtexte.cpp plotgerb.cpp plotgerb.cpp plothpgl.cpp plothpgl.cpp plotps.cpp plotps.cpp Loading
pcbnew/class_pcb_text.cpp +16 −8 Original line number Original line Diff line number Diff line /************************************/ /*********************************************************/ /* fonctions de la classe TEXTE_PCB */ /* class TEXTE_PCB : texts on copper or technical layers */ /************************************/ /*********************************************************/ #include "fctsys.h" #include "fctsys.h" #include "wxstruct.h" #include "wxstruct.h" Loading Loading @@ -53,7 +53,7 @@ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum ) /****************************************************************/ /****************************************************************/ { { char text[1024], Line[1024]; char text[1024], Line[1024]; int dummy; char style[256]; while( GetLine( File, Line, LineNum ) != NULL ) while( GetLine( File, Line, LineNum ) != NULL ) { { Loading @@ -77,13 +77,18 @@ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum ) } } if( strncmp( Line, "De", 2 ) == 0 ) if( strncmp( Line, "De", 2 ) == 0 ) { { sscanf( Line + 2, " %d %d %lX %d\n", &m_Layer, &m_Miroir, style[0] = 0; &m_TimeStamp, &dummy ); sscanf( Line + 2, " %d %d %lX %s\n", &m_Layer, &m_Miroir, &m_TimeStamp, style ); if( m_Layer < FIRST_COPPER_LAYER ) if( m_Layer < FIRST_COPPER_LAYER ) m_Layer = FIRST_COPPER_LAYER; m_Layer = FIRST_COPPER_LAYER; if( m_Layer > LAST_NO_COPPER_LAYER ) if( m_Layer > LAST_NO_COPPER_LAYER ) m_Layer = LAST_NO_COPPER_LAYER; m_Layer = LAST_NO_COPPER_LAYER; if ( strnicmp( style, "Italic", 6) == 0 ) m_Italic = 1; else m_Italic = 0; continue; continue; } } } } Loading @@ -92,7 +97,9 @@ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum ) } } /*****************************************/ bool TEXTE_PCB::Save( FILE* aFile ) const bool TEXTE_PCB::Save( FILE* aFile ) const /*****************************************/ { { if( GetState( DELETED ) ) if( GetState( DELETED ) ) return true; return true; Loading @@ -101,6 +108,7 @@ bool TEXTE_PCB::Save( FILE* aFile ) const return true; return true; bool rc = false; bool rc = false; const char * style = m_Italic ? "Italic" : "Normal"; if( fprintf( aFile, "$TEXTPCB\n" ) != sizeof("$TEXTPCB\n")-1 ) if( fprintf( aFile, "$TEXTPCB\n" ) != sizeof("$TEXTPCB\n")-1 ) goto out; goto out; Loading @@ -108,7 +116,7 @@ bool TEXTE_PCB::Save( FILE* aFile ) const fprintf( aFile, "Te \"%s\"\n", CONV_TO_UTF8( m_Text ) ); fprintf( aFile, "Te \"%s\"\n", CONV_TO_UTF8( m_Text ) ); fprintf( aFile, "Po %d %d %d %d %d %d\n", fprintf( aFile, "Po %d %d %d %d %d %d\n", m_Pos.x, m_Pos.y, m_Size.x, m_Size.y, m_Width, m_Orient ); m_Pos.x, m_Pos.y, m_Size.x, m_Size.y, m_Width, m_Orient ); fprintf( aFile, "De %d %d %lX %d\n", m_Layer, m_Miroir, m_TimeStamp, 0 ); fprintf( aFile, "De %d %d %lX %s\n", m_Layer, m_Miroir, m_TimeStamp, style ); if( fprintf( aFile, "$EndTEXTPCB\n" ) != sizeof("$EndTEXTPCB\n")-1 ) if( fprintf( aFile, "$EndTEXTPCB\n" ) != sizeof("$EndTEXTPCB\n")-1 ) goto out; goto out; Loading
pcbnew/pcbtexte.cpp→pcbnew/dialog_pcb_text_properties.cpp +29 −200 Original line number Original line Diff line number Diff line /**************************************************/ /***************************************************************************/ /* traitement des editions des textes sur modules */ /* Dialog editor for text on copper and technical layers (TEXTE_PCB class) */ /**************************************************/ /***************************************************************************/ #include "fctsys.h" #include "fctsys.h" #include "gr_basic.h" #include "gr_basic.h" Loading @@ -8,18 +8,6 @@ #include "common.h" #include "common.h" #include "pcbnew.h" #include "pcbnew.h" #include "protos.h" #define L_MIN_DESSIN 1 /* seuil de largeur des segments pour trace autre que filaire */ /* Routines Locales */ static void Move_Texte_Pcb( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void Exit_Texte_Pcb( WinEDA_DrawPanel* Panel, wxDC* DC ); /* Variables locales : */ static wxPoint old_pos; // position originelle du texte selecte enum id_TextPCB_properties { enum id_TextPCB_properties { ID_TEXTPCB_SELECT_LAYER = 1900 ID_TEXTPCB_SELECT_LAYER = 1900 }; }; Loading @@ -41,13 +29,14 @@ private: WinEDA_ValueCtrl* m_TxtWidthCtlr; WinEDA_ValueCtrl* m_TxtWidthCtlr; wxRadioBox* m_Orient; wxRadioBox* m_Orient; wxRadioBox* m_Mirror; wxRadioBox* m_Mirror; wxRadioBox* m_Style; WinEDAChoiceBox* m_SelLayerBox; WinEDAChoiceBox* m_SelLayerBox; public: public: // Constructor and destructor // Constructor and destructor WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* parent, WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* parent, TEXTE_PCB* TextPCB, wxDC* DC, const wxPoint& pos ); TEXTE_PCB* TextPCB, wxDC* DC ); ~WinEDA_TextPCBPropertiesFrame() ~WinEDA_TextPCBPropertiesFrame() { { } } Loading @@ -66,14 +55,12 @@ EVT_BUTTON( wxID_CANCEL, WinEDA_TextPCBPropertiesFrame::OnCancelClick ) END_EVENT_TABLE() END_EVENT_TABLE() /********************************************************************/ /******************************************************************************/ void WinEDA_PcbFrame::InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, void WinEDA_PcbFrame::InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC ) wxDC* DC, const wxPoint& pos ) /*******************************************************************************/ /********************************************************************/ { { DrawPanel->m_IgnoreMouseEvents = TRUE; DrawPanel->m_IgnoreMouseEvents = TRUE; WinEDA_TextPCBPropertiesFrame* frame = new WinEDA_TextPCBPropertiesFrame( this, WinEDA_TextPCBPropertiesFrame* frame = new WinEDA_TextPCBPropertiesFrame( this, TextPCB, DC ); TextPCB, DC, pos ); frame->ShowModal(); frame->ShowModal(); frame->Destroy(); frame->Destroy(); DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema(); Loading @@ -83,10 +70,8 @@ void WinEDA_PcbFrame::InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, /************************************************************************************/ /************************************************************************************/ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* parent, WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* parent, TEXTE_PCB* TextPCB, wxDC* DC, TEXTE_PCB* TextPCB, wxDC* DC ) : const wxPoint& framepos ) : wxDialog( parent, -1, _( "TextPCB properties" ), wxDefaultPosition, wxSize( 390, 340 ) ) wxDialog( parent, -1, _( "TextPCB properties" ), framepos, wxSize( 390, 340 ), DIALOG_STYLE ) /************************************************************************************/ /************************************************************************************/ { { wxButton* Button; wxButton* Button; Loading @@ -94,7 +79,6 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p m_Parent = parent; m_Parent = parent; SetFont( *g_DialogFont ); SetFont( *g_DialogFont ); m_DC = DC; m_DC = DC; Centre(); Centre(); Loading @@ -110,6 +94,7 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p MainBoxSizer->Add( MiddleBoxSizer, 0, wxGROW | wxALL, 5 ); MainBoxSizer->Add( MiddleBoxSizer, 0, wxGROW | wxALL, 5 ); MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); /* Creation des boutons de commande */ /* Creation des boutons de commande */ Button = new wxButton( this, wxID_OK, _( "OK" ) ); Button = new wxButton( this, wxID_OK, _( "OK" ) ); Button->SetForegroundColour( *wxRED ); Button->SetForegroundColour( *wxRED ); Loading Loading @@ -185,6 +170,16 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p m_Mirror->SetSelection( 1 ); m_Mirror->SetSelection( 1 ); MiddleBoxSizer->Add( m_Mirror, 0, wxGROW | wxALL, 5 ); MiddleBoxSizer->Add( m_Mirror, 0, wxGROW | wxALL, 5 ); int style = 0; if (CurrentTextPCB->m_Italic ) style = 1; wxString style_msg[] = { _( "Normal" ), _( "Italic" ) }; m_Style = new wxRadioBox( this, -1, _( "Style" ), wxDefaultPosition, wxSize( -1, -1 ), 2, style_msg, 1, wxRA_SPECIFY_COLS ); m_Style->SetSelection(style); MiddleBoxSizer->Add( m_Style, 0, wxGROW | wxALL, 5 ); GetSizer()->Fit( this ); GetSizer()->Fit( this ); GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this ); } } Loading Loading @@ -213,7 +208,7 @@ void WinEDA_TextPCBPropertiesFrame::OnOkClick( wxCommandEvent& event ) if ( newsize.y > TEXTS_MAX_WIDTH ) if ( newsize.y > TEXTS_MAX_WIDTH ) newsize.y = TEXTS_MAX_WIDTH; newsize.y = TEXTS_MAX_WIDTH; if( m_DC ) // Effacement ancien texte if( m_DC ) // Erase old text on screen { { CurrentTextPCB->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); CurrentTextPCB->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); } } Loading @@ -227,187 +222,21 @@ void WinEDA_TextPCBPropertiesFrame::OnOkClick( wxCommandEvent& event ) CurrentTextPCB->m_Width = m_TxtWidthCtlr->GetValue(); CurrentTextPCB->m_Width = m_TxtWidthCtlr->GetValue(); // test for acceptable values for parameters: // test for acceptable values for parameters: if ( CurrentTextPCB->m_Width > TEXTS_MAX_WIDTH) int max_tickness = min( CurrentTextPCB->m_Size.x, CurrentTextPCB->m_Size.y); CurrentTextPCB->m_Width = TEXTS_MAX_WIDTH; max_tickness /= 4; if ( CurrentTextPCB->m_Width > max_tickness) CurrentTextPCB->m_Width = max_tickness; CurrentTextPCB->m_Miroir = (m_Mirror->GetSelection() == 0) ? 1 : 0; CurrentTextPCB->m_Miroir = (m_Mirror->GetSelection() == 0) ? 1 : 0; CurrentTextPCB->m_Orient = m_Orient->GetSelection() * 900; CurrentTextPCB->m_Orient = m_Orient->GetSelection() * 900; CurrentTextPCB->SetLayer( m_SelLayerBox->GetChoice() ); CurrentTextPCB->SetLayer( m_SelLayerBox->GetChoice() ); CurrentTextPCB->m_Italic = m_Style->GetSelection() ? 1 : 0; if( m_DC ) // Affichage nouveau texte if( m_DC ) // Displya new text { { /* Redessin du Texte */ CurrentTextPCB->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); CurrentTextPCB->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); } } m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify(); EndModal( 1 ); EndModal( 1 ); } } /******************************************************/ void Exit_Texte_Pcb( WinEDA_DrawPanel* Panel, wxDC* DC ) /*******************************************************/ /* * Routine de sortie du menu edit texte Pcb * Si un texte est selectionne, ses coord initiales sont regenerees */ { TEXTE_PCB* TextePcb; TextePcb = (TEXTE_PCB*) Panel->GetScreen()->GetCurItem(); if( TextePcb ) { TextePcb->Draw( Panel, DC, GR_XOR ); TextePcb->m_Pos = old_pos; TextePcb->Draw( Panel, DC, GR_OR ); TextePcb->m_Flags = 0; } Panel->ManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL; ((WinEDA_PcbFrame*)Panel->m_Parent)->SetCurItem( NULL ); } /*********************************************************************/ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) /*********************************************************************/ /* * Routine de placement du texte en cours de deplacement */ { if( TextePcb == NULL ) return; TextePcb->Draw( DrawPanel, DC, GR_OR ); DrawPanel->ManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL; SetCurItem( NULL ); GetScreen()->SetModify(); TextePcb->m_Flags = 0; } /***********************************************************************/ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ) /***********************************************************************/ /* Routine de preparation du deplacement d'un texte */ { if( TextePcb == NULL ) return; old_pos = TextePcb->m_Pos; TextePcb->Draw( DrawPanel, DC, GR_XOR ); TextePcb->m_Flags |= IS_MOVED; TextePcb->Display_Infos( this ); DrawPanel->ManageCurseur = Move_Texte_Pcb; DrawPanel->ForceCloseManageCurseur = Exit_Texte_Pcb; SetCurItem( TextePcb ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); } /*************************************************************************/ static void Move_Texte_Pcb( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) /*************************************************************************/ /* Routine deplacant le texte PCB suivant le curseur de la souris */ { TEXTE_PCB* TextePcb = (TEXTE_PCB*) panel->GetScreen()->GetCurItem(); if( TextePcb == NULL ) return; /* effacement du texte : */ if( erase ) TextePcb->Draw( panel, DC, GR_XOR ); TextePcb->m_Pos = panel->GetScreen()->m_Curseur; /* Redessin du Texte */ TextePcb->Draw( panel, DC, GR_XOR ); } /**********************************************************************/ void WinEDA_PcbFrame::Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) /**********************************************************************/ { if( TextePcb == NULL ) return; TextePcb->Draw( DrawPanel, DC, GR_XOR ); /* Suppression du texte en Memoire*/ TextePcb ->DeleteStructure(); DrawPanel->ManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL; SetCurItem( NULL ); } /*******************************************************/ TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC ) /*******************************************************/ { TEXTE_PCB* TextePcb; TextePcb = new TEXTE_PCB( m_Pcb ); /* Chainage de la nouvelle structure en debut de liste */ m_Pcb->Add( TextePcb ); /* Mise a jour des caracteristiques */ TextePcb->m_Flags = IS_NEW; TextePcb->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer ); TextePcb->m_Miroir = 1; if( TextePcb->GetLayer() == COPPER_LAYER_N ) TextePcb->m_Miroir = 0; TextePcb->m_Size = g_DesignSettings.m_PcbTextSize; TextePcb->m_Pos = GetScreen()->m_Curseur; TextePcb->m_Width = g_DesignSettings.m_PcbTextWidth; InstallTextPCBOptionsFrame( TextePcb, DC, TextePcb->m_Pos ); if( TextePcb->m_Text.IsEmpty() ) { TextePcb ->DeleteStructure(); TextePcb = NULL; } else StartMoveTextePcb( TextePcb, DC ); return TextePcb; } /***********************************************************************/ void WinEDA_PcbFrame::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) /***********************************************************************/ { int angle = 900; int drawmode = GR_XOR; if( TextePcb == NULL ) return; /* effacement du texte : */ TextePcb->Draw( DrawPanel, DC, GR_XOR ); TextePcb->m_Orient += angle; if( TextePcb->m_Orient >= 3600 ) TextePcb->m_Orient -= 3600; if( TextePcb->m_Orient < 0 ) TextePcb->m_Orient += 3600; /* Redessin du Texte */ TextePcb->Draw( DrawPanel, DC, drawmode ); TextePcb->Display_Infos( this ); GetScreen()->SetModify(); }