Update of /cvsroot/mahogany/M/src/modules
In directory sc8-pr-cvs1:/tmp/cvs-serv383/src/modules

Modified Files:
        BareBonesEditor.cpp 
Log Message:
added a warning if we're using 8bit chars and the language is not set (only for 
Windows, but this could be needed elsewhere too...)

Index: BareBonesEditor.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/BareBonesEditor.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -b -u -2 -r1.21 -r1.22
--- BareBonesEditor.cpp 2 Oct 2003 12:03:12 -0000       1.21
+++ BareBonesEditor.cpp 2 Oct 2003 12:40:26 -0000       1.22
@@ -38,7 +38,11 @@
 
 #include "Composer.h"
-#include "MessageEditor.h"
+#ifdef OS_WIN
+#include "Mpers.h"
+#endif // OS_WIN
 #include "gui/wxMDialogs.h"
 
+#include "MessageEditor.h"
+
 class WXDLLEXPORT wxListCtrl;
 
@@ -55,4 +59,5 @@
 
 extern const MPersMsgBox *M_MSGBOX_FORMAT_PARAGRAPH_BEFORE_EXIT;
+extern const MPersMsgBox *M_MSGBOX_8BIT_WARN;
 
 // ----------------------------------------------------------------------------
@@ -121,4 +126,6 @@
    void OnFirstTimeModify() { MessageEditor::OnFirstTimeModify(); }
 
+   bool HasEncoding() const { return m_encoding != wxFONTENCODING_SYSTEM; }
+
    friend class FormattedParagraph;
    friend class wxBareBonesEditorNotebook;
@@ -216,4 +223,7 @@
    // event handlers
    void OnKeyDown(wxKeyEvent& event);
+#ifdef OS_WIN
+   void OnChar(wxKeyEvent& event);
+#endif // OS_WIN
    void OnFocus(wxFocusEvent& event);
 
@@ -224,4 +234,8 @@
    bool m_firstTimeFocus;
 
+#ifdef OS_WIN
+   bool m_warning8bitShown;
+#endif // OS_WIN
+
    DECLARE_EVENT_TABLE()
 };
@@ -705,4 +719,7 @@
 BEGIN_EVENT_TABLE(wxBareBonesTextControl, wxTextCtrl)
    EVT_KEY_DOWN(wxBareBonesTextControl::OnKeyDown)
+#ifdef OS_WIN
+   EVT_CHAR(wxBareBonesTextControl::OnChar)
+#endif // OS_WIN
    EVT_SET_FOCUS(wxBareBonesTextControl::OnFocus)
 END_EVENT_TABLE()
@@ -719,6 +736,10 @@
    m_editor = editor;
 
-   m_firstTimeModify = TRUE;
-   m_firstTimeFocus = TRUE;
+   m_firstTimeModify = true;
+   m_firstTimeFocus = true;
+
+#ifdef OS_WIN
+   m_warning8bitShown = false;
+#endif // OS_WIN
 }
 
@@ -727,5 +748,5 @@
    if ( m_firstTimeModify )
    {
-      m_firstTimeModify = FALSE;
+      m_firstTimeModify = false;
 
       m_editor->OnFirstTimeModify();
@@ -735,9 +756,38 @@
 }
 
+#ifdef OS_WIN
+
+void wxBareBonesTextControl::OnChar(wxKeyEvent& event)
+{
+   if ( event.GetKeyCode() > 0x7f && event.GetKeyCode() < WXK_START )
+   {
+      if ( !m_editor->HasEncoding() && !m_warning8bitShown )
+      {
+         m_warning8bitShown = true;
+
+         MDialog_Message
+         (
+            _("You should specify the language if you want to use non"
+              "ASCII characters in your message.\n"
+              "\n"
+              "Please choose one in the \"Languages\" menu, otherwise "
+              "the non-ASCII characters could be lost."),
+            this,
+            MDIALOG_MSGTITLE,
+            GetPersMsgBoxName(M_MSGBOX_8BIT_WARN)
+         );
+      }
+   }
+
+   event.Skip();
+}
+
+#endif // OS_WIN
+
 void wxBareBonesTextControl::OnFocus(wxFocusEvent& event)
 {
    if ( m_firstTimeFocus )
    {
-      m_firstTimeFocus = FALSE;
+      m_firstTimeFocus = false;
 
       if ( m_editor->OnFirstTimeFocus() )
@@ -745,5 +795,5 @@
          // composer doesn't need first modification notification any more
          // because it modified the text itself
-         m_firstTimeModify = FALSE;
+         m_firstTimeModify = false;
       }
    }



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to