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.

695 lines
22 KiB

13 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2013-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 1992-2014 KiCad Developers, see CHANGELOG.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. /**
  25. * @file worksheet_shape_builder.h
  26. * @brief classes and function to generate graphics to plt or draw titles blocks
  27. * and frame references
  28. */
  29. #ifndef WORKSHEET_SHAPE_BUILDER_H
  30. #define WORKSHEET_SHAPE_BUILDER_H
  31. #include <math/vector2d.h>
  32. #include <eda_text.h>
  33. #include <eda_text.h>
  34. #include <class_bitmap_base.h>
  35. class WORKSHEET_DATAITEM; // Forward declaration
  36. class TITLE_BLOCK;
  37. class PAGE_INFO;
  38. #define TB_DEFAULT_TEXTSIZE 1.5 // default worksheet text size in mm
  39. /*
  40. * Helper classes to handle basic graphic items used to raw/plot
  41. * title blocks and frame references
  42. * segments
  43. * rect
  44. * polygons (for logos)
  45. * graphic texts
  46. * bitmaps, also for logos, but they cannot be plot by SVG, GERBER
  47. * and HPGL plotters (In this case, only the bounding box is plotted)
  48. */
  49. class WS_DRAW_ITEM_BASE // This basic class, not directly usable.
  50. {
  51. public:
  52. enum WS_DRAW_TYPE {
  53. wsg_line, wsg_rect, wsg_poly, wsg_text, wsg_bitmap
  54. };
  55. int m_Flags; // temporary flgs used in page layout editor
  56. // to locate the item;
  57. protected:
  58. WS_DRAW_TYPE m_type; // wsg_line, wsg_rect, wsg_poly, wsg_text
  59. EDA_COLOR_T m_color;
  60. WORKSHEET_DATAITEM* m_parent; // an unique identifier, used as link
  61. // to the parent WORKSHEET_DATAITEM item,
  62. // in page layout editor
  63. WS_DRAW_ITEM_BASE( WORKSHEET_DATAITEM* aParent,
  64. WS_DRAW_TYPE aType, EDA_COLOR_T aColor )
  65. {
  66. m_type = aType;
  67. m_color = aColor;
  68. m_parent = aParent;
  69. m_Flags = 0;
  70. }
  71. public:
  72. virtual ~WS_DRAW_ITEM_BASE() {}
  73. // Accessors:
  74. EDA_COLOR_T GetColor() const { return m_color; }
  75. WS_DRAW_TYPE GetType() const { return m_type; };
  76. WORKSHEET_DATAITEM* GetParent() const { return m_parent; }
  77. /** The function to draw a WS_DRAW_ITEM
  78. */
  79. virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC ) = 0;
  80. /**
  81. * Abstract function: should exist for derived items
  82. * return true if the point aPosition is on the item
  83. */
  84. virtual bool HitTest( const wxPoint& aPosition) const = 0;
  85. /**
  86. * Abstract function: should exist for derived items
  87. * return true if the point aPosition is near the starting point of this item,
  88. * for items defined by 2 points (segments, rect)
  89. * or the position of the item, for items having only one point
  90. * (texts or polygons)
  91. * the maxi dist is WORKSHEET_DATAITEM::GetMarkerSizeUi()/2
  92. */
  93. virtual bool HitTestStartPoint( const wxPoint& aPosition) = 0;
  94. /**
  95. * return true if the point aPosition is near the ending point of this item
  96. * This is avirtual function which should be overriden for items defien by
  97. * 2 points
  98. * the maxi dist is WORKSHEET_DATAITEM::GetMarkerSizeUi()/2
  99. */
  100. virtual bool HitTestEndPoint( const wxPoint& aPosition)
  101. {
  102. return false;
  103. }
  104. };
  105. // This class draws a thick segment
  106. class WS_DRAW_ITEM_LINE : public WS_DRAW_ITEM_BASE
  107. {
  108. wxPoint m_start; // start point of line/rect
  109. wxPoint m_end; // end point
  110. int m_penWidth;
  111. public:
  112. WS_DRAW_ITEM_LINE( WORKSHEET_DATAITEM* aParent,
  113. wxPoint aStart, wxPoint aEnd,
  114. int aPenWidth, EDA_COLOR_T aColor ) :
  115. WS_DRAW_ITEM_BASE( aParent, wsg_line, aColor )
  116. {
  117. m_start = aStart;
  118. m_end = aEnd;
  119. m_penWidth = aPenWidth;
  120. }
  121. // Accessors:
  122. int GetPenWidth() const { return m_penWidth; }
  123. const wxPoint& GetStart() const { return m_start; }
  124. const wxPoint& GetEnd() const { return m_end; }
  125. /** The function to draw a WS_DRAW_ITEM_LINE
  126. */
  127. virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC );
  128. /**
  129. * Virtual function
  130. * return true if the point aPosition is on the line
  131. */
  132. virtual bool HitTest( const wxPoint& aPosition) const;
  133. /**
  134. * return true if the point aPosition is on the starting point of this item.
  135. */
  136. virtual bool HitTestStartPoint( const wxPoint& aPosition);
  137. /**
  138. * return true if the point aPosition is on the ending point of this item
  139. * This is avirtual function which should be overriden for items defien by
  140. * 2 points
  141. */
  142. virtual bool HitTestEndPoint( const wxPoint& aPosition);
  143. };
  144. // This class draws a polygon
  145. class WS_DRAW_ITEM_POLYGON : public WS_DRAW_ITEM_BASE
  146. {
  147. wxPoint m_pos; // position of reference point, from the
  148. // WORKSHEET_DATAITEM_POLYPOLYGON parent
  149. // (used only in page layout editor to draw anchors)
  150. int m_penWidth;
  151. bool m_fill;
  152. public:
  153. std::vector <wxPoint> m_Corners;
  154. public:
  155. WS_DRAW_ITEM_POLYGON( WORKSHEET_DATAITEM* aParent, wxPoint aPos,
  156. bool aFill, int aPenWidth, EDA_COLOR_T aColor ) :
  157. WS_DRAW_ITEM_BASE( aParent, wsg_poly, aColor )
  158. {
  159. m_penWidth = aPenWidth;
  160. m_fill = aFill;
  161. m_pos = aPos;
  162. }
  163. // Accessors:
  164. int GetPenWidth() const { return m_penWidth; }
  165. bool IsFilled() const { return m_fill; }
  166. const wxPoint& GetPosition() const { return m_pos; }
  167. /** The function to draw a WS_DRAW_ITEM_POLYGON
  168. */
  169. virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC );
  170. /**
  171. * Virtual function
  172. * return true if the point aPosition is inside one polygon
  173. */
  174. virtual bool HitTest( const wxPoint& aPosition) const;
  175. /**
  176. * return true if the point aPosition is on the starting point of this item.
  177. */
  178. virtual bool HitTestStartPoint( const wxPoint& aPosition);
  179. };
  180. // This class draws a not filled rectangle with thick segment
  181. class WS_DRAW_ITEM_RECT : public WS_DRAW_ITEM_LINE
  182. {
  183. public:
  184. WS_DRAW_ITEM_RECT( WORKSHEET_DATAITEM* aParent,
  185. wxPoint aStart, wxPoint aEnd,
  186. int aPenWidth, EDA_COLOR_T aColor ) :
  187. WS_DRAW_ITEM_LINE( aParent, aStart, aEnd, aPenWidth, aColor )
  188. {
  189. m_type = wsg_rect;
  190. }
  191. /** The function to draw a WS_DRAW_ITEM_RECT
  192. */
  193. virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC );
  194. /**
  195. * Virtual function
  196. * return true if the point aPosition is on one edge of the rectangle
  197. */
  198. virtual bool HitTest( const wxPoint& aPosition) const;
  199. /**
  200. * return true if the point aPosition is on the starting point of this item.
  201. */
  202. virtual bool HitTestStartPoint( const wxPoint& aPosition);
  203. /**
  204. * return true if the point aPosition is on the ending point of this item
  205. * This is avirtual function which should be overriden for items defien by
  206. * 2 points
  207. */
  208. virtual bool HitTestEndPoint( const wxPoint& aPosition);
  209. };
  210. // This class draws a graphic text.
  211. // it is derived from an EDA_TEXT, so it handle all caracteristics
  212. // of this graphic text (justification, rotation ... )
  213. class WS_DRAW_ITEM_TEXT : public WS_DRAW_ITEM_BASE, public EDA_TEXT
  214. {
  215. public:
  216. WS_DRAW_ITEM_TEXT( WORKSHEET_DATAITEM* aParent,
  217. wxString& aText, wxPoint aPos, wxSize aSize,
  218. int aPenWidth, EDA_COLOR_T aColor,
  219. bool aItalic = false, bool aBold = false );
  220. /** The function to draw a WS_DRAW_ITEM_TEXT
  221. */
  222. virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC );
  223. // Accessors:
  224. int GetPenWidth() { return GetThickness(); }
  225. /**
  226. * Virtual function
  227. * return true if the point aPosition is on the text
  228. */
  229. virtual bool HitTest( const wxPoint& aPosition) const;
  230. /**
  231. * return true if the point aPosition is on the starting point of this item.
  232. */
  233. virtual bool HitTestStartPoint( const wxPoint& aPosition);
  234. };
  235. // This class draws a bitmap.
  236. class WS_DRAW_ITEM_BITMAP : public WS_DRAW_ITEM_BASE
  237. {
  238. wxPoint m_pos; // position of reference point
  239. public:
  240. WS_DRAW_ITEM_BITMAP( WORKSHEET_DATAITEM* aParent, wxPoint aPos )
  241. :WS_DRAW_ITEM_BASE( aParent, wsg_bitmap, UNSPECIFIED_COLOR )
  242. {
  243. m_pos = aPos;
  244. }
  245. WS_DRAW_ITEM_BITMAP()
  246. :WS_DRAW_ITEM_BASE( NULL, wsg_bitmap, UNSPECIFIED_COLOR )
  247. {
  248. }
  249. ~WS_DRAW_ITEM_BITMAP() {}
  250. /** The function to draw a WS_DRAW_ITEM_BITMAP
  251. */
  252. virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC );
  253. /**
  254. * Virtual function
  255. * return true if the point aPosition is on bitmap
  256. */
  257. virtual bool HitTest( const wxPoint& aPosition) const;
  258. /**
  259. * return true if the point aPosition is on the reference point of this item.
  260. */
  261. virtual bool HitTestStartPoint( const wxPoint& aPosition);
  262. const wxPoint& GetPosition() { return m_pos; }
  263. };
  264. /*
  265. * this class stores the list of graphic items:
  266. * rect, lines, polygons and texts to draw/plot
  267. * the title block and frame references, and parameters to
  268. * draw/plot them
  269. */
  270. class WS_DRAW_ITEM_LIST
  271. {
  272. protected:
  273. std::vector <WS_DRAW_ITEM_BASE*> m_graphicList; // Items to draw/plot
  274. unsigned m_idx; // for GetFirst, GetNext functions
  275. wxPoint m_LTmargin; // The left top margin in mils of the page layout.
  276. wxPoint m_RBmargin; // The right bottom margin in mils of the page layout.
  277. wxSize m_pageSize; // the page size in mils
  278. double m_milsToIu; // the scalar to convert pages units ( mils)
  279. // to draw/plot units.
  280. int m_penSize; // The default line width for drawings.
  281. // used when an item has a pen size = 0
  282. int m_sheetNumber; // the value of the sheet number, for basic inscriptions
  283. int m_sheetCount; // the value of the number of sheets, in schematic
  284. // for basic inscriptions, in schematic
  285. const TITLE_BLOCK* m_titleBlock; // for basic inscriptions
  286. const wxString* m_paperFormat; // for basic inscriptions
  287. wxString m_fileName; // for basic inscriptions
  288. const wxString* m_sheetFullName; // for basic inscriptions
  289. public:
  290. WS_DRAW_ITEM_LIST()
  291. {
  292. m_idx = 0;
  293. m_milsToIu = 1.0;
  294. m_penSize = 1;
  295. m_sheetNumber = 1;
  296. m_sheetCount = 1;
  297. m_titleBlock = NULL;
  298. m_paperFormat = NULL;
  299. m_sheetFullName = NULL;
  300. }
  301. ~WS_DRAW_ITEM_LIST()
  302. {
  303. for( unsigned ii = 0; ii < m_graphicList.size(); ii++ )
  304. delete m_graphicList[ii];
  305. }
  306. /**
  307. * Set the filename to draw/plot
  308. * @param aFileName = the text to display by the "filename" format
  309. */
  310. void SetFileName( const wxString & aFileName )
  311. {
  312. m_fileName = aFileName;
  313. }
  314. /**
  315. * Set the sheet name to draw/plot
  316. * @param aSheetName = the text to draw/plot by the "sheetname" format
  317. */
  318. void SetSheetName( const wxString & aSheetName )
  319. {
  320. m_sheetFullName = &aSheetName;
  321. }
  322. /** Function SetPenSize
  323. * Set the default pen size to draw/plot lines and texts
  324. * @param aPenSize the thickness of lines
  325. */
  326. void SetPenSize( int aPenSize )
  327. {
  328. m_penSize = aPenSize;
  329. }
  330. /** Function SetMilsToIUfactor
  331. * Set the scalar to convert pages units ( mils) to draw/plot units
  332. * @param aScale the conversion factor
  333. */
  334. void SetMilsToIUfactor( double aScale )
  335. {
  336. m_milsToIu = aScale;
  337. }
  338. /** Function SetPageSize
  339. * Set the size of the page layout
  340. * @param aPageSize size (in mils) of the page layout.
  341. */
  342. void SetPageSize( const wxSize& aPageSize )
  343. {
  344. m_pageSize = aPageSize;
  345. }
  346. /**
  347. * Function SetSheetNumber
  348. * Set the value of the sheet number, for basic inscriptions
  349. * @param aSheetNumber the number to display.
  350. */
  351. void SetSheetNumber( int aSheetNumber )
  352. {
  353. m_sheetNumber = aSheetNumber;
  354. }
  355. /**
  356. * Function SetSheetCount
  357. * Set the value of the count of sheets, for basic inscriptions
  358. * @param aSheetCount the number of esheets to display.
  359. */
  360. void SetSheetCount( int aSheetCount )
  361. {
  362. m_sheetCount = aSheetCount;
  363. }
  364. /** Function SetMargins
  365. * Set the left top margin and the right bottom margin
  366. * of the page layout
  367. * @param aLTmargin The left top margin of the page layout.
  368. * @param aRBmargin The right bottom margin of the page layout.
  369. */
  370. void SetMargins( const wxPoint& aLTmargin, const wxPoint& aRBmargin )
  371. {
  372. m_LTmargin = aLTmargin;
  373. m_RBmargin = aRBmargin;
  374. }
  375. void Append( WS_DRAW_ITEM_BASE* aItem )
  376. {
  377. m_graphicList.push_back( aItem );
  378. }
  379. WS_DRAW_ITEM_BASE* GetFirst()
  380. {
  381. m_idx = 0;
  382. if( m_graphicList.size() )
  383. return m_graphicList[0];
  384. else
  385. return NULL;
  386. }
  387. WS_DRAW_ITEM_BASE* GetNext()
  388. {
  389. m_idx++;
  390. if( m_graphicList.size() > m_idx )
  391. return m_graphicList[m_idx];
  392. else
  393. return NULL;
  394. }
  395. /**
  396. * Draws the item list created by BuildWorkSheetGraphicList
  397. * @param aClipBox = the clipping rect, or NULL if no clipping
  398. * @param aDC = the current Device Context
  399. */
  400. void Draw( EDA_RECT* aClipBox, wxDC* aDC );
  401. /**
  402. * Function BuildWorkSheetGraphicList is a core function for
  403. * drawing or plotting the page layout with
  404. * the frame and the basic inscriptions.
  405. * It populates the list of basic graphic items to draw or plot.
  406. * currently lines, rect, polygons and texts
  407. * before calling this function, some parameters should be initialized:
  408. * by calling:
  409. * SetPenSize( aPenWidth );
  410. * SetMilsToIUfactor( aScalar );
  411. * SetSheetNumber( aSheetNumber );
  412. * SetSheetCount( aSheetCount );
  413. * SetFileName( aFileName );
  414. * SetSheetName( aFullSheetName );
  415. *
  416. * @param aPageInfo The PAGE_INFO, for page size, margins...
  417. * @param aTitleBlock The sheet title block, for basic inscriptions.
  418. * @param aColor The color for drawing.
  419. * @param aAltColor The color for items which need to be "hightlighted".
  420. */
  421. void BuildWorkSheetGraphicList( const PAGE_INFO& aPageInfo,
  422. const TITLE_BLOCK& aTitleBlock,
  423. EDA_COLOR_T aColor, EDA_COLOR_T aAltColor );
  424. /**
  425. * Function BuildFullText
  426. * returns the full text corresponding to the aTextbase,
  427. * after replacing format symbols by the corresponding value
  428. *
  429. * Basic texts in Ki_WorkSheetData struct use format notation
  430. * like "Title %T" to identify at run time the full text
  431. * to display.
  432. * Currently format identifier is % followed by a letter or 2 letters
  433. *
  434. * %% = replaced by %
  435. * %K = Kicad version
  436. * %Z = paper format name (A4, USLetter)
  437. * %Y = company name
  438. * %D = date
  439. * %R = revision
  440. * %S = sheet number
  441. * %N = number of sheets
  442. * %Cx = comment (x = 0 to 9 to identify the comment)
  443. * %F = filename
  444. * %P = sheet path or sheet full name
  445. * %T = title
  446. * Other fields like Developer, Verifier, Approver could use %Cx
  447. * and are seen as comments for format
  448. *
  449. * @param aTextbase = the text with format symbols
  450. * @return the text, after replacing the format symbols by the actual value
  451. */
  452. wxString BuildFullText( const wxString& aTextbase );
  453. /**
  454. * Locate graphic items in m_graphicList at location aPosition
  455. * @param aList = the list of items found
  456. * @param aPosition the position (in user units) to locate items
  457. */
  458. void Locate(std::vector <WS_DRAW_ITEM_BASE*>& aList, const wxPoint& aPosition);
  459. };
  460. /**
  461. * WORKSHEET_LAYOUT handles the graphic items list to draw/plot
  462. * the title block and other items (page references ...
  463. */
  464. class WORKSHEET_LAYOUT
  465. {
  466. std::vector <WORKSHEET_DATAITEM*> m_list;
  467. bool m_allowVoidList; // If false, the default page layout
  468. // will be loaded the first time
  469. // WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList
  470. // is run (useful mainly for page layout editor)
  471. double m_leftMargin; // the left page margin in mm
  472. double m_rightMargin; // the right page margin in mm
  473. double m_topMargin; // the top page margin in mm
  474. double m_bottomMargin; // the bottom page margin in mm
  475. public:
  476. WORKSHEET_LAYOUT();
  477. ~WORKSHEET_LAYOUT() {ClearList(); }
  478. /**
  479. * static function: returns the instance of WORKSHEET_LAYOUT
  480. * used in the application
  481. */
  482. static WORKSHEET_LAYOUT& GetTheInstance();
  483. /**
  484. * static function: Set an alternate instance of WORKSHEET_LAYOUT
  485. * mainly used in page setting dialog
  486. * @param aLayout = the alternate page layout.
  487. * if null, restore the basic page layout
  488. */
  489. static void SetAltInstance( WORKSHEET_LAYOUT* aLayout = NULL );
  490. // Accessors:
  491. double GetLeftMargin() { return m_leftMargin; }
  492. double GetRightMargin() { return m_rightMargin; }
  493. double GetTopMargin() { return m_topMargin; }
  494. double GetBottomMargin() { return m_bottomMargin; }
  495. void SetLeftMargin( double aMargin );
  496. void SetRightMargin( double aMargin );
  497. void SetTopMargin( double aMargin );
  498. void SetBottomMargin( double aMargin );
  499. /**
  500. * In Kicad applications, a page layout description is needed
  501. * So if the list is empty, a default description is loaded,
  502. * the first time a page layout is drawn.
  503. * However, in page layout editor, an empty list is acceptable.
  504. * AllowVoidList allows or not the empty list
  505. */
  506. void AllowVoidList( bool Allow ) { m_allowVoidList = Allow; }
  507. /**
  508. * @return true if an empty list is allowed
  509. * (mainly allowed for page layout editor).
  510. */
  511. bool VoidListAllowed() { return m_allowVoidList; }
  512. /**
  513. * erase the list of items
  514. */
  515. void ClearList();
  516. /**
  517. * Save the description in a file
  518. * @param aFullFileName the filename of the file to created
  519. */
  520. void Save( const wxString& aFullFileName );
  521. /**
  522. * Save the description in a buffer
  523. * @param aOutputString = a wxString to store the S expr string
  524. */
  525. void SaveInString( wxString& aOutputString );
  526. /**
  527. * Add an item to the list of items
  528. */
  529. void Append( WORKSHEET_DATAITEM* aItem )
  530. {
  531. m_list.push_back( aItem );
  532. }
  533. /**
  534. *Insert an item to the list of items at position aIdx
  535. */
  536. void Insert( WORKSHEET_DATAITEM* aItem, unsigned aIdx );
  537. /**
  538. *Remove the item to the list of items at position aIdx
  539. */
  540. bool Remove( unsigned aIdx );
  541. /**
  542. *Remove the item to the list of items at position aIdx
  543. */
  544. bool Remove( WORKSHEET_DATAITEM* aItem );
  545. /**
  546. * @return the index of aItem, or -1 if does not exist
  547. */
  548. int GetItemIndex( WORKSHEET_DATAITEM* aItem ) const;
  549. /**
  550. * @return the item from its index aIdx, or NULL if does not exist
  551. */
  552. WORKSHEET_DATAITEM* GetItem( unsigned aIdx ) const;
  553. /**
  554. * @return the item count
  555. */
  556. unsigned GetCount() const { return m_list.size(); }
  557. /**
  558. * Fills the list with the default layout shape
  559. */
  560. void SetDefaultLayout();
  561. /**
  562. * Populates the list with a custom layout, or
  563. * the default layout, if no custom layout available
  564. * @param aFullFileName = the custom page layout description file.
  565. * if empty, loads the file defined by KICAD_WKSFILE
  566. * and if its is not defined, uses the default internal description
  567. * @param Append = if true: do not delete old layout, and load only
  568. aFullFileName.
  569. */
  570. void SetPageLayout( const wxString& aFullFileName = wxEmptyString,
  571. bool Append = false );
  572. /**
  573. * Populates the list from a S expr description stored in a string
  574. * @param aPageLayout = the S expr string
  575. * @param Append Do not delete old layout if true and append \a aPageLayout
  576. * the existing one.
  577. */
  578. void SetPageLayout( const char* aPageLayout, bool Append = false );
  579. /**
  580. * @return a short filename from a full filename:
  581. * if the path is the current project path, or if the path
  582. * is the same as kicad.pro (in template), returns the shortname
  583. * else do nothing and returns a full filename
  584. * @param aFullFileName = the full filename, which can be a relative
  585. * @param aProjectPath = the curr project absolute path (can be empty)
  586. */
  587. static const wxString MakeShortFileName( const wxString& aFullFileName,
  588. const wxString& aProjectPath );
  589. /**
  590. * Static function
  591. * @return a full filename from a short filename.
  592. * @param aShortFileName = the short filename, which can be a relative
  593. * @param aProjectPath = the curr project absolute path (can be empty)
  594. * or absolute path, and can include env variable reference ( ${envvar} expression )
  595. * if the short filename path is relative, it is expected relative to the project path
  596. * or (if aProjectPath is empty or if the file does not exist)
  597. * relative to kicad.pro (in template)
  598. * If aShortFileName is absolute return aShortFileName
  599. */
  600. static const wxString MakeFullFileName( const wxString& aShortFileName,
  601. const wxString& aProjectPath );
  602. };
  603. #endif // WORKSHEET_SHAPE_BUILDER_H