void ToolManager::Reset() { int ndx; // Disconnect all docked bars for( ndx = 0; ndx < ToolBarCount; ndx++ ) { wxWindow *parent; ToolDock *dock; ToolBar *bar = mBars[ ndx ]; // Disconnect the bar if( bar->IsDocked() ) { bar->GetDock()->Undock( bar ); parent = NULL; } else { parent = bar->GetParent(); } if( ndx == SelectionBarID ) { dock = mBotDock; wxCommandEvent e; bar->GetEventHandler()->ProcessEvent(e); } else { dock = mTopDock; bar->ReCreateButtons(); } bar->EnableDisableButtons(); #if 0 if( bar->IsResizable() ) { bar->SetSize(bar->GetBestFittingSize()); } #endif dock->Dock( bar ); Expose( ndx, ndx == DeviceBarID ? false : true ); if( parent ) { parent->Destroy(); } } LayoutToolBars(); Updated(); }
void TopWindow::Refresh() { if (!CheckResumeSurface()) /* the application is paused/suspended, and we don't have an OpenGL surface - ignore all drawing requests */ return; if (!invalidated.exchange(false, std::memory_order_relaxed)) return; Expose(); }
void ProgressBar::SetValue(unsigned value) { AssertNoneLocked(); AssertThread(); #ifndef USE_GDI this->value = value; Expose(); #else ::SendMessage(hWnd, PBM_SETPOS, value, 0); #endif }
void ProgressBar::SetStep(unsigned size) { AssertNoneLocked(); AssertThread(); #ifndef USE_GDI step_size = size; Expose(); #else ::SendMessage(hWnd, PBM_SETSTEP, (WPARAM)size, (LPARAM)0); #endif }
void ProgressBar::Step() { AssertNoneLocked(); AssertThread(); #ifndef USE_GDI value += step_size; Expose(); #else ::SendMessage(hWnd, PBM_STEPIT, (WPARAM)0, (LPARAM)0); #endif }
void TopWindow::Refresh() { if (!CheckResumeSurface()) /* the application is paused/suspended, and we don't have an OpenGL surface - ignore all drawing requests */ return; if (!invalidated) return; invalidated = false; Expose(); }
void RaytraceCopierNV_copy_image::Copy( AppData& app_data, RaytraceCopierNV_copy_image::Params& params, Raytracer& raytracer, unsigned tile ) { const unsigned w = app_data.cols(); const unsigned h = app_data.rows(); unsigned i = tile % w; unsigned j = tile / w; assert(j*h+i < w*h); j = h-j-1; unsigned x = app_data.tile*i; unsigned y = app_data.tile*j; assert(copy_func); ((PFNglXCopyImageSubDataNV)copy_func)( params.display, params.source_context, Expose(raytracer.rbo).Name(), GL_RENDERBUFFER, 0, x, y, 0, params.target_context, Expose(rt_target.tex).Name(), GL_TEXTURE_RECTANGLE, 0, x, y, 0, app_data.tile, app_data.tile, 1 ); OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(GetError)); }
void ProgressBar::SetRange(unsigned min_value, unsigned max_value) { AssertNoneLocked(); AssertThread(); #ifndef USE_GDI this->min_value = min_value; this->max_value = max_value; value = 0; step_size = 1; Expose(); #else ::SendMessage(hWnd, PBM_SETRANGE, (WPARAM)0, (LPARAM)MAKELPARAM(min_value, max_value)); #endif }
void TopWindow::refresh() { #ifdef ANDROID if (!CheckResumeSurface()) /* the application is paused/suspended, and we don't have an OpenGL surface - ignore all drawing requests */ return; #endif Invalidated_lock.Lock(); if (!Invalidated) { Invalidated_lock.Unlock(); return; } Invalidated = false; Invalidated_lock.Unlock(); Expose(); }
bool TopWindow::OnEvent(const SDL_Event &event) { switch (event.type) { Window *w; #if SDL_MAJOR_VERSION < 2 case SDL_VIDEOEXPOSE: invalidated = false; Expose(); return true; #endif case SDL_KEYDOWN: w = GetFocusedWindow(); if (w == nullptr) w = this; if (!w->IsEnabled()) return false; #if SDL_MAJOR_VERSION >= 2 return w->OnKeyDown(event.key.keysym.sym); #else return w->OnKeyDown(event.key.keysym.sym) || (event.key.keysym.unicode != 0 && w->OnCharacter(event.key.keysym.unicode)); #endif #if SDL_MAJOR_VERSION >= 2 case SDL_TEXTINPUT: w = GetFocusedWindow(); if (w == nullptr) w = this; if (!w->IsEnabled()) return false; if (event.text.text && *event.text.text) { std::pair<unsigned, const char *> next = NextUTF8(event.text.text); bool handled = w->OnCharacter(next.first); while (next.second) { next = NextUTF8(next.second); handled = w->OnCharacter(next.first) || handled; } return handled; } else return false; #endif case SDL_KEYUP: w = GetFocusedWindow(); if (w == nullptr) w = this; if (!w->IsEnabled()) return false; return w->OnKeyUp(event.key.keysym.sym); #ifdef HAVE_MULTI_TOUCH case SDL_FINGERDOWN: if (SDL_GetNumTouchFingers(event.tfinger.touchId) == 2) return OnMultiTouchDown(); else return false; case SDL_FINGERUP: if (SDL_GetNumTouchFingers(event.tfinger.touchId) == 1) return OnMultiTouchUp(); else return false; #endif case SDL_MOUSEMOTION: // XXX keys return OnMouseMove(event.motion.x, event.motion.y, 0); case SDL_MOUSEBUTTONDOWN: #if SDL_MAJOR_VERSION < 2 if (event.button.button == SDL_BUTTON_WHEELUP) return OnMouseWheel(event.button.x, event.button.y, 1); else if (event.button.button == SDL_BUTTON_WHEELDOWN) return OnMouseWheel(event.button.x, event.button.y, -1); #endif return double_click.Check(RasterPoint(event.button.x, event.button.y)) ? OnMouseDouble(event.button.x, event.button.y) : OnMouseDown(event.button.x, event.button.y); case SDL_MOUSEBUTTONUP: #if SDL_MAJOR_VERSION < 2 if (event.button.button == SDL_BUTTON_WHEELUP || event.button.button == SDL_BUTTON_WHEELDOWN) /* the wheel has already been handled in SDL_MOUSEBUTTONDOWN */ return false; #endif double_click.Moved(RasterPoint(event.button.x, event.button.y)); return OnMouseUp(event.button.x, event.button.y); case SDL_QUIT: return OnClose(); #if SDL_MAJOR_VERSION < 2 case SDL_VIDEORESIZE: Resize(event.resize.w, event.resize.h); return true; #endif #if SDL_MAJOR_VERSION >= 2 case SDL_MOUSEWHEEL: int x, y; SDL_GetMouseState(&x, &y); return OnMouseWheel(x, y, event.wheel.y); case SDL_WINDOWEVENT: switch (event.window.event) { case SDL_WINDOWEVENT_RESIZED: Resize(event.window.data1, event.window.data2); return true; case SDL_WINDOWEVENT_RESTORED: case SDL_WINDOWEVENT_MOVED: case SDL_WINDOWEVENT_SHOWN: case SDL_WINDOWEVENT_MAXIMIZED: { SDL_Window* event_window = SDL_GetWindowFromID(event.window.windowID); if (event_window) { int w, h; SDL_GetWindowSize(event_window, &w, &h); if ((w >= 0) && (h >= 0)) { Resize(w, h); } } } return true; case SDL_WINDOWEVENT_EXPOSED: invalidated = false; Expose(); return true; } #endif } return false; }
bool TopWindow::OnEvent(const SDL_Event &event) { switch (event.type) { Window *w; #if SDL_MAJOR_VERSION < 2 case SDL_VIDEOEXPOSE: invalidated = false; Expose(); return true; #endif case SDL_KEYDOWN: w = GetFocusedWindow(); if (w == nullptr) w = this; if (!w->IsEnabled()) return false; #if SDL_MAJOR_VERSION >= 2 return w->OnKeyDown(event.key.keysym.sym); #else return w->OnKeyDown(event.key.keysym.sym) || (event.key.keysym.unicode != 0 && w->OnCharacter(event.key.keysym.unicode)); #endif #if SDL_MAJOR_VERSION >= 2 case SDL_TEXTINPUT: w = GetFocusedWindow(); if (w == nullptr) w = this; if (!w->IsEnabled()) return false; if (*event.text.text) { std::pair<unsigned, const char *> next = NextUTF8(event.text.text); bool handled = w->OnCharacter(next.first); while (next.second) { next = NextUTF8(next.second); handled = w->OnCharacter(next.first) || handled; } return handled; } else return false; #endif case SDL_KEYUP: w = GetFocusedWindow(); if (w == nullptr) w = this; if (!w->IsEnabled()) return false; return w->OnKeyUp(event.key.keysym.sym); #ifdef HAVE_MULTI_TOUCH case SDL_FINGERDOWN: if (SDL_GetNumTouchFingers(event.tfinger.touchId) == 2) return OnMultiTouchDown(); else return false; case SDL_FINGERUP: if (SDL_GetNumTouchFingers(event.tfinger.touchId) == 1) return OnMultiTouchUp(); else return false; #endif case SDL_MOUSEMOTION: // XXX keys #ifdef HAVE_HIGHDPI_SUPPORT { auto x = event.motion.x; auto y = event.motion.y; PointToReal(x, y); return OnMouseMove(x, y, 0); } #else return OnMouseMove(event.motion.x, event.motion.y, 0); #endif case SDL_MOUSEBUTTONDOWN: { #if SDL_MAJOR_VERSION < 2 if (event.button.button == SDL_BUTTON_WHEELUP) return OnMouseWheel(event.button.x, event.button.y, 1); else if (event.button.button == SDL_BUTTON_WHEELDOWN) return OnMouseWheel(event.button.x, event.button.y, -1); #endif #ifdef HAVE_HIGHDPI_SUPPORT auto x = event.button.x; auto y = event.button.y; PointToReal(x, y); return double_click.Check(RasterPoint(x, y)) ? OnMouseDouble(x, y) : OnMouseDown(x, y); #else return double_click.Check(RasterPoint(event.button.x, event.button.y)) ? OnMouseDouble(event.button.x, event.button.y) : OnMouseDown(event.button.x, event.button.y); #endif } case SDL_MOUSEBUTTONUP: { #if SDL_MAJOR_VERSION < 2 if (event.button.button == SDL_BUTTON_WHEELUP || event.button.button == SDL_BUTTON_WHEELDOWN) /* the wheel has already been handled in SDL_MOUSEBUTTONDOWN */ return false; #endif #ifdef HAVE_HIGHDPI_SUPPORT auto x = event.button.x; auto y = event.button.y; PointToReal(x, y); double_click.Moved(RasterPoint(x, y)); return OnMouseUp(x, y); #else double_click.Moved(RasterPoint(event.button.x, event.button.y)); return OnMouseUp(event.button.x, event.button.y); #endif } case SDL_QUIT: return OnClose(); #if SDL_MAJOR_VERSION < 2 case SDL_VIDEORESIZE: Resize(event.resize.w, event.resize.h); return true; #endif #if SDL_MAJOR_VERSION >= 2 case SDL_MOUSEWHEEL: { int x, y; SDL_GetMouseState(&x, &y); #ifdef HAVE_HIGHDPI_SUPPORT PointToReal(x, y); #endif return OnMouseWheel(x, y, event.wheel.y); } case SDL_WINDOWEVENT: switch (event.window.event) { case SDL_WINDOWEVENT_RESIZED: #ifndef HAVE_HIGHDPI_SUPPORT Resize(event.window.data1, event.window.data2); return true; #endif case SDL_WINDOWEVENT_RESTORED: case SDL_WINDOWEVENT_MOVED: case SDL_WINDOWEVENT_SHOWN: case SDL_WINDOWEVENT_MAXIMIZED: { SDL_Window* event_window = SDL_GetWindowFromID(event.window.windowID); if (event_window) { int w, h; SDL_GetWindowSize(event_window, &w, &h); if ((w >= 0) && (h >= 0)) { #ifdef HAVE_HIGHDPI_SUPPORT int real_w, real_h; SDL_GL_GetDrawableSize(event_window, &real_w, &real_h); point_to_real_x = static_cast<float>(real_w) / static_cast<float>(w); point_to_real_y = static_cast<float>(real_h) / static_cast<float>(h); Resize(real_w, real_h); #else Resize(w, h); #endif } #if defined(__MACOSX__) && __MACOSX__ SDL_SysWMinfo *wm_info = reinterpret_cast<SDL_SysWMinfo *>(alloca(sizeof(SDL_SysWMinfo))); SDL_VERSION(&wm_info->version); if ((SDL_GetWindowWMInfo(event_window, wm_info)) && (wm_info->subsystem == SDL_SYSWM_COCOA)) { [wm_info->info.cocoa.window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenPrimary]; } Invalidate(); #endif } } return true; case SDL_WINDOWEVENT_EXPOSED: invalidated = false; Expose(); return true; } #endif }
// The window contents should be repainted. void GraphicsWindow::OnExpose( Ill::Core::EventArgs& e ) { Expose( e ); }
bool TopWindow::OnEvent(const SDL_Event &event) { switch (event.type) { Window *w; case SDL_VIDEOEXPOSE: Invalidated_lock.Lock(); Invalidated = false; Invalidated_lock.Unlock(); Expose(); return true; case SDL_KEYDOWN: w = GetFocusedWindow(); if (w == NULL) w = this; if (!w->IsEnabled()) return false; return w->OnKeyDown(event.key.keysym.sym); case SDL_KEYUP: w = GetFocusedWindow(); if (w == NULL) w = this; if (!w->IsEnabled()) return false; return w->OnKeyUp(event.key.keysym.sym); case SDL_MOUSEMOTION: // XXX keys return OnMouseMove(event.motion.x, event.motion.y, 0); case SDL_MOUSEBUTTONDOWN: if (event.button.button == SDL_BUTTON_WHEELUP) return OnMouseWheel(event.button.x, event.button.y, 1); else if (event.button.button == SDL_BUTTON_WHEELDOWN) return OnMouseWheel(event.button.x, event.button.y, -1); return double_click.Check(RasterPoint{PixelScalar(event.button.x), PixelScalar(event.button.y)}) ? OnMouseDouble(event.button.x, event.button.y) : OnMouseDown(event.button.x, event.button.y); case SDL_MOUSEBUTTONUP: if (event.button.button == SDL_BUTTON_WHEELUP || event.button.button == SDL_BUTTON_WHEELDOWN) /* the wheel has already been handled in SDL_MOUSEBUTTONDOWN */ return false; double_click.Moved(RasterPoint{PixelScalar(event.button.x), PixelScalar(event.button.y)}); return OnMouseUp(event.button.x, event.button.y); case SDL_QUIT: return OnClose(); case SDL_VIDEORESIZE: Resize(event.resize.w, event.resize.h); return true; } return false; }
// // Read the toolbar states // void ToolManager::ReadConfig() { wxString oldpath = gPrefs->GetPath(); wxArrayInt unordered[ DockCount ]; bool show[ ToolBarCount ]; int width[ ToolBarCount ]; int height[ ToolBarCount ]; int x, y; int dock, ndx; bool someFound { false }; #if defined(__WXMAC__) // Disable window animation wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); #endif // Change to the bar root gPrefs->SetPath( wxT("/GUI/ToolBars") ); ToolBarConfiguration::Legacy topLegacy, botLegacy; // Load and apply settings for each bar for( ndx = 0; ndx < ToolBarCount; ndx++ ) { ToolBar *bar = mBars[ ndx ].get(); //wxPoint Center = mParent->GetPosition() + (mParent->GetSize() * 0.33); //wxPoint Center( // wxSystemSettings::GetMetric( wxSYS_SCREEN_X ) /2 , // wxSystemSettings::GetMetric( wxSYS_SCREEN_Y ) /2 ); // Change to the bar subkey gPrefs->SetPath( bar->GetSection() ); bool bShownByDefault = true; int defaultDock = TopDockID; if( ndx == SelectionBarID ) defaultDock = BotDockID; if( ndx == MeterBarID ) bShownByDefault = false; if( ndx == ScrubbingBarID ) bShownByDefault = false; #ifdef EXPERIMENTAL_SPECTRAL_EDITING if( ndx == SpectralSelectionBarID ){ defaultDock = BotDockID; bShownByDefault = false; // Only show if asked for. } #endif // Read in all the settings gPrefs->Read( wxT("Dock"), &dock, -1); const bool found = (dock != -1); if (found) someFound = true; if (!found) dock = defaultDock; ToolDock *d; ToolBarConfiguration::Legacy *pLegacy; switch(dock) { case TopDockID: d = mTopDock; pLegacy = &topLegacy; break; case BotDockID: d = mBotDock; pLegacy = &botLegacy; break; default: d = nullptr; pLegacy = nullptr; break; } bool ordered = ToolBarConfiguration::Read (d ? &d->GetConfiguration() : nullptr, pLegacy, bar, show[ ndx ], bShownByDefault) && found; gPrefs->Read( wxT("X"), &x, -1 ); gPrefs->Read( wxT("Y"), &y, -1 ); gPrefs->Read( wxT("W"), &width[ ndx ], -1 ); gPrefs->Read( wxT("H"), &height[ ndx ], -1 ); bar->SetVisible( show[ ndx ] ); // Docked or floating? if( dock ) { // Default to top dock if the ID isn't valid if( dock < NoDockID || dock > DockCount ) { dock = TopDockID; } // Create the bar with the correct parent if( dock == TopDockID ) { bar->Create( mTopDock ); } else { bar->Create( mBotDock ); } // Set the width and height if( width[ ndx ] != -1 && height[ ndx ] != -1 ) { wxSize sz( width[ ndx ], height[ ndx ] ); bar->SetSize( sz ); } #ifdef EXPERIMENTAL_SYNC_LOCK // Set the width if( width[ ndx ] >= bar->GetSize().x ) { wxSize sz( width[ ndx ], bar->GetSize().y ); bar->SetSize( sz ); bar->Layout(); } #else // note that this section is here because if you had been using sync-lock and now you aren't, // the space for the extra button is stored in audacity.cfg, and so you get an extra space // in the EditToolbar. // It is needed so that the meterToolbar size gets preserved. // Longer-term we should find a better fix for this. wxString thisBar = bar->GetSection(); if( thisBar != wxT("Edit")) { // Set the width if( width[ ndx ] >= bar->GetSize().x ) { wxSize sz( width[ ndx ], bar->GetSize().y ); bar->SetSize( sz ); bar->Layout(); } } #endif if (!ordered) { // These must go at the end unordered[ dock - 1 ].Add( ndx ); } } else { // Create the bar (with the top dock being temporary parent) bar->Create( mTopDock ); // Construct a NEW floater wxASSERT(mParent); ToolFrame *f = safenew ToolFrame( mParent, this, bar, wxPoint( x, y ) ); // Set the width and height if( width[ ndx ] != -1 && height[ ndx ] != -1 ) { wxSize sz( width[ ndx ], height[ ndx ] ); f->SetSizeHints( sz ); f->SetSize( sz ); f->Layout(); if( (x!=-1) && (y!=-1) ) bar->SetPositioned(); } // Required on Linux Xfce wxSize msz(width[ndx],height[ndx]-1); bar->GetParent()->SetMinSize(msz); // Inform toolbar of change bar->SetDocked( NULL, false ); // Show or hide it Expose( ndx, show[ ndx ] ); } // Change back to the bar root //gPrefs->SetPath( wxT("..") ); <-- Causes a warning... // May or may not have gone into a subdirectory, // so use an absolute path. gPrefs->SetPath( wxT("/GUI/ToolBars") ); } mTopDock->GetConfiguration().PostRead(topLegacy); mBotDock->GetConfiguration().PostRead(botLegacy); // Add all toolbars to their target dock for( dock = 0; dock < DockCount; dock++ ) { ToolDock *d = ( dock + 1 == TopDockID ? mTopDock : mBotDock ); d->LoadConfig(); // Add all unordered toolbars bool deviceWasPositioned = false; for( int ord = 0; ord < (int) unordered[ dock ].GetCount(); ord++ ) { ToolBar *t = mBars[ unordered[ dock ][ ord ] ].get(); if (deviceWasPositioned && t->GetType() == DeviceBarID) continue; if (someFound && t->GetType() == ScrubbingBarID) { // Special case code to put the NEW scrubbing toolbar where we // want it, when audacity.cfg is present from an older version ToolBar *lastRoot {}; // Change from the ideal configuration to the constrained one, // just as when dragging and dropping ToolBarConfiguration dummy; mTopDock->WrapConfiguration(dummy); // Start a NEW row with just the scrubbing toolbar auto &configuration = mTopDock->GetConfiguration(); for (const auto place : configuration) if (place.position.rightOf == nullptr) lastRoot = place.pTree->pBar; ToolBarConfiguration::Position position { nullptr, lastRoot, false }; mTopDock->Dock(t, false, position); // Reposition the device toolbar, if it was docked above, // right of scrubbing const auto deviceToolBar = mBars[ DeviceBarID ].get(); if (deviceToolBar->GetDock() == mTopDock) { deviceToolBar->GetDock()->Undock(deviceToolBar); position = { t, nullptr }; mTopDock->Dock(deviceToolBar, false, position); // Remember not to place the device toolbar again deviceWasPositioned = true; } Expose( t->GetId(), show[ t->GetId() ] ); continue; } // Dock it d->Dock( t, false ); // Show or hide the bar Expose( t->GetId(), show[ t->GetId() ] ); } } // Restore original config path gPrefs->SetPath( oldpath ); #if defined(__WXMAC__) // Reinstate original transition wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); #endif if (!someFound) Reset(); }
void ToolManager::Reset() { // Disconnect all docked bars for ( const auto &entry : DefaultConfigTable ) { int ndx = entry.barID; ToolBar *bar = mBars[ ndx ].get(); ToolBarConfiguration::Position position { (entry.rightOf == NoBarID) ? nullptr : mBars[ entry.rightOf ].get(), (entry.below == NoBarID) ? nullptr : mBars[ entry.below ].get() }; wxWindow *floater; ToolDock *dock; bool expose = true; // Disconnect the bar if( bar->IsDocked() ) { bar->GetDock()->Undock( bar ); floater = NULL; } else { floater = bar->GetParent(); } if (ndx == SelectionBarID #ifdef EXPERIMENTAL_SPECTRAL_EDITING || ndx == SpectralSelectionBarID #endif ) { dock = mBotDock; wxCommandEvent e; bar->GetEventHandler()->ProcessEvent(e); } else { dock = mTopDock; bar->ReCreateButtons(); } bar->EnableDisableButtons(); #if 0 if( bar->IsResizable() ) { bar->SetSize(bar->GetBestFittingSize()); } #endif if( ndx == MeterBarID #ifdef EXPERIMENTAL_SPECTRAL_EDITING || ndx == SpectralSelectionBarID #endif || ndx == ScrubbingBarID ) { expose = false; } if( dock != NULL ) { // when we dock, we reparent, so bar is no longer a child of floater. dock->Dock( bar, false, position ); Expose( ndx, expose ); //OK (and good) to DELETE floater, as bar is no longer in it. if( floater ) floater->Destroy(); } else { // The (tool)bar has a dragger window round it, the floater. // in turn floater will have mParent (the entire App) as its // parent. // Maybe construct a NEW floater // this happens if we have just been bounced out of a dock. if( floater == NULL ) { wxASSERT(mParent); floater = safenew ToolFrame( mParent, this, bar, wxPoint(-1,-1) ); bar->Reparent( floater ); } // This bar is undocked and invisible. // We are doing a reset toolbars, so even the invisible undocked bars should // be moved somewhere sensible. Put bar near center of window. // If there were multiple hidden toobars the ndx * 10 adjustment means // they won't overlap too much. floater->CentreOnParent( ); floater->Move( floater->GetPosition() + wxSize( ndx * 10 - 200, ndx * 10 )); bar->SetDocked( NULL, false ); Expose( ndx, false ); } } // TODO:?? // If audio was playing, we stopped the VU meters, // It would be nice to show them again, but hardly essential as // they will show up again on the next play. // SetVUMeters(AudacityProject *p); LayoutToolBars(); Updated(); }
// // Toggles the visible/hidden state of a toolbar // void ToolManager::ShowHide( int type ) { Expose( type, !mBars[ type ]->IsVisible() ); }
void Widget::Expose( sf::RenderTarget& target ) const { CullingTarget culling_target( target ); culling_target.Cull( false ); Expose( culling_target ); }
void ToolManager::Reset() { int ndx; // The mInputMeter and mOutputMeter may be in use if audio is playing // when this happens. gAudioIO->SetMeters( NULL, NULL ); // Disconnect all docked bars for( ndx = 0; ndx < ToolBarCount; ndx++ ) { wxWindow *parent; ToolDock *dock; ToolBar *bar = mBars[ ndx ]; // Disconnect the bar if( bar->IsDocked() ) { bar->GetDock()->Undock( bar ); parent = NULL; } else { parent = bar->GetParent(); } if( ndx == SelectionBarID ) { dock = mBotDock; wxCommandEvent e; bar->GetEventHandler()->ProcessEvent(e); } else { dock = mTopDock; bar->ReCreateButtons(); } bar->EnableDisableButtons(); #if 0 if( bar->IsResizable() ) { bar->SetSize(bar->GetBestFittingSize()); } #endif dock->Dock( bar ); Expose( ndx, true ); if( parent ) { parent->Destroy(); } } // TODO:?? // If audio was playing, we stopped the VU meters, // It would be nice to show them again, but hardly essential as // they will show up again on the next play. // SetVUMeters(AudacityProject *p); LayoutToolBars(); Updated(); }
bool TopWindow::OnEvent(const SDL_Event &event) { switch (event.type) { Window *w; #if SDL_MAJOR_VERSION < 2 case SDL_VIDEOEXPOSE: invalidated = false; Expose(); return true; #endif case SDL_KEYDOWN: w = GetFocusedWindow(); if (w == NULL) w = this; if (!w->IsEnabled()) return false; #if SDL_MAJOR_VERSION >= 2 return w->OnKeyDown(event.key.keysym.sym); #else return w->OnKeyDown(event.key.keysym.sym) || (event.key.keysym.unicode != 0 && w->OnCharacter(event.key.keysym.unicode)); #endif #if SDL_MAJOR_VERSION >= 2 case SDL_TEXTINPUT: w = GetFocusedWindow(); if (w == NULL) w = this; if (!w->IsEnabled()) return false; if (event.text.text && *event.text.text) { std::pair<unsigned, const char *> next = NextUTF8(event.text.text); bool handled = w->OnCharacter(next.first); while (next.second) { next = NextUTF8(next.second); handled = w->OnCharacter(next.first) || handled; } return handled; } else return false; #endif case SDL_KEYUP: w = GetFocusedWindow(); if (w == NULL) w = this; if (!w->IsEnabled()) return false; return w->OnKeyUp(event.key.keysym.sym); case SDL_MOUSEMOTION: // XXX keys return OnMouseMove(event.motion.x, event.motion.y, 0); case SDL_MOUSEBUTTONDOWN: #if SDL_MAJOR_VERSION < 2 if (event.button.button == SDL_BUTTON_WHEELUP) return OnMouseWheel(event.button.x, event.button.y, 1); else if (event.button.button == SDL_BUTTON_WHEELDOWN) return OnMouseWheel(event.button.x, event.button.y, -1); #endif return double_click.Check(RasterPoint(event.button.x, event.button.y)) ? OnMouseDouble(event.button.x, event.button.y) : OnMouseDown(event.button.x, event.button.y); case SDL_MOUSEBUTTONUP: #if SDL_MAJOR_VERSION < 2 if (event.button.button == SDL_BUTTON_WHEELUP || event.button.button == SDL_BUTTON_WHEELDOWN) /* the wheel has already been handled in SDL_MOUSEBUTTONDOWN */ return false; #endif double_click.Moved(RasterPoint(event.button.x, event.button.y)); return OnMouseUp(event.button.x, event.button.y); case SDL_QUIT: return OnClose(); #if SDL_MAJOR_VERSION < 2 case SDL_VIDEORESIZE: Resize(event.resize.w, event.resize.h); return true; #endif #if SDL_MAJOR_VERSION >= 2 case SDL_MOUSEWHEEL: int x, y; SDL_GetMouseState(&x, &y); return OnMouseWheel(x, y, event.wheel.y); case SDL_WINDOWEVENT: switch (event.window.event) { case SDL_WINDOWEVENT_RESIZED: Resize(event.window.data1, event.window.data2); return true; case SDL_WINDOWEVENT_EXPOSED: invalidated = false; Expose(); return true; } #endif } return false; }