Update of /cvsroot/mahogany/M/src/gui
In directory usw-pr-cvs1:/tmp/cvs-serv25310/src/gui
Modified Files:
wxComposeView.cpp
Log Message:
better handling of address type entries: don't remember "none" as the default type,
modify the entry type after removing to:, cc: or bcc: prefix
Index: wxComposeView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxComposeView.cpp,v
retrieving revision 1.290
retrieving revision 1.291
diff -b -u -2 -r1.290 -r1.291
--- wxComposeView.cpp 3 Jul 2002 12:49:02 -0000 1.290
+++ wxComposeView.cpp 3 Jul 2002 17:14:03 -0000 1.291
@@ -277,7 +277,8 @@
// change type of this one - called by choice
- void OnTypeChange(wxComposeView::RecipientType rcptType);
+ virtual void OnTypeChange(wxComposeView::RecipientType rcptType);
- // expand our text - called by the "Expand" button
+ // expand our text: called by the "Expand" button and
+ // wxAddressTextCtrl::OnChar()
void OnExpand();
@@ -319,4 +320,8 @@
virtual wxSizer *CreateControls(wxWindow *parent);
+ // notify the composer that the default recipient type changed
+ virtual void OnTypeChange(wxComposeView::RecipientType rcptType);
+
+ // callback for "add new recipient" button
void OnAdd();
@@ -376,10 +381,10 @@
{
public:
- wxRcptTypeChoice(wxRcptControl *rcptControls, wxWindow *parent)
+ wxRcptTypeChoice(wxRcptControl *rcptControl, wxWindow *parent)
: wxChoice(parent, -1,
wxDefaultPosition, wxDefaultSize,
WXSIZEOF(ms_addrTypes), ms_addrTypes)
{
- m_rcptControls = rcptControls;
+ m_rcptControl = rcptControl;
}
@@ -389,5 +394,5 @@
private:
// the back pointer to the entire group of controls
- wxRcptControl *m_rcptControls;
+ wxRcptControl *m_rcptControl;
static const wxString ms_addrTypes[wxComposeView::Recipient_Max];
@@ -410,10 +415,11 @@
public:
// ctor
- wxAddressTextCtrl(wxWindow *parent, wxComposeView *composer)
+ wxAddressTextCtrl(wxWindow *parent,
+ wxRcptControl *rcptControl)
: wxTextCtrl(parent, -1, "",
wxDefaultPosition, wxDefaultSize,
wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB)
{
- m_composeView = composer;
+ m_rcptControl = rcptControl;
}
@@ -426,9 +432,11 @@
protected:
- wxComposeView *GetComposer() const { return m_composeView; }
+ // accessors for the derived classes
+ wxComposeView *GetComposer() const { return m_rcptControl->GetComposer(); }
+ wxRcptControl *GetRcptControl() const { return m_rcptControl; }
private:
- // the composer
- wxComposeView *m_composeView;
+ // the recipient control we're part of
+ wxRcptControl *m_rcptControl;
DECLARE_EVENT_TABLE()
@@ -443,8 +451,8 @@
{
public:
- wxMainAddressTextCtrl(wxRcptMainControl *rcptControls, wxWindow *parent)
- : wxAddressTextCtrl(parent, rcptControls->GetComposer())
+ // we do need wxRcptMainControl and not any wxRcptControl here, see OnEnter
+ wxMainAddressTextCtrl(wxWindow *parent, wxRcptMainControl *rcptControl)
+ : wxAddressTextCtrl(parent, rcptControl)
{
- m_rcptControls = rcptControls;
}
@@ -453,6 +461,4 @@
private:
- wxRcptMainControl *m_rcptControls;
-
DECLARE_EVENT_TABLE()
};
@@ -465,8 +471,7 @@
{
public:
- wxExtraAddressTextCtrl(wxRcptControl *rcptControls, wxWindow *parent)
- : wxAddressTextCtrl(parent, rcptControls->GetComposer())
+ wxExtraAddressTextCtrl(wxRcptControl *rcptControl, wxWindow *parent)
+ : wxAddressTextCtrl(parent, rcptControl)
{
- m_rcptControls = rcptControls;
}
@@ -475,7 +480,4 @@
private:
- // the back pointer to the entire group of controls
- wxRcptControl *m_rcptControls;
-
DECLARE_EVENT_TABLE()
};
@@ -488,5 +490,5 @@
{
public:
- wxRcptExpandButton(wxRcptControl *rcptControls, wxWindow *parent)
+ wxRcptExpandButton(wxRcptControl *rcptControl, wxWindow *parent)
: wxBitmapButton(parent,
-1,
@@ -496,5 +498,5 @@
wxBORDER_NONE)
{
- m_rcptControls = rcptControls;
+ m_rcptControl = rcptControl;
SetToolTip(_("Expand the address using address books"));
@@ -502,9 +504,9 @@
// callback
- void OnButton(wxCommandEvent&) { m_rcptControls->OnExpand(); }
+ void OnButton(wxCommandEvent&) { m_rcptControl->OnExpand(); }
private:
// the back pointer to the entire group of controls
- wxRcptControl *m_rcptControls;
+ wxRcptControl *m_rcptControl;
DECLARE_EVENT_TABLE()
@@ -518,5 +520,5 @@
{
public:
- wxRcptAddButton(wxRcptMainControl *rcptControls, wxWindow *parent)
+ wxRcptAddButton(wxRcptMainControl *rcptControl, wxWindow *parent)
: wxBitmapButton(parent,
-1,
@@ -526,5 +528,5 @@
wxBORDER_NONE)
{
- m_rcptControls = rcptControls;
+ m_rcptControl = rcptControl;
SetToolTip(_("Create a new recipient entry"));
@@ -532,9 +534,9 @@
// callback
- void OnButton(wxCommandEvent&) { m_rcptControls->OnAdd(); }
+ void OnButton(wxCommandEvent&) { m_rcptControl->OnAdd(); }
private:
// the back pointer to the entire group of controls
- wxRcptMainControl *m_rcptControls;
+ wxRcptMainControl *m_rcptControl;
DECLARE_EVENT_TABLE()
@@ -549,5 +551,5 @@
{
public:
- wxRcptRemoveButton(wxRcptExtraControl *rcptControls, wxWindow *parent)
+ wxRcptRemoveButton(wxRcptExtraControl *rcptControl, wxWindow *parent)
: wxBitmapButton(parent,
-1,
@@ -557,5 +559,5 @@
wxBORDER_NONE)
{
- m_rcptControls = rcptControls;
+ m_rcptControl = rcptControl;
SetToolTip(_("Delete this address from the message recipients list"));
@@ -563,9 +565,9 @@
// callback
- void OnButton(wxCommandEvent&) { m_rcptControls->OnRemove(); }
+ void OnButton(wxCommandEvent&) { m_rcptControl->OnRemove(); }
private:
// the back pointer to the entire group of controls
- wxRcptExtraControl *m_rcptControls;
+ wxRcptExtraControl *m_rcptControl;
DECLARE_EVENT_TABLE()
@@ -736,23 +738,29 @@
void wxRcptControl::OnTypeChange(wxComposeView::RecipientType rcptType)
{
- m_composeView->OnRcptTypeChange(rcptType);
+ // nothing to do here
}
void wxRcptControl::OnExpand()
{
- m_text->DoExpand();
+ Composer::RecipientType rcptType = m_text->DoExpand();
+ if ( rcptType != Composer::Recipient_None &&
+ rcptType != Composer::Recipient_Max )
+ {
+ // update the type of the choice control
+ SetType(rcptType);
+ }
}
bool wxRcptControl::IsEnabled() const
{
- return m_choice->GetSelection() != wxComposeView::Recipient_None;
+ return m_choice->GetSelection() != Composer::Recipient_None;
}
-wxComposeView::RecipientType wxRcptControl::GetType() const
+Composer::RecipientType wxRcptControl::GetType() const
{
- return (wxComposeView::RecipientType)m_choice->GetSelection();
+ return (Composer::RecipientType)m_choice->GetSelection();
}
-void wxRcptControl::SetType(wxComposeView::RecipientType rcptType)
+void wxRcptControl::SetType(Composer::RecipientType rcptType)
{
m_choice->SetSelection(rcptType);
@@ -772,5 +780,5 @@
wxAddressTextCtrl *wxRcptMainControl::CreateText(wxWindow *parent)
{
- return new wxMainAddressTextCtrl(this, parent);
+ return new wxMainAddressTextCtrl(parent, this);
}
@@ -790,4 +798,9 @@
}
+void wxRcptMainControl::OnTypeChange(Composer::RecipientType rcptType)
+{
+ GetComposer()->OnRcptTypeChange(rcptType);
+}
+
void wxRcptMainControl::OnAdd()
{
@@ -853,6 +866,5 @@
{
// notify the others (including the composer indirectly)
- m_rcptControls->
- OnTypeChange((wxComposeView::RecipientType)event.GetSelection());
+ m_rcptControl->OnTypeChange((Composer::RecipientType)event.GetSelection());
event.Skip();
@@ -897,5 +909,5 @@
if ( !GetValue().empty() )
{
- DoExpand();
+ m_rcptControl->OnExpand();
// don't call event.Skip()
@@ -917,5 +929,5 @@
String text = GetValue();
- Composer::RecipientType rcptType = m_composeView->ExpandRecipient(&text);
+ Composer::RecipientType rcptType = GetComposer()->ExpandRecipient(&text);
if ( rcptType != Composer::Recipient_None )
@@ -943,5 +955,7 @@
else // add the contents of the control as a new recipient
{
- m_rcptControls->OnAdd();
+ // cast is safe as our rcpt control is always of this class (see ctor
+ // signature)
+ ((wxRcptMainControl *)GetRcptControl())->OnAdd();
}
}
@@ -954,5 +968,5 @@
{
// enable the text only if it has a valid type
- event.Enable(m_rcptControls->IsEnabled());
+ event.Enable(GetRcptControl()->IsEnabled());
}
@@ -1642,4 +1656,5 @@
if ( textOrig.length() > 3 )
{
+ // check for to:, cc: or bcc: prefix
if ( textOrig[2u] == ':' )
{
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
No, I will not fix your computer.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates