KiCad PCB EDA Suite
sheet.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
29 #include <fctsys.h>
30 #include <class_drawpanel.h>
31 #include <confirm.h>
32 #include <schframe.h>
33 #include <base_units.h>
34 #include <kiface_i.h>
35 
36 #include <sch_sheet.h>
37 #include <sch_sheet_path.h>
38 
41 #include <project.h>
42 
43 
45 {
46  if( aSheet == NULL || aHierarchy == NULL )
47  return false;
48 
49  SCH_SHEET_LIST hierarchy( g_RootSheet ); // This is the schematic sheet hierarchy.
50 
51  // Get the new texts
52  DIALOG_SCH_SHEET_PROPS dlg( this );
53 
54  wxString units = GetUnitsLabel( g_UserUnit );
55  dlg.SetFileName( aSheet->GetFileName() );
57  dlg.SetFileNameTextSizeUnits( units );
58  dlg.SetSheetName( aSheet->GetName() );
60  dlg.SetSheetNameTextSizeUnits( units );
61  dlg.SetSheetTimeStamp( wxString::Format( wxT("%8.8lX"),
62  (unsigned long) aSheet->GetTimeStamp() ) );
63 
64  /* This ugly hack fixes a bug in wxWidgets 2.8.7 and likely earlier
65  * versions for the flex grid sizer in wxGTK that prevents the last
66  * column from being sized correctly. It doesn't cause any problems
67  * on win32 so it doesn't need to wrapped in ugly #ifdef __WXGTK__
68  * #endif.
69  * Still presen in wxWidgets 3.0.2
70  */
71  dlg.Layout();
72  dlg.Fit();
73  dlg.SetMinSize( dlg.GetSize() );
74  dlg.GetSizer()->Fit( &dlg );
75 
76  if( dlg.ShowModal() == wxID_CANCEL )
77  return false;
78 
79  wxFileName fileName = dlg.GetFileName();
80  fileName.SetExt( SchematicFileExtension );
81 
82  if( !fileName.IsOk() )
83  {
84  DisplayError( this, _( "File name is not valid!" ) );
85  return false;
86  }
87 
88  // Duplicate sheet names are not valid.
89  const SCH_SHEET* sheet = hierarchy.FindSheetByName( dlg.GetSheetName() );
90 
91  if( sheet && (sheet != aSheet) )
92  {
93  DisplayError( this, wxString::Format( _( "A sheet named \"%s\" already exists." ),
94  GetChars( dlg.GetSheetName() ) ) );
95  return false;
96  }
97 
98  wxString msg;
99  bool loadFromFile = false;
100  SCH_SCREEN* useScreen = NULL;
101 
102  wxString newFilename = fileName.GetFullPath();
103 
104  // Search for a schematic file having the same filename
105  // already in use in the hierarchy or on disk, in order to reuse it.
106  if( !g_RootSheet->SearchHierarchy( newFilename, &useScreen ) )
107  {
108  // if user entered a relative path, allow that to stay, but do the
109  // file existence test with an absolute (full) path. This transformation
110  // is local to this scope, but is the same one used at load time later.
111  wxString absolute = Prj().AbsolutePath( newFilename );
112 
113  loadFromFile = wxFileExists( absolute );
114  }
115 
116  // Inside Eeschema, filenames are stored using unix notation
117  newFilename.Replace( wxT( "\\" ), wxT( "/" ) );
118 
119  if( aSheet->GetScreen() == NULL ) // New sheet.
120  {
121  if( useScreen || loadFromFile ) // Load from existing file.
122  {
123  if( useScreen != NULL )
124  {
125  msg.Printf( _( "A file named '%s' already exists in the current schematic "
126  "hierarchy." ), GetChars( newFilename ) );
127  }
128  else
129  {
130  msg.Printf( _( "A file named '%s' already exists." ), GetChars( newFilename ) );
131  }
132 
133  msg += _( "\n\nDo you want to create a sheet with the contents of this file?" );
134 
135  if( !IsOK( this, msg ) )
136  {
137  return false;
138  }
139  }
140  else // New file.
141  {
142  aSheet->SetScreen( new SCH_SCREEN( &Kiway() ) );
144  aSheet->GetScreen()->SetFileName( newFilename );
145  }
146  }
147  else // Existing sheet.
148  {
149  bool isUndoable = true;
150  bool renameFile = false;
151 
152  // We are always using here a case insensitive comparison
153  // to avoid issues under Windows, although under Unix
154  // filenames are case sensitive.
155  // But many users create schematic under both Unix and Windows
156  if( newFilename.CmpNoCase( aSheet->GetFileName() ) != 0 )
157  {
158  // Sheet file name changes cannot be undone.
159  isUndoable = false;
160  msg = _( "Changing the sheet file name cannot be undone. " );
161 
162  if( useScreen || loadFromFile ) // Load from existing file.
163  {
164  wxString tmp;
165 
166  if( useScreen != NULL )
167  {
168  tmp.Printf( _( "A file named <%s> already exists in the current schematic "
169  "hierarchy." ), GetChars( newFilename ) );
170  }
171  else
172  {
173  tmp.Printf( _( "A file named <%s> already exists." ),
174  GetChars( newFilename ) );
175  }
176 
177  msg += tmp;
178  msg += _( "\n\nDo you want to replace the sheet with the contents of this file?" );
179 
180  if( !IsOK( this, msg ) )
181  return false;
182 
183  if( loadFromFile )
184  aSheet->SetScreen( NULL );
185  }
186  else // Save to new file name.
187  {
188  if( aSheet->GetScreenCount() > 1 )
189  {
190  msg += _( "This sheet uses shared data in a complex hierarchy.\n\n" );
191  msg += _( "Do you wish to convert it to a simple hierarchical sheet?" );
192 
193  if( !IsOK( NULL, msg ) )
194  return false;
195  }
196 
197  renameFile = true;
198  }
199  }
200 
202 
203  if( isUndoable )
204  SaveCopyInUndoList( aSheet, UR_CHANGED );
205 
206  if( renameFile )
207  {
208  aSheet->GetScreen()->SetFileName( newFilename );
209  SaveEEFile( aSheet->GetScreen() );
210 
211  // If the the associated screen is shared by more than one sheet, remove the
212  // screen and reload the file to a new screen. Failure to do this will trash
213  // the screen reference counting in complex hierarchies.
214  if( aSheet->GetScreenCount() > 1 )
215  {
216  aSheet->SetScreen( NULL );
217  loadFromFile = true;
218  }
219  }
220  }
221 
222  aSheet->SetFileName( newFilename );
223 
224  if( useScreen )
225  aSheet->SetScreen( useScreen );
226  else if( loadFromFile )
227  aSheet->Load( this );
228 
230  aSheet->SetName( dlg.GetSheetName() );
232 
233  if( aSheet->GetName().IsEmpty() )
234  aSheet->SetName( wxString::Format( wxT( "Sheet%8.8lX" ),
235  (long unsigned) aSheet->GetTimeStamp() ) );
236 
237  // Make sure the sheet changes do not cause any recursion.
238  SCH_SHEET_LIST sheetHierarchy( aSheet );
239 
240  // Make sure files have fully qualified path and file name.
241  wxFileName destFn = aHierarchy->Last()->GetFileName();
242 
243  if( destFn.IsRelative() )
244  destFn.MakeAbsolute( Prj().GetProjectPath() );
245 
246  if( hierarchy.TestForRecursion( sheetHierarchy, destFn.GetFullPath( wxPATH_UNIX ) ) )
247  {
248  msg.Printf( _( "The sheet changes cannot be made because the destination sheet already "
249  "has the sheet <%s> or one of it's subsheets as a parent somewhere in "
250  "the schematic hierarchy." ),
251  GetChars( newFilename ) );
252  DisplayError( this, msg );
253  return false;
254  }
255 
257  m_canvas->SetIgnoreMouseEvents( false );
258  OnModify();
259 
260  return true;
261 }
262 
263 
264 /* Move selected sheet with the cursor.
265  * Callback function used by m_mouseCaptureCallback.
266  * Note also now this function is aclled only when resizing the sheet
267  * But the (very small code) relative to sheet move is still present here
268  */
269 static void resizeSheetWithMouseCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
270  bool aErase )
271 {
272  BASE_SCREEN* screen = aPanel->GetScreen();
273  SCH_SHEET* sheet = (SCH_SHEET*) screen->GetCurItem();
274 
275  if( aErase )
276  sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
277 
278  wxPoint pos = sheet->GetPosition();
279 
280  int width = aPanel->GetParent()->GetCrossHairPosition().x - sheet->GetPosition().x;
281  int height = aPanel->GetParent()->GetCrossHairPosition().y - sheet->GetPosition().y;
282 
283  // If the sheet doesn't have any pins, clamp the minimum size to the default values.
284  width = ( width < MIN_SHEET_WIDTH ) ? MIN_SHEET_WIDTH : width;
285  height = ( height < MIN_SHEET_HEIGHT ) ? MIN_SHEET_HEIGHT : height;
286 
287  if( sheet->HasPins() )
288  {
289  int gridSizeX = KiROUND( screen->GetGridSize().x );
290  int gridSizeY = KiROUND( screen->GetGridSize().y );
291 
292  // If the sheet has pins, use the pin positions to clamp the minimum height.
293  height = ( height < sheet->GetMinHeight() + gridSizeY ) ?
294  sheet->GetMinHeight() + gridSizeY : height;
295  width = ( width < sheet->GetMinWidth() + gridSizeX ) ?
296  sheet->GetMinWidth() + gridSizeX : width;
297  }
298 
299  wxPoint grid = aPanel->GetParent()->GetNearestGridPosition(
300  wxPoint( pos.x + width, pos.y + height ) );
301  sheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) );
302 
303  sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
304 }
305 
306 
307 // Complete sheet move.
308 static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
309 {
310  SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
311  SCH_ITEM* item = screen->GetCurItem();
312 
313  SCH_EDIT_FRAME* parent = (SCH_EDIT_FRAME*) aPanel->GetParent();
314 
315  if( (item == NULL) || (item->Type() != SCH_SHEET_T) || (parent == NULL) )
316  return;
317 
318  parent->SetRepeatItem( NULL );
319 
320  item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
321 
322  if( item->IsNew() )
323  {
324  delete item;
325  }
326  else if( item->IsMoving() || item->IsResized() )
327  {
328  screen->Remove( item );
329  delete item;
330 
331  item = parent->GetUndoItem();
332 
333  wxCHECK_RET( item != NULL, wxT( "Cannot restore undefined last sheet item." ) );
334 
335  screen->Append( item );
336  // the owner of item is no more parent, this is the draw list of screen:
337  parent->SetUndoItem( NULL );
338 
339  item->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
340  item->ClearFlags();
341  }
342  else
343  {
344  item->ClearFlags();
345  }
346 
347  screen->SetCurItem( NULL );
348 }
349 
350 
351 // Create hierarchy sheet.
353 {
354  SetRepeatItem( NULL );
355 
356  SCH_SHEET* sheet = new SCH_SHEET( GetCrossHairPosition() );
357 
358  sheet->SetFlags( IS_NEW | IS_RESIZED );
359  sheet->SetTimeStamp( GetNewTimeStamp() );
360  sheet->SetParent( GetScreen() );
361  sheet->SetScreen( NULL );
362 
363  // need to check if this is being added to the GetDrawItems().
364  // also need to update the hierarchy, if we are adding
365  // a sheet to a screen that already has multiple instances (!)
366  GetScreen()->SetCurItem( sheet );
368  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
369  m_canvas->CrossHairOff( aDC );
370 
372 
374  m_canvas->CrossHairOn( aDC );
375 
376  return sheet;
377 }
378 
379 
380 void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
381 {
382  if( aSheet == NULL || aSheet->IsNew() )
383  return;
384 
385  wxCHECK_RET( aSheet->Type() == SCH_SHEET_T,
386  wxString::Format( wxT( "Cannot perform sheet resize on %s object." ),
387  GetChars( aSheet->GetClass() ) ) );
388 
389  m_canvas->CrossHairOff( aDC );
392  m_canvas->CrossHairOn( aDC );
393 
394  SetUndoItem( aSheet );
395  aSheet->SetFlags( IS_RESIZED );
396 
398  m_canvas->CallMouseCapture( aDC, wxDefaultPosition, true );
399 
400  if( aSheet->IsNew() ) // not already in edit, save a copy for undo/redo
401  SetUndoItem( aSheet );
402 }
403 
404 
406 {
407  if( aSheet == NULL )
408  return;
409 
410  // Save old sheet in undo list if not already in edit, or moving.
411  if( aSheet->GetFlags() == 0 )
412  SaveCopyInUndoList( aSheet, UR_CHANGED );
413 
414  // Rotate the sheet on itself. Sheets do not have a anchor point.
415  // Rotation is made around it center
416  wxPoint rotPoint = aSheet->GetBoundingBox().Centre();
417 
418  // rotate CCW, or CW. to rotate CW, rotate 3 times
419  aSheet->Rotate( rotPoint );
420 
421  if( !aRotCCW )
422  {
423  aSheet->Rotate( rotPoint );
424  aSheet->Rotate( rotPoint );
425  }
426 
427  GetCanvas()->Refresh();
428  OnModify();
429 }
430 
431 
432 void SCH_EDIT_FRAME::MirrorSheet( SCH_SHEET* aSheet, bool aFromXaxis )
433 {
434  if( aSheet == NULL )
435  return;
436 
437  // Save old sheet in undo list if not already in edit, or moving.
438  if( aSheet->GetFlags() == 0 )
439  SaveCopyInUndoList( aSheet, UR_CHANGED );
440 
441  // Mirror the sheet on itself. Sheets do not have a anchor point.
442  // Mirroring is made around it center
443  wxPoint mirrorPoint = aSheet->GetBoundingBox().Centre();
444 
445  if( aFromXaxis ) // mirror relative to Horizontal axis
446  aSheet->MirrorX( mirrorPoint.y );
447  else // Mirror relative to vertical axis
448  aSheet->MirrorY( mirrorPoint.x );
449 
450  GetCanvas()->Refresh();
451  OnModify();
452 }
void SetSheetNameTextSize(const wxString &aTextSize)
Definition of the SCH_SHEET class for Eeschema.
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:51
static void ExitSheet(EDA_DRAW_PANEL *aPanel, wxDC *aDC)
Definition: sheet.cpp:308
Class SCH_SHEET_LIST.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
bool Load(LINE_READER &aLine, wxString &aErrorMsg) override
Function Load reads a schematic item from aLine in a .sch file.
Definition: sch_sheet.cpp:190
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
SCH_SHEET * FindSheetByName(const wxString &aSheetName)
Function FindSheetByName.
bool IsMoving() const
Definition: base_struct.h:218
bool IsResized() const
Definition: base_struct.h:222
void SetFileNameSize(int aSize)
Definition: sch_sheet.h:284
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Function SearchHierarchy search the existing hierarchy for an instance of screen "FileName".
Definition: sch_sheet.cpp:713
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
void SaveCopyInUndoList(SCH_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))
Function SaveCopyInUndoList.
EDA_ITEM * GetCurItem() const
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
Implementation of conversion functions that require both schematic and board internal units...
This file is part of the common library.
bool IsNew() const
Definition: base_struct.h:216
void SetFileName(const wxString &aFilename)
Definition: sch_sheet.h:503
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:299
void OnModify()
Function OnModify Must be called after a schematic change in order to set the "modify" flag of the cu...
Definition: schframe.cpp:762
wxString GetUnitsLabel(EDA_UNITS_T aUnit)
Get a human readable units string.
Definition: base_units.cpp:452
int GetMinHeight() const
Function GetMinHeight returns the minimum height that the sheet can be resized based on the sheet pin...
Definition: sch_sheet.cpp:478
wxString StringFromValue(EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol)
Function StringFromValue returns the string from aValue according to units (inch, mm ...
Definition: base_units.cpp:203
void SetFileNameTextSizeUnits(const wxString &aUnits)
void SetScreen(SCH_SCREEN *aScreen)
Function SetScreen sets the screen associated with this sheet to aScreen.
Definition: sch_sheet.cpp:105
wxPoint GetResizePosition() const
Function GetResizePos returns the position of the lower right corner of the sheet in drawing units...
Definition: sch_sheet.cpp:1109
time_t GetNewTimeStamp()
Definition: common.cpp:166
void RotateHierarchicalSheet(SCH_SHEET *aSheet, bool aRotCCW)
Rotate a sheet on itself.
Definition: sheet.cpp:405
SCH_ITEM * GetUndoItem() const
Definition: schframe.h:1309
Schematic editor (Eeschema) main window.
Definition: schframe.h:117
void Remove(SCH_ITEM *aItem)
Function Remove removes aItem from the schematic associated with this screen.
Definition: sch_screen.cpp:158
void MoveCursorToCrossHair()
Function MoveCursorToCrossHair warps the cursor to the current cross hair position.
Definition: draw_panel.cpp:348
SCH_SCREEN * GetScreen()
Definition: sch_sheet.h:286
#define MIN_SHEET_WIDTH
Definition: sch_sheet.h:47
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:203
void SetRepeatItem(SCH_ITEM *aItem)
Function SetRepeatItem clones aItem and owns that clone in this container.
Definition: schframe.cpp:460
#define IS_NEW
New item, just created.
Definition: base_struct.h:113
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:521
int GetSheetNameSize() const
Definition: sch_sheet.h:278
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
wxString GetClass() const override
Function GetClass returns the class name.
Definition: sch_sheet.h:259
SCH_SHEET * CreateSheet(wxDC *DC)
Definition: sheet.cpp:352
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:54
EDA_RECT const GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: sch_sheet.cpp:649
void SetSheetName(const wxString &aSheetName)
void MirrorX(int aXaxis_position) override
Function MirrorX mirrors item relative to the X axis about aXaxis_position.
Definition: sch_sheet.cpp:892
bool HasPins()
Definition: sch_sheet.h:388
void SetSheetNameSize(int aSize)
Definition: sch_sheet.h:280
void SetName(const wxString &aName)
Definition: sch_sheet.h:276
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:213
SCH_ITEM * GetCurItem() const
Function GetCurItem returns the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Subclass of DIALOG_SCH_SHEET_PROPS_BASE, which is generated by wxFormBuilder.
VTBL_ENTRY const wxString AbsolutePath(const wxString &aFileName) const
Function AbsolutePath fixes up aFileName if it is relative to the project's directory to be an absolu...
Definition: project.cpp:371
void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
static void resizeSheetWithMouseCursor(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
Definition: sheet.cpp:269
int ValueFromString(EDA_UNITS_T aUnits, const wxString &aTextValue)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application...
Definition: base_units.cpp:368
The common library.
bool SaveEEFile(SCH_SCREEN *aScreen, bool aSaveUnderNewName=false, bool aCreateBackupFile=CREATE_BACKUP_FILE)
Function SaveEEFile saves aScreen to a schematic file.
void SetSheetTimeStamp(const wxString &aTimeStamp)
void SetSheetNameTextSizeUnits(const wxString &aUnits)
int GetFileNameSize() const
Definition: sch_sheet.h:282
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:175
int m_UndoRedoCountMax
default Undo/Redo command Max depth, to be handed
Definition: draw_frame.h:88
Class SCH_SHEET_PATH.
wxPoint Centre() const
int GetScreenCount() const
Function GetScreenCount returns the number of times the associated screen for the sheet is being used...
Definition: sch_sheet.cpp:128
SCH_SHEET * Last() const
Function Last returns a pointer to the last sheet of the list One can see the others sheet as the "pa...
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_sheet.h:582
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:253
void Rotate(wxPoint aPosition) override
Function Rotate rotates the item around aPosition 90 degrees in the clockwise direction.
Definition: sch_sheet.cpp:868
wxString GetFileName(void) const
Function GetFileName return the filename corresponding to this sheet.
Definition: sch_sheet.cpp:849
time_t GetTimeStamp() const
Definition: base_struct.h:204
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
const wxString SchematicFileExtension
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void ReSizeSheet(SCH_SHEET *Sheet, wxDC *DC)
Definition: sheet.cpp:380
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED) override
Function Draw Draw a schematic item.
Definition: sch_sheet.cpp:583
#define GR_DEFAULT_DRAWMODE
Definition: general.h:70
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:260
wxPoint GetNearestGridPosition(const wxPoint &aPosition, wxRealPoint *aGridSize=NULL) const
Function GetNearestGridPosition returns the nearest aGridSize location to aPosition.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
void Append(SCH_ITEM *aItem)
int GetMinWidth() const
Function GetMinWidth returns the minimum width of the sheet based on the widths of the sheet pin text...
Definition: sch_sheet.cpp:444
void SetFileName(const wxString &aFileName)
void MirrorY(int aYaxis_position) override
Function MirrorY mirrors item relative to the Y axis about aYaxis_position.
Definition: sch_sheet.cpp:904
void SetCurItem(SCH_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
const wxRealPoint & GetGridSize() const
Return the grid size of the currently selected grid.
void SetIgnoreMouseEvents(bool aIgnore)
Implementing DIALOG_SCH_SHEET_PROPS_BASE.
void SetMaxUndoItems(int aMax)
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:188
#define MIN_SHEET_HEIGHT
Definition: sch_sheet.h:48
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:114
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
bool EditSheet(SCH_SHEET *aSheet, SCH_SHEET_PATH *aHierarchy)
Function EditSheet is used to edit an existing sheet or add a new sheet to the schematic.
Definition: sheet.cpp:44
void MirrorSheet(SCH_SHEET *aSheet, bool aFromXaxis)
Function MirrorSheet Mirror a hierarchical sheet Mirroring is made around its centre.
Definition: sheet.cpp:432
void SetUndoItem(const SCH_ITEM *aItem)
Function SetUndoItem clones aItem which can be used to restore the state of the item being edited whe...
Definition: schframe.cpp:580
void SetFileName(const wxString &aFileName)
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
void SetFileNameTextSize(const wxString &aTextSize)
wxString GetName() const
Definition: sch_sheet.h:274
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:111
virtual void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED)=0
Function Draw Draw a schematic item.
bool TestForRecursion(const SCH_SHEET_LIST &aSrcSheetHierarchy, const wxString &aDestFileName) const
Function TestForRecursion.
void Resize(const wxSize &aSize)
Resize this sheet to aSize and adjust all of the labels accordingly.
Definition: sch_sheet.cpp:924