message.cpp 4.5 KB

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