Update of /cvsroot/audacity/audacity-src/src/widgets
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv14166

Modified Files:
        TimeTextCtrl.cpp 
Log Message:
Re-add (after stupidly deleting) processing the enter key and hiding the menu 
button.

Index: TimeTextCtrl.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/widgets/TimeTextCtrl.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- TimeTextCtrl.cpp    20 Aug 2006 08:43:46 -0000      1.40
+++ TimeTextCtrl.cpp    7 Sep 2006 06:25:35 -0000       1.41
@@ -281,7 +281,6 @@
    mTimeValue(timeValue),
    mSampleRate(sampleRate),
    mFormatString(formatString),
-   mMenuEnabled(false),
    mBackgroundBitmap(NULL),
    mDigitFont(NULL),
    mLabelFont(NULL),
@@ -290,6 +289,8 @@
 {
    mDigitBoxW = 10;
    mDigitBoxH = 16;
+
+   mMenuEnabled = true;
    mButtonWidth = 9;
 
    ParseFormatString();
@@ -350,8 +351,8 @@
 
 void TimeTextCtrl::EnableMenu(bool enable)
 {
-   wxString tip(_("Use right mouse button or context key to change format"));
 #if wxUSE_TOOLTIPS
+   wxString tip(_("Use right mouse button or context key to change format"));
    if (enable)
       SetToolTip(tip);
    else {
@@ -361,6 +362,9 @@
    }
 #endif
    mMenuEnabled = enable;
+   mButtonWidth = enable ? 9 : 0;
+   Layout();
+   Fit();
 }
 
 const double TimeTextCtrl::GetTimeValue()
@@ -694,14 +698,16 @@
       memDC.DrawText(mFields[i].label,
                      mFields[i].labelX, labelTop);
 
-   wxRect r(mWidth, 0, mButtonWidth - 1, mHeight - 1);
-   AColor::Bevel(memDC, true, r);
-   memDC.SetPen(*wxBLACK_PEN);
-   int triWid = mButtonWidth - 2;
-   int xStart = mWidth + 1;
-   int yStart = (mHeight / 2) - 2;
-   for (i = 0; i <= (unsigned int)(triWid / 2); i++ ) {
-      memDC.DrawLine(xStart + i, yStart + i, xStart + triWid - i, yStart + i);
+   if (mMenuEnabled) {
+      wxRect r(mWidth, 0, mButtonWidth - 1, mHeight - 1);
+      AColor::Bevel(memDC, true, r);
+      memDC.SetPen(*wxBLACK_PEN);
+      int triWid = mButtonWidth - 2;
+      int xStart = mWidth + 1;
+      int yStart = (mHeight / 2) - 2;
+      for (i = 0; i <= (unsigned int)(triWid / 2); i++) {
+         memDC.DrawLine(xStart + i, yStart + i, xStart + triWid - i, yStart + 
i);
+      }
    }
    return true;
 }
@@ -873,6 +879,8 @@
       case WXK_UP:
       case WXK_DOWN:
       case WXK_TAB:
+      case WXK_RETURN:
+      case WXK_NUMPAD_ENTER:
          return;
 
       default:
@@ -948,22 +956,32 @@
    }
 
    else if (keyCode == WXK_TAB) {   
-      wxWindow *parent = GetParent();   
-      wxNavigationKeyEvent nevent;   
-      nevent.SetWindowChange( event.ControlDown() );   
-      nevent.SetDirection( !event.ShiftDown() );   
-      nevent.SetEventObject( parent );   
-      nevent.SetCurrentFocus( parent );   
-      GetParent()->ProcessEvent( nevent );   
+      wxWindow *parent = GetParent();
+      wxNavigationKeyEvent nevent;
+      nevent.SetWindowChange(event.ControlDown());
+      nevent.SetDirection(!event.ShiftDown());
+      nevent.SetEventObject(parent);
+      nevent.SetCurrentFocus(parent);
+      GetParent()->ProcessEvent(nevent);
    } 
 
+   else if (keyCode == WXK_RETURN || keyCode == WXK_NUMPAD_ENTER) {
+      wxWindow *parent = GetParent();
+      wxWindow *def = parent->GetDefaultItem();
+      if (def && def->IsEnabled()) {
+         wxCommandEvent cevent(wxEVT_COMMAND_BUTTON_CLICKED,
+                               def->GetId());
+         GetParent()->ProcessEvent(cevent);
+      }
+   }
+
    else {
       event.Skip();
       return;
    }
 
    if (digit != mFocusedDigit) {
-      SetFieldFocus( mFocusedDigit );
+      SetFieldFocus(mFocusedDigit);
    }
 
    event.Skip(false);
@@ -972,25 +990,24 @@
 void TimeTextCtrl::SetFieldFocus(int digit)
 {
 #if wxUSE_ACCESSIBILITY
-   if( mLastField != -1 )
-   {
-      GetAccessible()->NotifyEvent( wxACC_EVENT_OBJECT_SELECTIONREMOVE,
+   if (mLastField != -1) {
+      GetAccessible()->NotifyEvent(wxACC_EVENT_OBJECT_SELECTIONREMOVE,
                    this,
                    wxOBJID_CLIENT,
-                   mLastField );
+                   mLastField);
    }
 
    mLastField = mDigits[mFocusedDigit].field + 1;
 
-   GetAccessible()->NotifyEvent( wxACC_EVENT_OBJECT_FOCUS,
+   GetAccessible()->NotifyEvent(wxACC_EVENT_OBJECT_FOCUS,
                 this,
                 wxOBJID_CLIENT,
-                mLastField );
+                mLastField);
 
-   GetAccessible()->NotifyEvent( wxACC_EVENT_OBJECT_SELECTION,
+   GetAccessible()->NotifyEvent(wxACC_EVENT_OBJECT_SELECTION,
                 this,
                 wxOBJID_CLIENT,
-                mLastField );
+                mLastField);
 #endif
 }
 
@@ -1000,10 +1017,10 @@
    event.SetEventObject(this);
    GetEventHandler()->ProcessEvent(event);
 #if wxUSE_ACCESSIBILITY
-   GetAccessible()->NotifyEvent( wxACC_EVENT_OBJECT_VALUECHANGE,
-                                 this,
-                                 wxOBJID_CLIENT,
-                                 mDigits[ mFocusedDigit ].field + 1 );
+   GetAccessible()->NotifyEvent(wxACC_EVENT_OBJECT_VALUECHANGE,
+                                this,
+                                wxOBJID_CLIENT,
+                                mDigits[ mFocusedDigit ].field + 1);
 #endif
 }
 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to