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.

151 lines
4.5 KiB

  1. /**
  2. * This file is part of the common library
  3. * TODO brief description
  4. * @file gestfich.h
  5. * @see common.h
  6. */
  7. #ifndef __INCLUDE__GESTFICH_H__
  8. #define __INCLUDE__GESTFICH_H__ 1
  9. #include <wx/filename.h>
  10. #include <wx/process.h>
  11. /* Forward class declarations. */
  12. class EDA_LIST_DIALOG;
  13. /**
  14. * Function OpenPDF
  15. * run the PDF viewer and display a PDF file
  16. * @param file = PDF file to open
  17. * @return true is success, false if no PDF viewer found
  18. */
  19. bool OpenPDF( const wxString& file );
  20. void OpenFile( const wxString& file );
  21. bool EDA_DirectorySelector( const wxString& Title,
  22. wxString& Path,
  23. int flag, /* reserve */
  24. wxWindow* Frame,
  25. const wxPoint& Pos );
  26. /* Selection file dialog box:
  27. * Dialog title
  28. * Default path
  29. * default filename
  30. * default filename extension
  31. * filter for filename list
  32. * parent frame
  33. * wxFD_SAVE, wxFD_OPEN ..
  34. * true = keep the current path
  35. */
  36. wxString EDA_FileSelector( const wxString& Title,
  37. const wxString& Path,
  38. const wxString& FileName,
  39. const wxString& Ext,
  40. const wxString& Mask,
  41. wxWindow* Frame,
  42. int flag,
  43. const bool keep_working_directory,
  44. const wxPoint& Pos = wxPoint( -1, -1 ) );
  45. /**
  46. * Function MakeReducedFileName
  47. * calculate the "reduced" filename from \a fullfilename.
  48. *
  49. * @param fullfilename = full filename
  50. * @param default_path = default path
  51. * @param default_ext = default extension
  52. * @return the "reduced" filename, i.e.:
  53. * without path if it is default_path
  54. * with ./ if the path is the current path
  55. * without extension if extension is default_ext
  56. *
  57. * the new filename is in unix like notation ('/' as path separator)
  58. */
  59. wxString MakeReducedFileName( const wxString& fullfilename,
  60. const wxString& default_path,
  61. const wxString& default_ext );
  62. EDA_LIST_DIALOG* GetFileNames( char* Directory, char* Mask );
  63. /**
  64. * Function ExecuteFile
  65. * calls the executable file \a ExecFile with the command line parameters \a param.
  66. */
  67. int ExecuteFile( wxWindow* frame, const wxString& ExecFile,
  68. const wxString& param = wxEmptyString, wxProcess *callback = NULL );
  69. /**
  70. * Function AddDelimiterString
  71. * Add un " to the start and the end of string (if not already done).
  72. * @param string = string to modify
  73. */
  74. void AddDelimiterString( wxString& string );
  75. /**
  76. * Function FindKicadHelpPath
  77. * finds the absolute path for KiCad "help" (or "help/&ltlanguage&gt")
  78. * Find path kicad/doc/help/xx/ or kicad/doc/help/:
  79. * from BinDir
  80. * else from environment variable KICAD
  81. * else from one of s_HelpPathList
  82. * typically c:/kicad/doc/help or /usr/share/kicad/help
  83. * or /usr/local/share/kicad/help
  84. * (must have kicad in path name)
  85. *
  86. * xx = iso639-1 language id (2 letters (generic) or 4 letters):
  87. * fr = french (or fr_FR)
  88. * en = English (or en_GB or en_US ...)
  89. * de = deutch
  90. * es = spanish
  91. * pt = portuguese (or pt_BR ...)
  92. *
  93. * default = en (if not found = fr)
  94. */
  95. wxString FindKicadHelpPath();
  96. /**
  97. * Function ReturnKicadDatasPath
  98. * returns the data path common to KiCad.
  99. * If environment variable KICAD is defined (KICAD = path to kicad)
  100. * Returns \<KICAD\> /;
  101. * Otherwise returns \<path of binaries\> / (if "kicad" is in the path name)
  102. * Otherwise returns /usr /share/kicad/
  103. *
  104. * Note:
  105. * The \\ are replaced by / (a la Unix)
  106. */
  107. wxString ReturnKicadDatasPath();
  108. /**
  109. * Function FindKicadFile
  110. * searches the executable file shortname in KiCad binary path and return full file
  111. * name if found or shortname if the kicad binary path is kicad/bin.
  112. *
  113. * kicad binary path is found from:
  114. * BinDir
  115. * or environment variable KICAD
  116. * or (default) c:\\kicad or /usr/local/kicad
  117. * or default binary path
  118. */
  119. wxString FindKicadFile( const wxString& shortname );
  120. /**
  121. * Quote return value of wxFileName::GetFullPath().
  122. *
  123. * This allows file name paths with spaces to be used as parameters to
  124. * ProcessExecute function calls.
  125. * @param fn is the filename to wrap
  126. * @param format if provided, can be used to transform the nature of the
  127. * wrapped filename to another platform.
  128. */
  129. extern wxString QuoteFullPath( wxFileName& fn, wxPathFormat format = wxPATH_NATIVE );
  130. #endif /* __INCLUDE__GESTFICH_H__ */