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.

172 lines
6.1 KiB

* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2009-2014 Jerry Jacobs
  5. * Copyright (C) 1992-2017 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. * This file is part of the common library
  26. * TODO brief description
  27. * @file gestfich.h
  28. * @see common.h
  29. */
  30. #ifndef __INCLUDE__GESTFICH_H__
  31. #define __INCLUDE__GESTFICH_H__ 1
  32. #include <wx/filename.h>
  33. #include <wx/process.h>
  34. /**
  35. * @note Do we really need these defined?
  36. */
  37. #define UNIX_STRING_DIR_SEP wxT( "/" )
  38. #define WIN_STRING_DIR_SEP wxT( "\\" )
  39. /* Forward class declarations. */
  40. class EDA_LIST_DIALOG;
  41. /**
  42. * Function OpenPDF
  43. * run the PDF viewer and display a PDF file
  44. * @param file = PDF file to open
  45. * @return true is success, false if no PDF viewer found
  46. */
  47. bool OpenPDF( const wxString& file );
  48. void OpenFile( const wxString& file );
  49. void PrintFile( const wxString& file );
  50. bool CanPrintFile( const wxString& file );
  51. /**
  52. * Function CopyFile
  53. * @param aSrcPath
  54. * @param aDestPath
  55. * @param aErrors a wxString to *append* any errors to
  56. */
  57. void CopyFile( const wxString& aSrcPath, const wxString& aDestPath, wxString& aErrors );
  58. /**
  59. * Function EDA_FILE_SELECTOR
  60. *
  61. * is a helper function that wraps a call to wxFileSelector.
  62. *
  63. * @param aTitle is a string to display in the dialog title bar.
  64. * @param aPath is a string contain the default path for the path dialog.
  65. * @param aFileName is a string containing the default file name.
  66. * @param aExtension is a string containing the default file extension.
  67. * @param aWildcard is a string containing the default wildcard.
  68. * @param aParent is the parent window of the dialog.
  69. * @param aStyle is the style of the path dialog, wxFD_???.
  70. * @param aKeepWorkingDirectory determines if current working directory should be set to the
  71. * user selected path.
  72. * @param aPosition is the position of the dialog.
  73. * @param aMruPath is a pointer to a string to copy the path selected by the user when
  74. * the OK button is pressed to dismiss the dialog. This can be NULL.
  75. * @return the full path and file name of the selected file or wxEmptyString if the user
  76. * pressed the cancel button to dismiss the dialog.
  77. */
  78. wxString EDA_FILE_SELECTOR( const wxString& aTitle,
  79. const wxString& aPath,
  80. const wxString& aFileName,
  81. const wxString& aExtension,
  82. const wxString& aWildcard,
  83. wxWindow* aParent,
  84. int aStyle,
  85. const bool aKeepWorkingDirectory,
  86. const wxPoint& aPosition = wxDefaultPosition,
  87. wxString* aMruPath = NULL );
  88. EDA_LIST_DIALOG* GetFileNames( char* Directory, char* Mask );
  89. /**
  90. * Function ExecuteFile
  91. * calls the executable file \a ExecFile with the command line parameters \a param.
  92. */
  93. int ExecuteFile( wxWindow* frame, const wxString& ExecFile,
  94. const wxString& param = wxEmptyString, wxProcess *callback = NULL );
  95. /**
  96. * Function AddDelimiterString
  97. * Add un " to the start and the end of string (if not already done).
  98. * @param string = string to modify
  99. */
  100. void AddDelimiterString( wxString& string );
  101. /**
  102. * Function KicadDatasPath
  103. * returns the data path common to KiCad.
  104. * If environment variable KICAD is defined (KICAD = path to kicad)
  105. * Returns \<KICAD\> /;
  106. * Otherwise returns \<path of binaries\> / (if "kicad" is in the path name)
  107. * Otherwise returns /usr /share/kicad/
  108. *
  109. * Note:
  110. * The \\ are replaced by / (a la Unix)
  111. */
  112. wxString KicadDatasPath();
  113. /**
  114. * Function FindKicadFile
  115. * searches the executable file shortname in KiCad binary path and return full file
  116. * name if found or shortname if the kicad binary path is kicad/bin.
  117. *
  118. * kicad binary path is found from:
  119. * BinDir
  120. * or environment variable KICAD
  121. * or (default) c:\\kicad or /usr/local/kicad
  122. * or default binary path
  123. */
  124. wxString FindKicadFile( const wxString& shortname );
  125. /**
  126. * Quote return value of wxFileName::GetFullPath().
  127. *
  128. * This allows file name paths with spaces to be used as parameters to
  129. * ProcessExecute function calls.
  130. * @param fn is the filename to wrap
  131. * @param format if provided, can be used to transform the nature of the
  132. * wrapped filename to another platform.
  133. */
  134. extern wxString QuoteFullPath( wxFileName& fn, wxPathFormat format = wxPATH_NATIVE );
  135. /**
  136. * Delete a directory and all of its contents recursively.
  137. * This function ensures that all contents of subdirectories are deleted before deleting
  138. * the directory. If recursion is disabled, then the existence of subdirectories will
  139. * cause the deletion to fail and the function to return false.
  140. *
  141. * Note that if hidden files/folders exist in the directory, and aIncludeHidden is false,
  142. * then the directory may not be deleted.
  143. *
  144. * @param aRecurse specifies if subdirectories should also be deleted
  145. * @param aIncludeHidden specifies if hidden files/directories should be deleted as well
  146. * @return true if the directory could be deleted
  147. *
  148. */
  149. bool DeleteDirectory( const wxString& aDirName, bool aRecurse = true, bool aIncludeHidden = true );
  150. #endif /* __INCLUDE__GESTFICH_H__ */