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 418 of file DeviceToolBar.cpp.

Referenced by DeviceToolBar::RepositionCombos().

#define kHostWidthRatio   0.13f

Definition at line 415 of file DeviceToolBar.cpp.

Referenced by DeviceToolBar::RepositionCombos().

#define kInputWidthRatio   0.32f

Definition at line 416 of file DeviceToolBar.cpp.

Referenced by DeviceToolBar::RepositionCombos().

#define kOutputWidthRatio   0.32f

Definition at line 417 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 381 of file DeviceToolBar.cpp.

Referenced by DeviceToolBar::RepositionCombos().

383 {
384  float ratioChange;
385  bool constrained = false;
386 
387  // push margin pixels
388  desiredSize.x += marginPixels;
389 
390  // truncate the window size if necessary
391  if (desiredSize.x > toolbarWidth * (flex + ratio)) {
392  constrained = true;
393  desiredSize.SetWidth(toolbarWidth * (flex + ratio));
394  if (desiredSize.GetWidth() - marginPixels < 0)
395  desiredSize.SetWidth(marginPixels);
396  }
397 
398  // keep track of how much space gained or lost so it can be used by other combos.
399  if (changesRatio) {
400  ratioChange = (desiredSize.x / ((float) toolbarWidth)) - ratio;
401  ratio += ratioChange;
402  flex -= ratioChange;
403  }
404 
405  // pop the margin pixels
406  desiredSize.x -= marginPixels;
407 
408  combo->SetMinSize(desiredSize);
409 
410  return constrained;
411 }