You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

249 lines
9.4 KiB

  1. /*****************************************************************************
  2. *
  3. * schframe.h
  4. *
  5. * Header for class definition of WinEDA_SchematicFrame. This is the main
  6. * window for EESchema.
  7. *
  8. *****************************************************************************/
  9. #ifndef _SCHFRAME_H_
  10. #define _SCHFRAME_H_
  11. class WinEDA_DrawFrame;
  12. class WinEDA_SchematicFrame : public WinEDA_DrawFrame
  13. {
  14. public:
  15. WinEDAChoiceBox* m_SelPartBox;
  16. DrawSheetPath* m_CurrentSheet; //which sheet we are presently working on.
  17. private:
  18. wxMenu* m_FilesMenu;
  19. public:
  20. WinEDA_SchematicFrame( wxWindow* father, WinEDA_App* parent,
  21. const wxString& title,
  22. const wxPoint& pos, const wxSize& size,
  23. long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
  24. ~WinEDA_SchematicFrame();
  25. void OnCloseWindow( wxCloseEvent& Event );
  26. void Process_Special_Functions( wxCommandEvent& event );
  27. void Process_Config( wxCommandEvent& event );
  28. void Save_Config( wxWindow* displayframe );
  29. void RedrawActiveWindow( wxDC* DC, bool EraseBg );
  30. void CreateScreens();
  31. void ReCreateHToolbar();
  32. void ReCreateVToolbar();
  33. void ReCreateOptToolbar();
  34. void ReCreateMenuBar();
  35. void SetToolbars();
  36. void OnHotKey( wxDC* DC,
  37. int hotkey,
  38. EDA_BaseStruct* DrawStruct );
  39. DrawSheetPath* GetSheet();
  40. virtual BASE_SCREEN* GetScreen();
  41. virtual void SetScreen(SCH_SCREEN* screen);
  42. virtual wxString GetScreenDesc();
  43. void InstallConfigFrame( const wxPoint& pos );
  44. void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
  45. void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
  46. bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
  47. void OnSelectOptionToolbar( wxCommandEvent& event );
  48. void ToolOnRightClick( wxCommandEvent& event );
  49. int BestZoom(); // Retourne le meilleur zoom
  50. EDA_BaseStruct* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE );
  51. EDA_BaseStruct* SchematicGeneralLocateAndDisplay( const wxPoint& refpoint,
  52. bool IncludePin );
  53. EDA_BaseStruct* FindComponentAndItem( const wxString& component_reference,
  54. bool Find_in_hierarchy,
  55. int SearchType,
  56. const wxString& text_to_find,
  57. bool mouseWarp );
  58. /* Cross probing with pcbnew */
  59. void SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
  60. EDA_SchComponentStruct* LibItem );
  61. /* netlist generation */
  62. void* BuildNetListBase();
  63. // FUnctions used for hierarchy handling
  64. void InstallPreviousSheet();
  65. void InstallNextScreen( DrawSheetStruct* Sheet );
  66. void ToPlot_PS( wxCommandEvent& event );
  67. void ToPlot_HPGL( wxCommandEvent& event );
  68. void ToPostProcess( wxCommandEvent& event );
  69. void Save_File( wxCommandEvent& event );
  70. void SaveProject();
  71. int LoadOneEEProject( const wxString& FileName, bool IsNew );
  72. bool LoadOneEEFile(SCH_SCREEN* screen, const wxString& FullFileName );
  73. bool SaveEEFile( SCH_SCREEN* screen, int FileSave );
  74. SCH_SCREEN * CreateNewScreen(SCH_SCREEN * OldScreen, int TimeStamp);
  75. // General search:
  76. /**
  77. * Function FindSchematicItem
  78. * finds a string in the schematic.
  79. * @param pattern The text to search for, either in value, reference or
  80. * elsewhere.
  81. * @param SearchType: 0 => Search is made in current sheet
  82. * 1 => the whole hierarchy
  83. * 2 => or for the next item
  84. * @param mouseWarp If true, then move the mouse cursor to the item.
  85. */
  86. EDA_BaseStruct* FindSchematicItem( const wxString& pattern,
  87. int SearchType,
  88. bool mouseWarp = true );
  89. EDA_BaseStruct* FindMarker( int SearchType );
  90. private:
  91. void Process_Move_Item( EDA_BaseStruct* DrawStruct, wxDC* DC );
  92. void OnExit( wxCommandEvent& event );
  93. void OnAnnotate ( wxCommandEvent& event );
  94. void OnErc( wxCommandEvent& event );
  95. void OnCreateNetlist( wxCommandEvent& event );
  96. void OnCreateBillOfMaterials( wxCommandEvent& event );
  97. void OnFindItems( wxCommandEvent& event );
  98. void OnLoadFile( wxCommandEvent& event );
  99. void OnNewProject( wxCommandEvent& event );
  100. void OnLoadProject( wxCommandEvent& event );
  101. void OnOpenPcbnew( wxCommandEvent& event );
  102. void OnOpenCvpcb( wxCommandEvent& event );
  103. void OnOpenLibraryViewer( wxCommandEvent& event );
  104. void OnOpenLibraryEditor( wxCommandEvent& event );
  105. // Bus Entry
  106. DrawBusEntryStruct* CreateBusEntry( wxDC* DC, int entry_type );
  107. void SetBusEntryShape( wxDC* DC,
  108. DrawBusEntryStruct* BusEntry,
  109. int entry_type );
  110. int GetBusEntryShape( DrawBusEntryStruct* BusEntry );
  111. void StartMoveBusEntry( DrawBusEntryStruct* DrawLibItem, wxDC* DC );
  112. // NoConnect
  113. EDA_BaseStruct* CreateNewNoConnectStruct( wxDC* DC );
  114. // Junction
  115. DrawJunctionStruct* CreateNewJunctionStruct( wxDC* DC,
  116. const wxPoint& pos,
  117. bool PutInUndoList = FALSE );
  118. // Text ,label, glabel
  119. EDA_BaseStruct* CreateNewText( wxDC* DC, int type );
  120. void EditSchematicText( DrawTextStruct* TextStruct, wxDC* DC );
  121. void ChangeTextOrient( DrawTextStruct* TextStruct, wxDC* DC );
  122. void StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC );
  123. void ConvertTextType( DrawTextStruct* Text, wxDC* DC, int newtype );
  124. // Wire, Bus
  125. void BeginSegment( wxDC* DC, int type );
  126. void EndSegment( wxDC* DC );
  127. void DeleteCurrentSegment( wxDC* DC );
  128. void DeleteConnection( wxDC* DC, bool DeleteFullConnection );
  129. // graphic lines
  130. void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
  131. void Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC );
  132. void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC );
  133. DRAWSEGMENT* Begin_Edge( DRAWSEGMENT* Segment, wxDC* DC );
  134. // Hierarchical Sheet & PinSheet
  135. void InstallHierarchyFrame( wxDC* DC, wxPoint& pos );
  136. DrawSheetStruct* CreateSheet( wxDC* DC );
  137. void ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC );
  138. public:
  139. bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC );
  140. /** Function UpdateSheetNumberAndDate
  141. * Set a sheet number, the sheet count for sheets in the whole schematic
  142. * and update the date in all screens
  143. */
  144. void UpdateSheetNumberAndDate();
  145. private:
  146. void StartMoveSheet( DrawSheetStruct* sheet, wxDC* DC );
  147. DrawSheetLabelStruct* Create_PinSheet( DrawSheetStruct* Sheet, wxDC* DC );
  148. void Edit_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC );
  149. void StartMove_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC );
  150. void Place_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC );
  151. DrawSheetLabelStruct* Import_PinSheet( DrawSheetStruct* Sheet, wxDC* DC );
  152. public:
  153. void DeleteSheetLabel( wxDC* DC, DrawSheetLabelStruct* SheetLabelToDel );
  154. private:
  155. // Component
  156. EDA_SchComponentStruct* Load_Component( wxDC* DC,
  157. const wxString& libname,
  158. wxArrayString& List,
  159. bool UseLibBrowser );
  160. void StartMovePart( EDA_SchComponentStruct* DrawLibItem, wxDC* DC );
  161. public:
  162. void CmpRotationMiroir( EDA_SchComponentStruct* DrawComponent,
  163. wxDC* DC, int type_rotate );
  164. private:
  165. void SelPartUnit( EDA_SchComponentStruct* DrawComponent,
  166. int unit, wxDC* DC );
  167. void ConvertPart( EDA_SchComponentStruct* DrawComponent, wxDC* DC );
  168. void SetInitCmp( EDA_SchComponentStruct* DrawComponent, wxDC* DC );
  169. void EditComponentReference( EDA_SchComponentStruct* DrawLibItem,
  170. wxDC* DC );
  171. void EditComponentValue( EDA_SchComponentStruct* DrawLibItem, wxDC* DC );
  172. void EditComponentFootprint( EDA_SchComponentStruct* DrawLibItem,
  173. wxDC* DC );
  174. void StartMoveCmpField( PartTextStruct* Field, wxDC* DC );
  175. void EditCmpFieldText( PartTextStruct* Field, wxDC* DC );
  176. void RotateCmpField( PartTextStruct* Field, wxDC* DC );
  177. /* Operations sur bloc */
  178. void PasteStruct( wxDC* DC );
  179. /* Undo - redo */
  180. public:
  181. void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
  182. int flag_type_command = 0 );
  183. private:
  184. void PutDataInPreviousState( DrawPickedStruct* List );
  185. bool GetSchematicFromRedoList();
  186. bool GetSchematicFromUndoList();
  187. public:
  188. void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
  189. /* Gestion generale des operations sur block */
  190. int ReturnBlockCommand( int key );
  191. void InitBlockPasteInfos();
  192. void HandleBlockPlace( wxDC* DC );
  193. int HandleBlockEnd( wxDC* DC );
  194. void HandleBlockEndByPopUp( int Command, wxDC* DC );
  195. // Repetition automatique de placements
  196. void RepeatDrawItem( wxDC* DC );
  197. // Test des points de connexion en l'air (dangling ends)
  198. void TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC );
  199. LibDrawPin* LocatePinEnd( EDA_BaseStruct* DrawList, const wxPoint& pos );
  200. DECLARE_EVENT_TABLE()
  201. };
  202. #endif /* _SCHFRAME_H_ */