Commit 1b1be195 authored by charras's avatar charras

changes in modedit for MacOSX compatibility

parent 8bf79111
...@@ -188,8 +188,7 @@ public: ...@@ -188,8 +188,7 @@ public:
int DrawMode, int color, int type ); int DrawMode, int color, int type );
// Gestion des modules // Gestion des modules
void InstallModuleOptionsFrame( MODULE* Module, void InstallModuleOptionsFrame( MODULE* Module, wxDC * DC );
wxDC* DC, const wxPoint& pos );
MODULE* Copie_Module( MODULE* module ); MODULE* Copie_Module( MODULE* module );
MODULE* Exchange_Module( wxWindow* winaff, MODULE* Exchange_Module( wxWindow* winaff,
MODULE* old_module, MODULE* old_module,
...@@ -228,7 +227,7 @@ public: ...@@ -228,7 +227,7 @@ public:
// module texts // module texts
void RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ); void RotateTextModule( TEXTE_MODULE* Text, wxDC* DC );
void DeleteTextModule( TEXTE_MODULE* Text, wxDC* DC ); void DeleteTextModule( TEXTE_MODULE* Text );
void PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ); void PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC );
void StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC ); void StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC );
TEXTE_MODULE* CreateTextModule( MODULE* Module, wxDC* DC ); TEXTE_MODULE* CreateTextModule( MODULE* Module, wxDC* DC );
...@@ -1000,9 +999,9 @@ private: ...@@ -1000,9 +999,9 @@ private:
public: public:
// Footprint edition // Footprint edition
void Place_Ancre( MODULE* module, wxDC* DC ); void Place_Ancre( MODULE* module );
void RemoveStruct( EDA_BaseStruct* Item, wxDC* DC ); void RemoveStruct( EDA_BaseStruct* Item );
void Transform( MODULE* module, wxDC* DC, int transform ); void Transform( MODULE* module, int transform );
// loading Footprint // loading Footprint
MODULE* Import_Module( wxDC* DC ); MODULE* Import_Module( wxDC* DC );
...@@ -1010,9 +1009,9 @@ public: ...@@ -1010,9 +1009,9 @@ public:
void Load_Module_Module_From_BOARD( MODULE* Module ); void Load_Module_Module_From_BOARD( MODULE* Module );
// functions to edit footprint edges // functions to edit footprint edges
void Edit_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ); void Edit_Edge_Width( EDGE_MODULE* Edge );
void Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC ); void Edit_Edge_Layer( EDGE_MODULE* Edge );
void Delete_Edge_Module( EDGE_MODULE* Edge, wxDC* DC ); void Delete_Edge_Module( EDGE_MODULE* Edge );
EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, int type_edge ); EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, int type_edge );
void End_Edge_Module( EDGE_MODULE* Edge, wxDC* DC ); void End_Edge_Module( EDGE_MODULE* Edge, wxDC* DC );
void Enter_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ); void Enter_Edge_Width( EDGE_MODULE* Edge, wxDC* DC );
......
No preview for this file type
...@@ -3,7 +3,7 @@ msgstr "" ...@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: kicad\n" "Project-Id-Version: kicad\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-05-21 17:31+0100\n" "POT-Creation-Date: 2009-05-21 17:31+0100\n"
"PO-Revision-Date: 2009-05-21 17:37+0100\n" "PO-Revision-Date: 2009-05-21 18:16+0100\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: kicad team <jean-pierre.charras@ujf-grenoble.fr>\n" "Language-Team: kicad team <jean-pierre.charras@ujf-grenoble.fr>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
...@@ -290,11 +290,11 @@ msgstr "Nettoyage segments nulls" ...@@ -290,11 +290,11 @@ msgstr "Nettoyage segments nulls"
#: pcbnew/clean.cpp:506 #: pcbnew/clean.cpp:506
msgid "Merging Segments:" msgid "Merging Segments:"
msgstr "Fusionner Segments:" msgstr "Fusion des Segments:"
#: pcbnew/clean.cpp:508 #: pcbnew/clean.cpp:508
msgid "Merge" msgid "Merge"
msgstr "Fusionner" msgstr "Fusion"
#: pcbnew/clean.cpp:508 #: pcbnew/clean.cpp:508
msgid "0" msgid "0"
...@@ -374,7 +374,7 @@ msgstr "Erreur en Chargement de librairie" ...@@ -374,7 +374,7 @@ msgstr "Erreur en Chargement de librairie"
#: pcbnew/loadcmp.cpp:221 #: pcbnew/loadcmp.cpp:221
#, c-format #, c-format
msgid "Could not open PCB footprint library file <%s>." msgid "Could not open PCB footprint library file <%s>."
msgstr "Ne peu ouvrir le fichier librairie de modules PCB <%s>." msgstr "Ne peut ouvrir le fichier librairie de modules PCB <%s>."
#: pcbnew/loadcmp.cpp:228 #: pcbnew/loadcmp.cpp:228
#, c-format #, c-format
......
...@@ -37,9 +37,8 @@ END_EVENT_TABLE() ...@@ -37,9 +37,8 @@ END_EVENT_TABLE()
/**************************************************************************************/ /**************************************************************************************/
WinEDA_ModulePropertiesFrame::WinEDA_ModulePropertiesFrame( WinEDA_BasePcbFrame* parent, WinEDA_ModulePropertiesFrame::WinEDA_ModulePropertiesFrame( WinEDA_BasePcbFrame* parent,
MODULE* Module, wxDC* DC, MODULE* Module, wxDC* DC ) :
const wxPoint& framepos ) : wxDialog( parent, -1, _( "Module properties" ), wxDefaultPosition, wxDefaultSize, DIALOG_STYLE )
wxDialog( parent, -1, _( "Module properties" ), framepos, wxDefaultSize, DIALOG_STYLE )
/**************************************************************************************/ /**************************************************************************************/
{ {
wxString number; wxString number;
...@@ -813,7 +812,7 @@ void WinEDA_ModulePropertiesFrame::EditOrDelTextModule( wxCommandEvent& event ) ...@@ -813,7 +812,7 @@ void WinEDA_ModulePropertiesFrame::EditOrDelTextModule( wxCommandEvent& event )
Line.Printf( _( "Delete [%s]" ), Text->m_Text.GetData() ); Line.Printf( _( "Delete [%s]" ), Text->m_Text.GetData() );
if( !IsOK( this, Line ) ) if( !IsOK( this, Line ) )
goto out; goto out;
m_Parent->DeleteTextModule( Text, m_DC ); m_Parent->DeleteTextModule( Text );
ReCreateFieldListBox(); ReCreateFieldListBox();
m_TextListBox->SetSelection( 0 ); m_TextListBox->SetSelection( 0 );
} }
......
...@@ -54,7 +54,7 @@ private: ...@@ -54,7 +54,7 @@ private:
public: public:
// Constructor and destructor // Constructor and destructor
WinEDA_ModulePropertiesFrame(WinEDA_BasePcbFrame *parent, WinEDA_ModulePropertiesFrame(WinEDA_BasePcbFrame *parent,
MODULE * Module, wxDC * DC, const wxPoint & pos); MODULE * Module, wxDC * DC);
~WinEDA_ModulePropertiesFrame() ~WinEDA_ModulePropertiesFrame()
{ {
} }
......
...@@ -144,7 +144,7 @@ static void ShowEdgeModule( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -144,7 +144,7 @@ static void ShowEdgeModule( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/***************************************************************************/ /***************************************************************************/
void WinEDA_ModuleEditFrame::Edit_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ) void WinEDA_ModuleEditFrame::Edit_Edge_Width( EDGE_MODULE* Edge )
/***************************************************************************/ /***************************************************************************/
/* Change the EDGE_MODULE Edge width, /* Change the EDGE_MODULE Edge width,
...@@ -179,7 +179,7 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ) ...@@ -179,7 +179,7 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Width( EDGE_MODULE* Edge, wxDC* DC )
/***************************************************************************/ /***************************************************************************/
void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC ) void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge )
/***************************************************************************/ /***************************************************************************/
/* Change the EDGE_MODULE Edge layer, (The new layer will be asked) /* Change the EDGE_MODULE Edge layer, (The new layer will be asked)
...@@ -267,12 +267,11 @@ void WinEDA_ModuleEditFrame::Enter_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ) ...@@ -267,12 +267,11 @@ void WinEDA_ModuleEditFrame::Enter_Edge_Width( EDGE_MODULE* Edge, wxDC* DC )
/****************************************************************************/ /****************************************************************************/
void WinEDA_ModuleEditFrame::Delete_Edge_Module( EDGE_MODULE* Edge, wxDC* DC ) void WinEDA_ModuleEditFrame::Delete_Edge_Module( EDGE_MODULE* Edge )
/****************************************************************************/ /****************************************************************************/
/* Edition of the edge items width /** Function Delete_Edge_Module
* delete EDGE_MODULE Edge if Edge != NULL * delete EDGE_MODULE Edge
* @param Edge = edge to edit, or NULL * @param Edge = edge to delete
* @param DC = current Device Context
*/ */
{ {
if( Edge == NULL ) if( Edge == NULL )
...@@ -284,7 +283,6 @@ void WinEDA_ModuleEditFrame::Delete_Edge_Module( EDGE_MODULE* Edge, wxDC* DC ) ...@@ -284,7 +283,6 @@ void WinEDA_ModuleEditFrame::Delete_Edge_Module( EDGE_MODULE* Edge, wxDC* DC )
} }
MODULE* Module = (MODULE*) Edge->GetParent(); MODULE* Module = (MODULE*) Edge->GetParent();
Edge->Draw( DrawPanel, DC, GR_XOR );
/* suppression d'un segment */ /* suppression d'un segment */
Edge ->DeleteStructure(); Edge ->DeleteStructure();
......
...@@ -697,7 +697,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -697,7 +697,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
SetCurItem( GetCurItem()->GetParent() ); SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE ) if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
break; break;
InstallModuleOptionsFrame( (MODULE*) GetCurItem(), &dc, pos ); InstallModuleOptionsFrame( (MODULE*) GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
...@@ -756,7 +756,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -756,7 +756,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_DELETE_TEXTMODULE: case ID_POPUP_PCB_DELETE_TEXTMODULE:
DeleteTextModule( (TEXTE_MODULE*) GetCurItem(), &dc ); DeleteTextModule( (TEXTE_MODULE*) GetCurItem() );
SetCurItem( NULL ); SetCurItem( NULL );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
......
...@@ -19,23 +19,19 @@ ...@@ -19,23 +19,19 @@
/* Variables locales: */ /* Variables locales: */
bool GoToEditor = FALSE; bool GoToEditor = FALSE;
/**************************************/
/* class WinEDA_ModulePropertiesFrame */
/**************************************/
/* class WinEDA_ModulePropertiesFrame */
#include "dialog_edit_module.cpp" #include "dialog_edit_module.cpp"
/*******************************************************************/ /*******************************************************************/
void WinEDA_BasePcbFrame::InstallModuleOptionsFrame( MODULE* Module, void WinEDA_BasePcbFrame::InstallModuleOptionsFrame( MODULE* Module, wxDC * DC )
wxDC* DC,
const wxPoint& pos )
/*******************************************************************/ /*******************************************************************/
/* Fonction relai d'installation de la frame d'dition des proprietes /* Fonction relai d'installation de la frame d'dition des proprietes
* du module*/ * du module*/
{ {
WinEDA_ModulePropertiesFrame* frame = WinEDA_ModulePropertiesFrame* frame =
new WinEDA_ModulePropertiesFrame( this, Module, DC, pos ); new WinEDA_ModulePropertiesFrame( this, Module, DC );
frame->ShowModal(); frame->Destroy(); frame->ShowModal(); frame->Destroy();
...@@ -61,7 +57,7 @@ void WinEDA_BasePcbFrame::InstallModuleOptionsFrame( MODULE* Module, ...@@ -61,7 +57,7 @@ void WinEDA_BasePcbFrame::InstallModuleOptionsFrame( MODULE* Module,
/*******************************************************************/ /*******************************************************************/
void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod, wxDC* DC ) void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod )
/*******************************************************************/ /*******************************************************************/
/* /*
...@@ -69,32 +65,27 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod, wxDC* DC ) ...@@ -69,32 +65,27 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod, wxDC* DC )
* Le module doit etre d'abort selectionne * Le module doit etre d'abort selectionne
*/ */
{ {
int deltaX, deltaY; wxPoint delta;
EDA_BaseStruct* PtStruct; EDA_BaseStruct* PtStruct;
D_PAD* pt_pad; D_PAD* pt_pad;
if( pt_mod == NULL ) if( pt_mod == NULL )
return; return;
pt_mod->DrawAncre( DrawPanel, DC, wxPoint( 0, 0 ), delta = pt_mod->m_Pos - GetScreen()->m_Curseur;
DIM_ANCRE_MODULE, GR_XOR );
deltaX = pt_mod->m_Pos.x - GetScreen()->m_Curseur.x;
deltaY = pt_mod->m_Pos.y - GetScreen()->m_Curseur.y;
pt_mod->m_Pos = GetScreen()->m_Curseur; pt_mod->m_Pos = GetScreen()->m_Curseur;
/* Mise a jour des coord relatives des elements: /* Mise a jour des coord relatives des elements:
* les coordonnees relatives sont relatives a l'ancre, pour orient 0. * les coordonnees relatives sont relatives a l'ancre, pour orient 0.
* il faut donc recalculer deltaX et deltaY en orientation 0 */ * il faut donc recalculer deltaX et deltaY en orientation 0 */
RotatePoint( &deltaX, &deltaY, -pt_mod->m_Orient ); RotatePoint( &delta, -pt_mod->m_Orient );
/* Mise a jour des coord relatives des pads */ /* Mise a jour des coord relatives des pads */
pt_pad = (D_PAD*) pt_mod->m_Pads; pt_pad = (D_PAD*) pt_mod->m_Pads;
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() ) for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
{ {
pt_pad->m_Pos0.x += deltaX; pt_pad->m_Pos0 += delta;
pt_pad->m_Pos0.y += deltaY;
} }
/* Mise a jour des coord relatives contours .. */ /* Mise a jour des coord relatives contours .. */
...@@ -106,14 +97,14 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod, wxDC* DC ) ...@@ -106,14 +97,14 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod, wxDC* DC )
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (EDGE_MODULE*) PtStruct ) #define STRUCT ( (EDGE_MODULE*) PtStruct )
STRUCT->m_Start0.x += deltaX; STRUCT->m_Start0.y += deltaY; STRUCT->m_Start0 += delta;
STRUCT->m_End0.x += deltaX; STRUCT->m_End0.y += deltaY; STRUCT->m_End0 += delta;
break; break;
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (TEXTE_MODULE*) PtStruct ) #define STRUCT ( (TEXTE_MODULE*) PtStruct )
STRUCT->m_Pos0.x += deltaX; STRUCT->m_Pos0.y += deltaY; STRUCT->m_Pos0 += delta;
break; break;
default: default:
...@@ -122,12 +113,12 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod, wxDC* DC ) ...@@ -122,12 +113,12 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod, wxDC* DC )
} }
pt_mod->Set_Rectangle_Encadrement(); pt_mod->Set_Rectangle_Encadrement();
pt_mod->DrawAncre( DrawPanel, DC, wxPoint( 0, 0 ), DIM_ANCRE_MODULE, GR_OR ); DrawPanel->Refresh();
} }
/**********************************************************************/ /**********************************************************************/
void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC ) void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item )
/**********************************************************************/ /**********************************************************************/
{ {
if( Item == NULL ) if( Item == NULL )
...@@ -152,12 +143,13 @@ void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC ) ...@@ -152,12 +143,13 @@ void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC )
DisplayError( this, _( "Text is VALUE!" ) ); DisplayError( this, _( "Text is VALUE!" ) );
break; break;
} }
DeleteTextModule( text, DC ); DeleteTextModule( text );
} }
break; break;
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
Delete_Edge_Module( (EDGE_MODULE*) Item, DC ); Delete_Edge_Module( (EDGE_MODULE*) Item );
DrawPanel->Refresh();
break; break;
case TYPE_MODULE: case TYPE_MODULE:
......
...@@ -88,7 +88,7 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -88,7 +88,7 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
/**************************************************************************/ /**************************************************************************/
void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text, wxDC* DC ) void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text )
/**************************************************************************/ /**************************************************************************/
/* /*
...@@ -104,7 +104,6 @@ void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -104,7 +104,6 @@ void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text, wxDC* DC )
if( Text->m_Type == TEXT_is_DIVERS ) if( Text->m_Type == TEXT_is_DIVERS )
{ {
// Text->Draw( DrawPanel, DC, GR_XOR );
DrawPanel->PostDirtyRect( Text->GetBoundingBox() ); DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
/* liberation de la memoire : */ /* liberation de la memoire : */
......
...@@ -139,14 +139,13 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -139,14 +139,13 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
/* Traite les selections d'outils et les commandes appelees du menu POPUP /* Traite les selections d'outils et les commandes appelees du menu POPUP
*/ */
#define SET_DC wxClientDC dc( DrawPanel ); DrawPanel->PrepareGraphicContext( &dc );
{ {
int id = event.GetId(); int id = event.GetId();
wxPoint pos; wxPoint pos;
bool redraw = false; bool redraw = false;
wxClientDC dc( DrawPanel );
DrawPanel->CursorOff( &dc );
DrawPanel->PrepareGraphicContext( &dc );
wxGetMousePosition( &pos.x, &pos.y ); wxGetMousePosition( &pos.x, &pos.y );
...@@ -185,20 +184,15 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -185,20 +184,15 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
if( DrawPanel->ManageCurseur default:
&& DrawPanel->ForceCloseManageCurseur ) if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
{
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
break;
default: // Arret dea commande de d�placement en cours
if( DrawPanel->ManageCurseur
&& DrawPanel->ForceCloseManageCurseur )
{ {
// for all other commands: stop the move in progress
SET_DC;
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
} }
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); if( id != ID_POPUP_CANCEL_CURRENT_COMMAND )
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break; break;
} }
...@@ -229,9 +223,10 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -229,9 +223,10 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
SetCurItem( NULL ); SetCurItem( NULL );
GetScreen()->m_Curseur = wxPoint( 0, 0 ); GetScreen()->m_Curseur = wxPoint( 0, 0 );
MODULE* module = Create_1_Module( &dc, wxEmptyString ); MODULE* module = Create_1_Module( NULL, wxEmptyString );
if( module ) // i.e. if create module command not aborted if( module ) // i.e. if create module command not aborted
{ {
redraw = true;
module->SetPosition( wxPoint( 0, 0 ) ); module->SetPosition( wxPoint( 0, 0 ) );
if( GetBoard()->m_Modules ) if( GetBoard()->m_Modules )
GetBoard()->m_Modules->m_Flags = 0; GetBoard()->m_Modules->m_Flags = 0;
...@@ -244,7 +239,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -244,7 +239,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
{ {
wxFileName fn; wxFileName fn;
fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension ); fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension );
wxString full_filename = wxGetApp().FindLibraryPath( fn ); wxString full_filename = wxGetApp().FindLibraryPath( fn );
Save_Module_In_Library( full_filename, GetBoard()->m_Modules, Save_Module_In_Library( full_filename, GetBoard()->m_Modules,
true, true, true ); true, true, true );
GetScreen()->ClrModify(); GetScreen()->ClrModify();
...@@ -326,7 +321,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -326,7 +321,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
SetCurItem( NULL ); SetCurItem( NULL );
Clear_Pcb( true ); Clear_Pcb( true );
GetScreen()->m_Curseur = wxPoint( 0, 0 ); GetScreen()->m_Curseur = wxPoint( 0, 0 );
Import_Module( &dc ); Import_Module( NULL );
redraw = true;
if( GetBoard()->m_Modules ) if( GetBoard()->m_Modules )
GetBoard()->m_Modules->m_Flags = 0; GetBoard()->m_Modules->m_Flags = 0;
GetScreen()->ClrModify(); GetScreen()->ClrModify();
...@@ -400,9 +396,9 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -400,9 +396,9 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_MODEDIT_EDIT_MODULE_PROPERTIES: case ID_MODEDIT_EDIT_MODULE_PROPERTIES:
if( GetBoard()->m_Modules ) if( GetBoard()->m_Modules )
{ {
SET_DC;
SetCurItem( GetBoard()->m_Modules ); SetCurItem( GetBoard()->m_Modules );
InstallModuleOptionsFrame( (MODULE*) GetScreen()->GetCurItem(), InstallModuleOptionsFrame( (MODULE*) GetScreen()->GetCurItem(), &dc );
&dc, pos );
GetScreen()->GetCurItem()->m_Flags = 0; GetScreen()->GetCurItem()->m_Flags = 0;
} }
break; break;
...@@ -446,30 +442,40 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -446,30 +442,40 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE: case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), 900, true ); Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), 900, true );
redraw = true;
break; break;
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE: case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Rotate_Module( &dc, (MODULE*) GetScreen()->GetCurItem(), -900, true ); Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), -900, true );
redraw = true;
break; break;
case ID_POPUP_PCB_EDIT_MODULE: case ID_POPUP_PCB_EDIT_MODULE:
InstallModuleOptionsFrame( (MODULE*) GetScreen()->GetCurItem(), {
&dc, pos ); SET_DC;
InstallModuleOptionsFrame( (MODULE*) GetScreen()->GetCurItem(), &dc );
GetScreen()->GetCurItem()->m_Flags = 0; GetScreen()->GetCurItem()->m_Flags = 0;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; }
break;
case ID_POPUP_PCB_MOVE_PAD_REQUEST: case ID_POPUP_PCB_MOVE_PAD_REQUEST:
{
SET_DC;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
StartMovePad( (D_PAD*) GetScreen()->GetCurItem(), &dc ); StartMovePad( (D_PAD*) GetScreen()->GetCurItem(), &dc );
break; }
break;
case ID_POPUP_PCB_EDIT_PAD: case ID_POPUP_PCB_EDIT_PAD:
{
SET_DC;
InstallPadOptionsFrame( (D_PAD*) GetScreen()->GetCurItem(), InstallPadOptionsFrame( (D_PAD*) GetScreen()->GetCurItem(),
&dc, pos ); &dc, pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; }
break;
case ID_POPUP_PCB_DELETE_PAD: case ID_POPUP_PCB_DELETE_PAD:
SaveCopyInUndoList( GetBoard()->m_Modules ); SaveCopyInUndoList( GetBoard()->m_Modules );
...@@ -496,40 +502,52 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -496,40 +502,52 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_EDIT_TEXTMODULE: case ID_POPUP_PCB_EDIT_TEXTMODULE:
{
SET_DC;
InstallTextModOptionsFrame( (TEXTE_MODULE*) GetScreen()->GetCurItem(), InstallTextModOptionsFrame( (TEXTE_MODULE*) GetScreen()->GetCurItem(),
&dc, pos ); &dc, pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; }
break;
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST: case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
{
SET_DC;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
StartMoveTexteModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), StartMoveTexteModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc );
&dc ); }
break; break;
case ID_POPUP_PCB_ROTATE_TEXTMODULE: case ID_POPUP_PCB_ROTATE_TEXTMODULE:
{
SET_DC;
RotateTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), RotateTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(),
&dc ); &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; }
break;
case ID_POPUP_PCB_DELETE_TEXTMODULE: case ID_POPUP_PCB_DELETE_TEXTMODULE:
SaveCopyInUndoList( GetBoard()->m_Modules ); SaveCopyInUndoList( GetBoard()->m_Modules );
DeleteTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), DeleteTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem() );
&dc );
SetCurItem( NULL ); SetCurItem( NULL );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
case ID_POPUP_PCB_MOVE_EDGE: case ID_POPUP_PCB_MOVE_EDGE:
{
SET_DC;
Start_Move_EdgeMod( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc ); Start_Move_EdgeMod( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; }
break;
case ID_POPUP_PCB_STOP_CURRENT_DRAWING: case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if( (GetScreen()->GetCurItem()->m_Flags & IS_NEW) ) if( (GetScreen()->GetCurItem()->m_Flags & IS_NEW) )
{ {
SET_DC;
End_Edge_Module( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc ); End_Edge_Module( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc );
SetCurItem( NULL ); SetCurItem( NULL );
} }
...@@ -544,6 +562,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -544,6 +562,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
{ {
edge = (EDGE_MODULE*) GetScreen()->GetCurItem(); edge = (EDGE_MODULE*) GetScreen()->GetCurItem();
} }
SET_DC;
Enter_Edge_Width( edge, &dc ); Enter_Edge_Width( edge, &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
} }
...@@ -551,28 +570,28 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -551,28 +570,28 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE: case ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Edit_Edge_Width( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc ); Edit_Edge_Width( (EDGE_MODULE*) GetScreen()->GetCurItem() );
break; break;
case ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE: case ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Edit_Edge_Width( NULL, &dc ); Edit_Edge_Width( NULL );
break; break;
case ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE: case ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Edit_Edge_Layer( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc ); Edit_Edge_Layer( (EDGE_MODULE*) GetScreen()->GetCurItem() );
break; break;
case ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE: case ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
Edit_Edge_Layer( NULL, &dc ); Edit_Edge_Layer( NULL );
break; break;
case ID_POPUP_PCB_DELETE_EDGE: case ID_POPUP_PCB_DELETE_EDGE:
SaveCopyInUndoList( GetBoard()->m_Modules ); SaveCopyInUndoList( GetBoard()->m_Modules );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
RemoveStruct( GetScreen()->GetCurItem(), &dc ); RemoveStruct( GetScreen()->GetCurItem() );
SetCurItem( NULL ); SetCurItem( NULL );
break; break;
...@@ -582,7 +601,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -582,7 +601,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_MODEDIT_MODULE_SCALEX: case ID_MODEDIT_MODULE_SCALEX:
case ID_MODEDIT_MODULE_SCALEY: case ID_MODEDIT_MODULE_SCALEY:
SaveCopyInUndoList( GetBoard()->m_Modules ); SaveCopyInUndoList( GetBoard()->m_Modules );
Transform( (MODULE*) GetScreen()->GetCurItem(), &dc, id ); Transform( (MODULE*) GetScreen()->GetCurItem(), id );
redraw = true;
break; break;
case ID_PCB_DRAWINGS_WIDTHS_SETUP: case ID_PCB_DRAWINGS_WIDTHS_SETUP:
...@@ -597,6 +617,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -597,6 +617,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
if( item->Type() != TYPE_PAD ) if( item->Type() != TYPE_PAD )
item = NULL; item = NULL;
} }
SET_DC;
InstallPadOptionsFrame( (D_PAD*) item, &dc, pos ); InstallPadOptionsFrame( (D_PAD*) item, &dc, pos );
} }
break; break;
...@@ -607,44 +628,58 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -607,44 +628,58 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_MODEDIT_UNDO: case ID_MODEDIT_UNDO:
GetComponentFromUndoList(); GetComponentFromUndoList();
DrawPanel->Refresh( true ); redraw = true;
break; break;
case ID_MODEDIT_REDO: case ID_MODEDIT_REDO:
GetComponentFromRedoList(); GetComponentFromRedoList();
DrawPanel->Refresh( true ); redraw = true;
break; break;
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_MOVE; GetScreen()->BlockLocate.m_Command = BLOCK_MOVE;
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
HandleBlockPlace( &dc ); {
SET_DC;
HandleBlockPlace( &dc );
}
break; break;
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_COPY; GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
GetScreen()->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
HandleBlockPlace( &dc ); {
SET_DC;
HandleBlockPlace( &dc );
}
break; break;
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM; GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
GetScreen()->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
GetScreen()->BlockLocate.SetMessageBlock( this ); {
HandleBlockEnd( &dc ); SET_DC;
HandleBlockEnd( &dc );
}
break; break;
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE; GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
GetScreen()->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); {
SET_DC;
HandleBlockEnd( &dc );
}
break; break;
case ID_POPUP_ROTATE_BLOCK: case ID_POPUP_ROTATE_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE; GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE;
GetScreen()->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); {
SET_DC;
HandleBlockEnd( &dc );
}
break; break;
case ID_POPUP_MIRROR_X_BLOCK: case ID_POPUP_MIRROR_X_BLOCK:
...@@ -652,7 +687,10 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -652,7 +687,10 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_INVERT_BLOCK: case ID_POPUP_INVERT_BLOCK:
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT; GetScreen()->BlockLocate.m_Command = BLOCK_INVERT;
GetScreen()->BlockLocate.SetMessageBlock( this ); GetScreen()->BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); {
SET_DC;
HandleBlockEnd( &dc );
}
break; break;
default: default:
...@@ -662,14 +700,13 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -662,14 +700,13 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
} }
SetToolbars(); SetToolbars();
DrawPanel->CursorOn( &dc ); if( redraw )
if ( redraw )
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
/******************************************************************************/ /******************************************************************************/
void WinEDA_ModuleEditFrame::Transform( MODULE* module, wxDC* DC, int transform ) void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
/******************************************************************************/ /******************************************************************************/
/* Execute les transformations de la repr�sentation des modules. /* Execute les transformations de la repr�sentation des modules.
...@@ -792,5 +829,4 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, wxDC* DC, int transform ...@@ -792,5 +829,4 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, wxDC* DC, int transform
} }
module->Set_Rectangle_Encadrement(); module->Set_Rectangle_Encadrement();
DrawPanel->ReDraw( DC );
} }
...@@ -52,7 +52,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -52,7 +52,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
wxString msg; wxString msg;
msg.Printf( msg.Printf(
wxT( wxT(
"WinEDA_ModEditFrame::ProcessCommand err: m_Flags != 0\nStruct @%p, type %d m_Flag %X" ), "WinEDA_ModEditFrame::OnLeftClick err: m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
DrawStruct, DrawStruct->Type(), DrawStruct->m_Flags ); DrawStruct, DrawStruct->Type(), DrawStruct->m_Flags );
DisplayError( this, msg ); DisplayError( this, msg );
DrawStruct->m_Flags = 0; DrawStruct->m_Flags = 0;
...@@ -122,7 +122,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -122,7 +122,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( DrawStruct && (DrawStruct->m_Flags == 0) ) if( DrawStruct && (DrawStruct->m_Flags == 0) )
{ {
SaveCopyInUndoList( GetBoard()->m_Modules ); SaveCopyInUndoList( GetBoard()->m_Modules );
RemoveStruct( DrawStruct, DC ); RemoveStruct( DrawStruct );
SetCurItem( DrawStruct = NULL ); SetCurItem( DrawStruct = NULL );
} }
} }
...@@ -130,7 +130,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -130,7 +130,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_MODEDIT_PLACE_ANCHOR: case ID_MODEDIT_PLACE_ANCHOR:
SaveCopyInUndoList( GetBoard()->m_Modules ); SaveCopyInUndoList( GetBoard()->m_Modules );
Place_Ancre( GetBoard()->m_Modules, DC ); Place_Ancre( GetBoard()->m_Modules );
GetBoard()->m_Modules->m_Flags = 0; GetBoard()->m_Modules->m_Flags = 0;
GetScreen()->m_Curseur = wxPoint( 0, 0 ); GetScreen()->m_Curseur = wxPoint( 0, 0 );
Recadre_Trace( TRUE ); Recadre_Trace( TRUE );
...@@ -401,8 +401,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -401,8 +401,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break; break;
case TYPE_MODULE: case TYPE_MODULE:
InstallModuleOptionsFrame( (MODULE*) DrawStruct, InstallModuleOptionsFrame( (MODULE*) DrawStruct, &dc );
&dc, pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
......
...@@ -214,10 +214,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -214,10 +214,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( DrawStruct ) if( DrawStruct )
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
} }
else if( DrawStruct && else if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
// (DrawStruct->Type() == TYPE_TRACK) &&
(DrawStruct->m_Flags & IS_NEW) )
{ {
TRACK* track = Begin_Route( (TRACK*) DrawStruct, DC ); TRACK* track = Begin_Route( (TRACK*) DrawStruct, DC );
if( track ) // c'est a dire si OK if( track ) // c'est a dire si OK
...@@ -391,7 +388,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -391,7 +388,7 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break; break;
case TYPE_MODULE: case TYPE_MODULE:
InstallModuleOptionsFrame( (MODULE*) DrawStruct, &dc, pos ); InstallModuleOptionsFrame( (MODULE*) DrawStruct, &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment