Audacity  2.2.2
Macros | Functions
DeviceToolBar.cpp File Reference
#include "../Audacity.h"
#include "DeviceToolBar.h"
#include <wx/wxprec.h>
#include <wx/choice.h>
#include <wx/event.h>
#include <wx/intl.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbmp.h>
#include <wx/tooltip.h>
#include "ToolDock.h"
#include "../TrackPanel.h"
#include "../AColor.h"
#include "../AllThemeResources.h"
#include "../AudioIO.h"
#include "../ImageManipulation.h"
#include "../Prefs.h"
#include "../Project.h"
#include "../ShuttleGui.h"
#include "../Theme.h"
#include "../widgets/Grabber.h"
#include "../DeviceManager.h"
#include "../widgets/ErrorDialog.h"

Go to the source code of this file.

Macros

#define kHostWidthRatio   0.13f
 
#define kInputWidthRatio   0.32f
 
#define kOutputWidthRatio   0.32f
 
#define kChannelsWidthRatio   0.18f
 

Functions

 IMPLEMENT_CLASS (DeviceToolBar, ToolBar)
 
static bool RepositionCombo (wxWindow *combo, int toolbarWidth, wxSize desiredSize, float &ratio, float &flex, int marginPixels, bool changesRatio)
 

Macro Definition Documentation

#define kChannelsWidthRatio   0.18f

Definition at line 406 of file DeviceToolBar.cpp.

Referenced by DeviceToolBar::RepositionCombos().

#define kHostWidthRatio   0.13f

Definition at line 403 of file DeviceToolBar.cpp.

Referenced by DeviceToolBar::RepositionCombos().

#define kInputWidthRatio   0.32f

Definition at line 404 of file DeviceToolBar.cpp.

Referenced by DeviceToolBar::RepositionCombos().

#define kOutputWidthRatio   0.32f

Definition at line 405 of file DeviceToolBar.cpp.

Referenced by DeviceToolBar::RepositionCombos().

Function Documentation

IMPLEMENT_CLASS ( DeviceToolBar  ,
ToolBar   
)
static bool RepositionCombo ( wxWindow *  combo,
int  toolbarWidth,
wxSize  desiredSize,
float &  ratio,
float &  flex,
int  marginPixels,
bool  changesRatio 
)
static

Definition at line 369 of file DeviceToolBar.cpp.

Referenced by DeviceToolBar::RepositionCombos().

371 {
372  float ratioChange;
373  bool constrained = false;
374 
375  // push margin pixels
376  desiredSize.x += marginPixels;
377 
378  // truncate the window size if necessary
379  if (desiredSize.x > toolbarWidth * (flex + ratio)) {
380  constrained = true;
381  desiredSize.SetWidth(toolbarWidth * (flex + ratio));
382  if (desiredSize.GetWidth() - marginPixels < 0)
383  desiredSize.SetWidth(marginPixels);
384  }
385 
386  // keep track of how much space gained or lost so it can be used by other combos.
387  if (changesRatio) {
388  ratioChange = (desiredSize.x / ((float) toolbarWidth)) - ratio;
389  ratio += ratioChange;
390  flex -= ratioChange;
391  }
392 
393  // pop the margin pixels
394  desiredSize.x -= marginPixels;
395 
396  combo->SetMinSize(desiredSize);
397 
398  return constrained;
399 }