message.cpp 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /**
  2. \file message.cpp
  3. \brief Error message dialogs
  4. This program is free software under the GNU General Public
  5. License (>=v2). Read the file COPYING that comes with GRASS
  6. for details.
  7. (C) 2008 by The GRASS development team
  8. \author Martin Landa <landa.martin gmail.com>
  9. \date 2008
  10. */
  11. #include "driver.h"
  12. #include "digit.h"
  13. /**
  14. \brief Error message - no display driver available
  15. */
  16. void DisplayDriver::DisplayMsg(void)
  17. {
  18. wxMessageDialog dlg(parentWin, _("Display driver not available."),
  19. msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
  20. dlg.ShowModal();
  21. return;
  22. }
  23. /**
  24. \brief Error message - cannot edit 3d features
  25. */
  26. void DisplayDriver::Only2DMsg(void)
  27. {
  28. wxMessageDialog dlg(parentWin, _("3D vector features are not currently supported."),
  29. msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
  30. dlg.ShowModal();
  31. return;
  32. }
  33. /**
  34. \brief Error message - unable to write line
  35. */
  36. void DisplayDriver::WriteLineMsg(void)
  37. {
  38. wxMessageDialog dlg(parentWin, _("Unable to write new line"),
  39. msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
  40. dlg.ShowModal();
  41. return;
  42. }
  43. /**
  44. \brief Error message - unable to read line
  45. \param line line id
  46. */
  47. void DisplayDriver::ReadLineMsg(int line)
  48. {
  49. wxString msg;
  50. msg.Printf(_("Unable to read line %d"), line);
  51. wxMessageDialog dlg(parentWin, msg,
  52. msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
  53. dlg.ShowModal();
  54. return;
  55. }
  56. /**
  57. \brief Error message - trying to read dead line
  58. \param line line id
  59. */
  60. void DisplayDriver::DeadLineMsg(int line)
  61. {
  62. wxString msg;
  63. msg.Printf(_("Unable to read line %d, line is dead"), line);
  64. wxMessageDialog dlg(parentWin, msg,
  65. msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
  66. dlg.ShowModal();
  67. return;
  68. }
  69. /**
  70. \brief Error message - unable to open background map
  71. \param bgmap map name
  72. */
  73. void DisplayDriver::BackgroundMapMsg(const char *bgmap)
  74. {
  75. wxString msg;
  76. msg.Printf(_("Unable to open background vector map <%s>. "
  77. "Please check digitizer settings."),
  78. wxString (bgmap, wxConvUTF8).c_str());
  79. wxMessageDialog dlg(parentWin, msg,
  80. msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
  81. dlg.ShowModal();
  82. return;
  83. }
  84. /**
  85. \brief Error message - dblink not defined
  86. \param layer layer id
  87. */
  88. void DisplayDriver::DblinkMsg(int layer)
  89. {
  90. wxString msg;
  91. msg.Printf(_("Database connection not defined for layer %d"), layer);
  92. wxMessageDialog dlg(parentWin, msg,
  93. msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
  94. dlg.ShowModal();
  95. return;
  96. }
  97. /**
  98. \brief Error message - unable to start driver
  99. \param driver driver name
  100. */
  101. void DisplayDriver::DbDriverMsg(const char *driver)
  102. {
  103. wxString msg;
  104. msg.Printf(_("Unable to start driver <%s>"),
  105. wxString(driver, wxConvUTF8).c_str());
  106. wxMessageDialog dlg(parentWin, msg,
  107. msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
  108. dlg.ShowModal();
  109. return;
  110. }
  111. /**
  112. \brief Error message - unable to open database
  113. \param driver driver name
  114. \param database database name
  115. */
  116. void DisplayDriver::DbDatabaseMsg(const char *driver, const char *database)
  117. {
  118. wxString msg;
  119. msg.Printf(_("Unable to open database <%s> by driver <%s>"),
  120. wxString(database, wxConvUTF8).c_str(),
  121. wxString(driver, wxConvUTF8).c_str());
  122. wxMessageDialog dlg(parentWin, msg,
  123. msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
  124. dlg.ShowModal();
  125. return;
  126. }
  127. /**
  128. \brief Error message - unable to execute SQL command
  129. \param sql sql command
  130. */
  131. void DisplayDriver::DbExecuteMsg(const char *sql)
  132. {
  133. wxString msg;
  134. msg.Printf(_("Unable to execute: '%s'"),
  135. wxString(sql, wxConvUTF8).c_str());
  136. wxMessageDialog dlg(parentWin, msg,
  137. msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
  138. dlg.ShowModal();
  139. return;
  140. }
  141. /**
  142. \brief Error message - unable to open select cursor
  143. \param sql sql command
  144. */
  145. void DisplayDriver::DbSelectCursorMsg(const char *sql)
  146. {
  147. wxString msg;
  148. msg.Printf(_("Unable to open select cursor: '%s'"),
  149. wxString(sql, wxConvUTF8).c_str());
  150. wxMessageDialog dlg(parentWin, msg,
  151. msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
  152. dlg.ShowModal();
  153. return;
  154. }
  155. /**
  156. \brief Error message - unable to get line categories
  157. \param line line id
  158. */
  159. void DisplayDriver::GetLineCatsMsg(int line)
  160. {
  161. wxString msg;
  162. msg.Printf(_("Unable to get feature (%d) categories"), line);
  163. wxMessageDialog dlg(parentWin, msg,
  164. msgCaption, wxOK | wxICON_ERROR | wxCENTRE);
  165. dlg.ShowModal();
  166. return;
  167. }