Update of /cvsroot/audacity/audacity-src/src
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27462
Modified Files:
Menus.cpp Project.cpp Project.h
Log Message:
Fix recursion problem wxGTK caused by wxClipboard and a remove a few
warnings.
Index: Project.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Project.h,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -d -r1.153 -r1.154
--- Project.h 14 Apr 2009 05:25:32 -0000 1.153
+++ Project.h 1 Jun 2009 04:08:28 -0000 1.154
@@ -202,7 +202,7 @@
void OnMenuEvent(wxMenuEvent & event);
void OnMenu(wxCommandEvent & event);
- void OnUpdateMenus(wxUpdateUIEvent & event);
+ void OnUpdateUI(wxUpdateUIEvent & event);
void OnActivate(wxActivateEvent & event);
void OnMouseEvent(wxMouseEvent & event);
@@ -394,6 +394,10 @@
wxUint32 mLastFlags;
+ // see AudacityProject::OnUpdateUI() for explanation of next two
+ bool mInIdle;
+ wxUint32 mTextClipFlag;
+
// Window elements
wxTimer *mTimer;
Index: Project.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Project.cpp,v
retrieving revision 1.425
retrieving revision 1.426
diff -u -d -r1.425 -r1.426
--- Project.cpp 30 May 2009 20:35:39 -0000 1.425
+++ Project.cpp 1 Jun 2009 04:08:28 -0000 1.426
@@ -623,8 +623,8 @@
EVT_COMMAND_SCROLL(HSBarID, AudacityProject::OnScroll)
EVT_COMMAND_SCROLL(VSBarID, AudacityProject::OnScroll)
EVT_TIMER(AudacityProjectTimerID, AudacityProject::OnTimer)
- // Update menu method
- EVT_UPDATE_UI(1, AudacityProject::OnUpdateMenus)
+ // Fires for menu with ID #1...first menu defined
+ EVT_UPDATE_UI(1, AudacityProject::OnUpdateUI)
EVT_ICONIZE(AudacityProject::OnIconize)
EVT_COMMAND(wxID_ANY, EVT_OPEN_AUDIO_FILE,
AudacityProject::OnOpenAudioFile)
EVT_COMMAND(wxID_ANY, EVT_TOOLBAR_UPDATED,
AudacityProject::OnToolBarUpdate)
@@ -645,6 +645,8 @@
Read(wxT("/SamplingRate/DefaultProjectSampleFormat"), floatSample)),
mSnapTo(0),
mDirty(false),
+ mInIdle(false),
+ mTextClipFlag(0),
mTrackPanel(NULL),
mTrackFactory(NULL),
mAutoScrolling(false),
@@ -1606,10 +1608,21 @@
event.Skip(true);
}
-//TODO: This function is still kinda hackish, clean up
-void AudacityProject::OnUpdateMenus(wxUpdateUIEvent & event)
+void AudacityProject::OnUpdateUI(wxUpdateUIEvent & event)
{
+ // As of wxGTK 2.8.9, there is a problem in the wxClipboard class that
+ // allows recursive event processing. This problem has been corrected
+ // by wxWidgets changeset #45180. However, this han't made it into a
+ // release yet, so we have to work around it.
+ //
+ // This is done by only checking the wxClipboard contents during an idle
+ // event, thus preventing possible recursion during other event processing.
+ //
+ mInIdle = true;
+
UpdateMenus();
+
+ mInIdle = false;
}
void AudacityProject::OnActivate(wxActivateEvent & event)
Index: Menus.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Menus.cpp,v
retrieving revision 1.484
retrieving revision 1.485
diff -u -d -r1.484 -r1.485
--- Menus.cpp 30 May 2009 19:54:12 -0000 1.484
+++ Menus.cpp 1 Jun 2009 04:08:28 -0000 1.485
@@ -329,7 +329,7 @@
AudioIONotBusyFlag | UndoAvailableFlag);
// The default shortcut key for Redo is different on different platforms.
- wxChar *key =
+ wxString key =
#ifdef __WXMSW__
wxT("Ctrl+Y");
#else
@@ -726,7 +726,7 @@
effects = em.GetEffects(INSERT_EFFECT | BUILTIN_EFFECT);
if (effects->GetCount()) {
names.Clear();
- for (int i = 0; i < effects->GetCount(); i++) {
+ for (size_t i = 0; i < effects->GetCount(); i++) {
names.Add((*effects)[i]->GetEffectName());
}
c->AddItemList(wxT("Generate"), names, FN(OnGenerateEffect));
@@ -737,7 +737,7 @@
if (effects->GetCount()) {
c->AddSeparator();
names.Clear();
- for (int i = 0; i < effects->GetCount(); i++) {
+ for (size_t i = 0; i < effects->GetCount(); i++) {
names.Add((*effects)[i]->GetEffectName());
}
c->AddItemList(wxT("GeneratePlugin"), names, FN(OnGeneratePlugin),
true);
@@ -806,7 +806,7 @@
effects = em.GetEffects(PROCESS_EFFECT | BUILTIN_EFFECT |
additionalEffects);
if (effects->GetCount()) {
names.Clear();
- for (int i = 0; i < effects->GetCount(); i++) {
+ for (size_t i = 0; i < effects->GetCount(); i++) {
names.Add((*effects)[i]->GetEffectName());
}
c->AddItemList(wxT("Effect"), names, FN(OnProcessEffect));
@@ -818,7 +818,7 @@
if (effects->GetCount()) {
c->AddSeparator();
names.Clear();
- for (int i = 0; i < effects->GetCount(); i++) {
+ for (size_t i = 0; i < effects->GetCount(); i++) {
names.Add((*effects)[i]->GetEffectName());
}
c->AddItemList(wxT("EffectPlugin"), names, FN(OnProcessPlugin), true);
@@ -883,7 +883,7 @@
effects = em.GetEffects(ANALYZE_EFFECT | BUILTIN_EFFECT);
if (effects->GetCount()) {
names.Clear();
- for (int i = 0; i < effects->GetCount(); i++) {
+ for (size_t i = 0; i < effects->GetCount(); i++) {
names.Add((*effects)[i]->GetEffectName());
}
c->AddItemList(wxT("Analyze"), names, FN(OnAnalyzeEffect));
@@ -894,7 +894,7 @@
if (effects->GetCount()) {
c->AddSeparator();
names.Clear();
- for (int i = 0; i < effects->GetCount(); i++) {
+ for (size_t i = 0; i < effects->GetCount(); i++) {
names.Add((*effects)[i]->GetEffectName());
}
c->AddItemList(wxT("AnalyzePlugin"), names, FN(OnAnalyzePlugin),
true);
@@ -1339,8 +1339,18 @@
flags |= CutCopyAvailableFlag;
}
- if (lt->IsTextClipSupported()) {
- flags |= TextClipFlag;
+ // See AudacityProject::OnUpdateUI() for an explanation
+ if (mInIdle) {
+ if (lt->IsTextClipSupported()) {
+ flags |= TextClipFlag;
+ mTextClipFlag = TextClipFlag;
+ }
+ else {
+ mTextClipFlag = 0;
+ }
+ }
+ else {
+ flags |= mTextClipFlag;
}
}
else if (t->GetKind() == Track::Wave) {
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs