Audacity  3.0.3
Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
NumericTextCtrl Class Referencefinal

#include <NumericTextCtrl.h>

Inheritance diagram for NumericTextCtrl:
[legend]
Collaboration diagram for NumericTextCtrl:
[legend]

Classes

struct  Options
 

Public Member Functions

 NumericTextCtrl (wxWindow *parent, wxWindowID winid, NumericConverter::Type type, const NumericFormatSymbol &formatName={}, double value=0.0, double sampleRate=44100, const Options &options={}, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
 
virtual ~NumericTextCtrl ()
 
void SetName (const TranslatableString &name)
 
wxSize ComputeSizing (bool update=true, wxCoord digitW=0, wxCoord digitH=0)
 
bool Layout () override
 
void Fit () override
 
void SetSampleRate (double sampleRate)
 
void SetValue (double newValue)
 
bool SetFormatString (const FormatStrings &formatString)
 
bool SetFormatName (const NumericFormatSymbol &formatName)
 
void SetFieldFocus (int)
 
wxSize GetDimensions ()
 
wxSize GetDigitSize ()
 
void SetDigitSize (int width, int height)
 
void SetReadOnly (bool readOnly=true)
 
void EnableMenu (bool enable=true)
 
void SetInvalidValue (double invalidValue)
 
int GetFocusedField ()
 
int GetFocusedDigit ()
 
- Public Member Functions inherited from NumericConverter
 NumericConverter (Type type, const NumericFormatSymbol &formatName={}, double value=0.0f, double sampleRate=1.0f)
 
 NumericConverter (const NumericConverter &)
 
virtual ~NumericConverter ()
 
virtual void ValueToControls (double rawValue, bool nearest=true)
 
void PrintDebugInfo ()
 
bool SetFormatName (const NumericFormatSymbol &formatName)
 
bool SetFormatString (const FormatStrings &formatString)
 
void SetSampleRate (double sampleRate)
 
void SetValue (double newValue)
 
void SetMinValue (double minValue)
 
void ResetMinValue ()
 
void SetMaxValue (double maxValue)
 
void ResetMaxValue ()
 
double GetValue ()
 
wxString GetString ()
 
int GetFormatIndex ()
 
int GetNumBuiltins ()
 
NumericFormatSymbol GetBuiltinName (const int index)
 
FormatStrings GetBuiltinFormat (const int index)
 
FormatStrings GetBuiltinFormat (const NumericFormatSymbol &name)
 
void Adjust (int steps, int dir)
 
void Increment ()
 
void Decrement ()
 

Private Member Functions

void OnCaptureKey (wxCommandEvent &event)
 
void OnKeyDown (wxKeyEvent &event)
 
void OnKeyUp (wxKeyEvent &event)
 
void OnMouse (wxMouseEvent &event)
 
void OnErase (wxEraseEvent &event)
 
void OnPaint (wxPaintEvent &event)
 
void OnFocus (wxFocusEvent &event)
 
void OnContext (wxContextMenuEvent &event)
 
void ValueToControls () override
 
void ControlsToValue () override
 
void UpdateAutoFocus ()
 
void Updated (bool keyup=false)
 

Private Attributes

bool mMenuEnabled
 
bool mReadOnly
 
std::unique_ptr< wxBitmap > mBackgroundBitmap
 
std::unique_ptr< wxFont > mDigitFont
 
std::unique_ptr< wxFont > mLabelFont
 
int mDigitBoxW
 
int mDigitBoxH
 
int mDigitW
 
int mDigitH
 
int mBorderLeft
 
int mBorderTop
 
int mBorderRight
 
int mBorderBottom
 
int mWidth
 
int mHeight
 
int mButtonWidth
 
int mLastField
 
bool mAutoPos
 
double mScrollRemainder
 
NumericConverter::Type mType
 
bool mAllowInvalidValue
 

Friends

class NumericTextCtrlAx
 

Additional Inherited Members

- Public Types inherited from NumericConverter
enum  Type { TIME, ATIME, FREQUENCY, BANDWIDTH }
 
- Static Public Member Functions inherited from NumericConverter
static NumericFormatSymbol DefaultSelectionFormat ()
 
static NumericFormatSymbol TimeAndSampleFormat ()
 
static NumericFormatSymbol SecondsFormat ()
 
static NumericFormatSymbol HoursMinsSecondsFormat ()
 
static NumericFormatSymbol HundredthsFormat ()
 
static NumericFormatSymbol HertzFormat ()
 
static NumericFormatSymbol LookupFormat (Type type, const wxString &id)
 
- Protected Attributes inherited from NumericConverter
Type mType
 
double mValue
 
double mMinValue
 
double mMaxValue
 
double mInvalidValue
 
FormatStrings mFormatString
 
std::vector< NumericFieldmFields
 
wxString mPrefix
 
wxString mValueTemplate
 
wxString mValueMask
 
wxString mValueString
 
double mScalingFactor
 
double mSampleRate
 
bool mNtscDrop
 
int mFocusedDigit
 
std::vector< DigitInfomDigits
 
const BuiltinFormatStringmBuiltinFormatStrings
 
const size_t mNBuiltins
 
int mDefaultNdx
 

Detailed Description

Definition at line 170 of file NumericTextCtrl.h.

Constructor & Destructor Documentation

◆ NumericTextCtrl()

NumericTextCtrl::NumericTextCtrl ( wxWindow *  parent,
wxWindowID  winid,
NumericConverter::Type  type,
const NumericFormatSymbol formatName = {},
double  value = 0.0,
double  sampleRate = 44100,
const Options options = {},
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize 
)

Definition at line 1355 of file NumericTextCtrl.cpp.

1362  :
1363  wxControl(parent, id, pos, size, wxSUNKEN_BORDER | wxWANTS_CHARS),
1364  NumericConverter(type, formatName, timeValue, sampleRate),
1366  mDigitFont{},
1367  mLabelFont{},
1368  mLastField(1),
1369  mAutoPos(options.autoPos)
1370  , mType(type)
1371 {
1372  mAllowInvalidValue = false;
1373 
1374  mDigitBoxW = 11;
1375  mDigitBoxH = 19;
1376 
1377  mBorderLeft = 1;
1378  mBorderTop = 1;
1379  mBorderRight = 1;
1380  mBorderBottom = 1;
1381 
1382  mReadOnly = options.readOnly;
1383  mMenuEnabled = options.menuEnabled;
1384  mButtonWidth = mMenuEnabled ? 9 : 0;
1385 
1386  SetLayoutDirection(wxLayout_LeftToRight);
1387  Layout();
1388  Fit();
1389  ValueToControls();
1390 
1391  //PRL -- would this fix the following?
1392  //ValueToControls();
1393 
1394  //mchinen - aug 15 09 - this seems to put the mValue back to zero, and do nothing else.
1395  //ControlsToValue();
1396 
1397  mScrollRemainder = 0.0;
1398 
1399 #if wxUSE_ACCESSIBILITY
1400  SetLabel(wxT(""));
1401  SetName( {} );
1402  SetAccessible(safenew NumericTextCtrlAx(this));
1403 #endif
1404 
1405  if (options.hasInvalidValue)
1406  SetInvalidValue( options.invalidValue );
1407 
1408  if (!options.format.formatStr.empty())
1409  SetFormatString( options.format );
1410 
1411  if (options.hasValue)
1412  SetValue( options.value );
1413 
1414 }

◆ ~NumericTextCtrl()

NumericTextCtrl::~NumericTextCtrl ( )
virtual

Definition at line 1416 of file NumericTextCtrl.cpp.

1417 {
1418 }

Member Function Documentation

◆ ComputeSizing()

wxSize NumericTextCtrl::ComputeSizing ( bool  update = true,
wxCoord  digitW = 0,
wxCoord  digitH = 0 
)

Definition at line 1519 of file NumericTextCtrl.cpp.

1520 {
1521  // Get current box size
1522  if (boxW == 0) {
1523  boxW = mDigitBoxW;
1524  }
1525 
1526  if (boxH == 0) {
1527  boxH = mDigitBoxH;
1528  }
1529  boxH -= (mBorderTop + mBorderBottom);
1530 
1531  // We can use the screen device context since we're not drawing to it
1532  wxScreenDC dc;
1533 
1534  // First calculate a rough point size
1535  wxFont pf(wxSize(boxW, boxH), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
1536  int fontSize = pf.GetPointSize();
1537  wxCoord strW;
1538  wxCoord strH;
1539 
1540  // Now decrease it until we fit within our digit box
1541  dc.SetFont(pf);
1542  dc.GetTextExtent(wxT("0"), &strW, &strH);
1543  while (strW > boxW || strH > boxH) {
1544  dc.SetFont(wxFont(--fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
1545  dc.GetTextExtent(wxT("0"), &strW, &strH);
1546  }
1547  fontSize--;
1548 
1549  // Create the digit font with the new point size
1550  if (update) {
1551  mDigitFont = std::make_unique<wxFont>(fontSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
1552  dc.SetFont(*mDigitFont);
1553 
1554  // Remember the actual digit width and height using the new font
1555  dc.GetTextExtent(wxT("0"), &mDigitW, &mDigitH);
1556  }
1557 
1558  // The label font should be a little smaller
1559  std::unique_ptr<wxFont> labelFont = std::make_unique<wxFont>(fontSize - 1, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
1560 
1561  // Use the label font for all remaining measurements since only non-digit text is left
1562  dc.SetFont(*labelFont);
1563 
1564  // Remember the pointer if updating
1565  if (update) {
1566  mLabelFont = std::move(labelFont);
1567  }
1568 
1569  // Get the width of the prefix, if any
1570  dc.GetTextExtent(mPrefix, &strW, &strH);
1571 
1572  // Bump x-position to the end of the prefix
1573  int x = mBorderLeft + strW;
1574 
1575  if (update) {
1576  // Set the character position past the prefix
1577  int pos = mPrefix.length();
1578 
1579  // Reset digits array
1580  mDigits.clear();
1581 
1582  // Figure out the x-position of each field and label in the box
1583  for (int i = 0, fcnt = mFields.size(); i < fcnt; ++i) {
1584  // Get the size of the label
1585  dc.GetTextExtent(mFields[i].label, &strW, &strH);
1586 
1587  // Remember this field's x-position
1588  mFields[i].fieldX = x;
1589 
1590  // Remember metrics for each digit
1591  for (int j = 0, dcnt = mFields[i].digits; j < dcnt; ++j) {
1592  mDigits.push_back(DigitInfo(i, j, pos, wxRect(x, mBorderTop, boxW, boxH)));
1593  x += boxW;
1594  pos++;
1595  }
1596 
1597  // Remember the label's x-position
1598  mFields[i].labelX = x;
1599 
1600  // Bump to end of label
1601  x += strW;
1602 
1603  // Remember the label's width
1604  mFields[i].fieldW = x;
1605 
1606  // Bump character position to end of label
1607  pos += mFields[i].label.length();
1608  }
1609  }
1610  else {
1611  // Determine the maximum x-position (length) of the remaining fields
1612  for (int i = 0, fcnt = mFields.size(); i < fcnt; ++i) {
1613  // Get the size of the label
1614  dc.GetTextExtent(mFields[i].label, &strW, &strH);
1615 
1616  // Just bump to next field
1617  x += (boxW * mFields[i].digits) + strW;
1618  }
1619  }
1620 
1621  // Calculate the maximum dimensions
1622  wxSize dim(x + mBorderRight, boxH + mBorderTop + mBorderBottom);
1623 
1624  // Save maximumFinally, calculate the minimum dimensions
1625  if (update) {
1626  mWidth = dim.x;
1627  mHeight = dim.y;
1628  }
1629 
1630  return wxSize(dim.x + mButtonWidth, dim.y);
1631 }

References label, mBorderBottom, mBorderLeft, mBorderRight, mBorderTop, mButtonWidth, mDigitBoxH, mDigitBoxW, mDigitFont, mDigitH, NumericConverter::mDigits, mDigitW, NumericConverter::mFields, mHeight, mLabelFont, NumericConverter::mPrefix, and mWidth.

Referenced by TimeToolBar::ComputeSizing(), and Layout().

Here is the caller graph for this function:

◆ ControlsToValue()

void NumericTextCtrl::ControlsToValue ( )
overrideprivatevirtual

Reimplemented from NumericConverter.

Definition at line 2112 of file NumericTextCtrl.cpp.

2113 {
2115 }

References NumericConverter::ControlsToValue().

Referenced by OnKeyDown(), SetFormatString(), SetSampleRate(), and SetValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnableMenu()

void NumericTextCtrl::EnableMenu ( bool  enable = true)

Definition at line 1492 of file NumericTextCtrl.cpp.

1493 {
1494 #if wxUSE_TOOLTIPS
1495  wxString tip(_("(Use context menu to change format.)"));
1496  if (enable)
1497  SetToolTip(tip);
1498  else {
1499  wxToolTip *tt = GetToolTip();
1500  if (tt && tt->GetTip() == tip)
1501  SetToolTip(NULL);
1502  }
1503 #endif
1504  mMenuEnabled = enable;
1505  mButtonWidth = enable ? 9 : 0;
1506  Layout();
1507  Fit();
1508 }

References _, Fit(), Layout(), mButtonWidth, and mMenuEnabled.

Here is the call graph for this function:

◆ Fit()

void NumericTextCtrl::Fit ( )
override

Definition at line 1690 of file NumericTextCtrl.cpp.

1691 {
1692  wxSize sz = GetSize();
1693  wxSize csz = GetClientSize();
1694 
1695  sz.x = mButtonWidth + mWidth + (sz.x - csz.x);
1696  sz.y = mHeight + (sz.y - csz.y);
1697 
1698  SetInitialSize(sz);
1699 }

References mButtonWidth, mHeight, and mWidth.

Referenced by EnableMenu(), SetDigitSize(), SetFormatString(), and SetSampleRate().

Here is the caller graph for this function:

◆ GetDigitSize()

wxSize NumericTextCtrl::GetDigitSize ( )
inline

Definition at line 232 of file NumericTextCtrl.h.

232 { return wxSize(mDigitBoxW, mDigitBoxH); }

Referenced by TimeToolBar::OnSize(), and TimeToolBar::Populate().

Here is the caller graph for this function:

◆ GetDimensions()

wxSize NumericTextCtrl::GetDimensions ( )
inline

Definition at line 231 of file NumericTextCtrl.h.

231 { return wxSize(mWidth + mButtonWidth, mHeight); }

Referenced by TimeToolBar::OnSize().

Here is the caller graph for this function:

◆ GetFocusedDigit()

int NumericTextCtrl::GetFocusedDigit ( )
inline

Definition at line 244 of file NumericTextCtrl.h.

244 { return mFocusedDigit; }

References NumericConverter::mFocusedDigit.

◆ GetFocusedField()

int NumericTextCtrl::GetFocusedField ( )
inline

Definition at line 243 of file NumericTextCtrl.h.

243 { return mLastField; }

◆ Layout()

bool NumericTextCtrl::Layout ( )
override

Definition at line 1633 of file NumericTextCtrl.cpp.

1634 {
1635  ComputeSizing();
1636 
1637  wxMemoryDC memDC;
1638  wxCoord strW, strH;
1639  memDC.SetFont(*mLabelFont);
1640  memDC.GetTextExtent(mPrefix, &strW, &strH);
1641 
1642  int i;
1643 
1644  // Draw the background bitmap - it contains black boxes where
1645  // all of the digits go and all of the other text
1646 
1647  wxBrush Brush;
1648 
1649  mBackgroundBitmap = std::make_unique<wxBitmap>(mWidth + mButtonWidth, mHeight,24);
1650  memDC.SelectObject(*mBackgroundBitmap);
1651 
1652  theTheme.SetBrushColour( Brush, clrTimeHours );
1653  memDC.SetBrush(Brush);
1654  memDC.SetPen(*wxTRANSPARENT_PEN);
1655  memDC.DrawRectangle(0, 0, mWidth + mButtonWidth, mHeight);
1656 
1657  int numberBottom = mBorderTop + (mDigitBoxH - mDigitH)/2 + mDigitH;
1658 
1659  memDC.GetTextExtent(wxT("0"), &strW, &strH);
1660  int labelTop = numberBottom - strH;
1661 
1662  memDC.SetTextForeground(theTheme.Colour( clrTimeFont ));
1663  memDC.SetTextBackground(theTheme.Colour( clrTimeBack ));
1664  memDC.DrawText(mPrefix, mBorderLeft, labelTop);
1665 
1666  theTheme.SetBrushColour( Brush, clrTimeBack );
1667  memDC.SetBrush(Brush);
1668  //memDC.SetBrush(*wxLIGHT_GREY_BRUSH);
1669  for(i = 0; i < mDigits.size(); i++)
1670  memDC.DrawRectangle(mDigits[i].digitBox);
1671  memDC.SetBrush( wxNullBrush );
1672 
1673  for(i = 0; i < mFields.size(); i++)
1674  memDC.DrawText(mFields[i].label,
1675  mFields[i].labelX, labelTop);
1676 
1677  if (mMenuEnabled) {
1678  wxRect r(mWidth, 0, mButtonWidth - 1, mHeight - 1);
1679  AColor::Bevel(memDC, true, r);
1680  memDC.SetBrush(*wxBLACK_BRUSH);
1681  memDC.SetPen(*wxBLACK_PEN);
1682  AColor::Arrow(memDC,
1683  mWidth + 1,
1684  (mHeight / 2) - 2,
1685  mButtonWidth - 2);
1686  }
1687  return true;
1688 }

References AColor::Arrow(), AColor::Bevel(), ThemeBase::Colour(), ComputeSizing(), mBackgroundBitmap, mBorderLeft, mBorderTop, mButtonWidth, mDigitBoxH, mDigitH, NumericConverter::mDigits, NumericConverter::mFields, mHeight, mLabelFont, mMenuEnabled, NumericConverter::mPrefix, mWidth, ThemeBase::SetBrushColour(), and theTheme.

Referenced by EnableMenu(), SetDigitSize(), SetFormatString(), and SetSampleRate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnCaptureKey()

void NumericTextCtrl::OnCaptureKey ( wxCommandEvent &  event)
private

Definition at line 1861 of file NumericTextCtrl.cpp.

1862 {
1863  wxKeyEvent *kevent = (wxKeyEvent *)event.GetEventObject();
1864  int keyCode = kevent->GetKeyCode();
1865 
1866  // Convert numeric keypad entries.
1867  if ((keyCode >= WXK_NUMPAD0) && (keyCode <= WXK_NUMPAD9))
1868  keyCode -= WXK_NUMPAD0 - '0';
1869 
1870  switch (keyCode)
1871  {
1872  case WXK_BACK:
1873  case WXK_LEFT:
1874  case WXK_RIGHT:
1875  case WXK_HOME:
1876  case WXK_END:
1877  case WXK_UP:
1878  case WXK_DOWN:
1879  case WXK_TAB:
1880  case WXK_RETURN:
1881  case WXK_NUMPAD_ENTER:
1882  case WXK_DELETE:
1883  return;
1884 
1885  default:
1886  if (keyCode >= '0' && keyCode <= '9' && !kevent->HasAnyModifiers())
1887  return;
1888  }
1889 
1890  event.Skip();
1891 
1892  return;
1893 }

◆ OnContext()

void NumericTextCtrl::OnContext ( wxContextMenuEvent &  event)
private

Definition at line 1753 of file NumericTextCtrl.cpp.

1754 {
1755  wxMenu menu;
1756  int i;
1757 
1758  if (!mMenuEnabled) {
1759  event.Skip();
1760  return;
1761  }
1762 
1763  SetFocus();
1764 
1765  int currentSelection = -1;
1766  for (i = 0; i < GetNumBuiltins(); i++) {
1767  menu.AppendRadioItem(ID_MENU + i, GetBuiltinName(i).Translation());
1768  if (mFormatString == GetBuiltinFormat(i)) {
1769  menu.Check(ID_MENU + i, true);
1770  currentSelection = i;
1771  }
1772  }
1773 
1774  PopupMenu(&menu, wxPoint(0, 0));
1775 
1776  // This used to be in an EVT_MENU() event handler, but GTK
1777  // is sensitive to what is done within the handler if the
1778  // user happens to check the first menuitem and then is
1779  // moving down the menu when the ...CTRL_UPDATED event
1780  // handler kicks in.
1781  for (i = 0; i < GetNumBuiltins(); i++) {
1782  if (menu.IsChecked(ID_MENU + i) && i != currentSelection) {
1784 
1785  int eventType = 0;
1786  switch (mType) {
1788  eventType = EVT_TIMETEXTCTRL_UPDATED;
1789  break;
1791  eventType = EVT_FREQUENCYTEXTCTRL_UPDATED;
1792  break;
1794  eventType = EVT_BANDWIDTHTEXTCTRL_UPDATED;
1795  break;
1796  default:
1797  wxASSERT(false);
1798  break;
1799  }
1800 
1801  wxCommandEvent e(eventType, GetId());
1802  e.SetInt(i);
1803  e.SetString(GetBuiltinName(i).Internal());
1804  GetParent()->GetEventHandler()->AddPendingEvent(e);
1805  }
1806  }
1807 
1808 }

References NumericConverter::BANDWIDTH, NumericConverter::FREQUENCY, NumericConverter::GetBuiltinFormat(), NumericConverter::GetBuiltinName(), NumericConverter::GetNumBuiltins(), anonymous_namespace{wxWidgetsBasicUI.cpp}::GetParent(), ID_MENU, Internal, NumericConverter::mFormatString, mMenuEnabled, mType, SetFormatString(), NumericConverter::TIME, and ComponentInterfaceSymbol::Translation().

Referenced by OnMouse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnErase()

void NumericTextCtrl::OnErase ( wxEraseEvent &  event)
private

Definition at line 1701 of file NumericTextCtrl.cpp.

1702 {
1703  // Ignore it to prevent flashing
1704 }

◆ OnFocus()

void NumericTextCtrl::OnFocus ( wxFocusEvent &  event)
private

Definition at line 1850 of file NumericTextCtrl.cpp.

1851 {
1852  KeyboardCapture::OnFocus( *this, event );
1853 
1854  if (event.GetEventType() != wxEVT_KILL_FOCUS &&
1855  mFocusedDigit <= 0 )
1856  UpdateAutoFocus();
1857 
1858  event.Skip( false ); // PRL: not sure why, but preserving old behavior
1859 }

References NumericConverter::mFocusedDigit, KeyboardCapture::OnFocus(), and UpdateAutoFocus().

Here is the call graph for this function:

◆ OnKeyDown()

void NumericTextCtrl::OnKeyDown ( wxKeyEvent &  event)
private

Definition at line 1913 of file NumericTextCtrl.cpp.

1914 {
1915  if (mDigits.size() == 0)
1916  {
1917  mFocusedDigit = 0;
1918  return;
1919  }
1920 
1921  event.Skip(false);
1922 
1923  int keyCode = event.GetKeyCode();
1924  int digit = mFocusedDigit;
1925 
1926  if (mFocusedDigit < 0)
1927  mFocusedDigit = 0;
1928  if (mFocusedDigit >= (int)mDigits.size())
1929  mFocusedDigit = mDigits.size() - 1;
1930 
1931  // Convert numeric keypad entries.
1932  if ((keyCode >= WXK_NUMPAD0) && (keyCode <= WXK_NUMPAD9))
1933  keyCode -= WXK_NUMPAD0 - '0';
1934 
1935  if (!mReadOnly && (keyCode >= '0' && keyCode <= '9' && !event.HasAnyModifiers())) {
1936  int digitPosition = mDigits[mFocusedDigit].pos;
1937  if (mValueString[digitPosition] == wxChar('-')) {
1938  mValue = std::max(mMinValue, std::min(mMaxValue, 0.0));
1939  ValueToControls();
1940  // Beware relocation of the string
1941  digitPosition = mDigits[mFocusedDigit].pos;
1942  }
1943  mValueString[digitPosition] = wxChar(keyCode);
1944  ControlsToValue();
1945  Refresh();// Force an update of the control. [Bug 1497]
1946  ValueToControls();
1947  mFocusedDigit = (mFocusedDigit + 1) % (mDigits.size());
1948  Updated();
1949  }
1950 
1951  else if (!mReadOnly && keyCode == WXK_DELETE) {
1952  if (mAllowInvalidValue)
1954  }
1955 
1956  else if (!mReadOnly && keyCode == WXK_BACK) {
1957  // Moves left, replaces that char with '0', stays there...
1958  mFocusedDigit--;
1959  mFocusedDigit += mDigits.size();
1960  mFocusedDigit %= mDigits.size();
1961  wxString::reference theDigit = mValueString[mDigits[mFocusedDigit].pos];
1962  if (theDigit != wxChar('-'))
1963  theDigit = '0';
1964  ControlsToValue();
1965  Refresh();// Force an update of the control. [Bug 1497]
1966  ValueToControls();
1967  Updated();
1968  }
1969 
1970  else if (keyCode == WXK_LEFT) {
1971  mFocusedDigit--;
1972  mFocusedDigit += mDigits.size();
1973  mFocusedDigit %= mDigits.size();
1974  Refresh();
1975  }
1976 
1977  else if (keyCode == WXK_RIGHT) {
1978  mFocusedDigit++;
1979  mFocusedDigit %= mDigits.size();
1980  Refresh();
1981  }
1982 
1983  else if (keyCode == WXK_HOME) {
1984  mFocusedDigit = 0;
1985  Refresh();
1986  }
1987 
1988  else if (keyCode == WXK_END) {
1989  mFocusedDigit = mDigits.size() - 1;
1990  Refresh();
1991  }
1992 
1993  else if (!mReadOnly && keyCode == WXK_UP) {
1994  Adjust(1, 1);
1995  Updated();
1996  }
1997 
1998  else if (!mReadOnly && keyCode == WXK_DOWN) {
1999  Adjust(1, -1);
2000  Updated();
2001  }
2002 
2003  else if (keyCode == WXK_TAB) {
2004 #if defined(__WXMSW__)
2005  // Using Navigate() on Windows, rather than the following code causes
2006  // bug 1542
2007  wxWindow* parent = GetParent();
2008  wxNavigationKeyEvent nevent;
2009  nevent.SetWindowChange(event.ControlDown());
2010  nevent.SetDirection(!event.ShiftDown());
2011  nevent.SetEventObject(parent);
2012  nevent.SetCurrentFocus(parent);
2013  GetParent()->GetEventHandler()->ProcessEvent(nevent);
2014 #else
2015  Navigate(event.ShiftDown()
2016  ? wxNavigationKeyEvent::IsBackward
2017  : wxNavigationKeyEvent::IsForward);
2018 #endif
2019  }
2020 
2021  else if (keyCode == WXK_RETURN || keyCode == WXK_NUMPAD_ENTER) {
2022  wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
2023  wxWindow *def = tlw->GetDefaultItem();
2024  if (def && def->IsEnabled()) {
2025  wxCommandEvent cevent(wxEVT_COMMAND_BUTTON_CLICKED,
2026  def->GetId());
2027  cevent.SetEventObject( def );
2028  GetParent()->GetEventHandler()->ProcessEvent(cevent);
2029  }
2030  }
2031 
2032  else {
2033  event.Skip();
2034  return;
2035  }
2036 
2037  if (digit != mFocusedDigit) {
2039  }
2040 }

References NumericConverter::Adjust(), ControlsToValue(), anonymous_namespace{wxWidgetsBasicUI.cpp}::GetParent(), mAllowInvalidValue, NumericConverter::mDigits, NumericConverter::mFocusedDigit, min(), NumericConverter::mInvalidValue, NumericConverter::mMaxValue, NumericConverter::mMinValue, mReadOnly, NumericConverter::mValue, NumericConverter::mValueString, SetFieldFocus(), SetValue(), Updated(), and ValueToControls().

Here is the call graph for this function:

◆ OnKeyUp()

void NumericTextCtrl::OnKeyUp ( wxKeyEvent &  event)
private

Definition at line 1895 of file NumericTextCtrl.cpp.

1896 {
1897  int keyCode = event.GetKeyCode();
1898 
1899  event.Skip(true);
1900 
1901  if ((keyCode >= WXK_NUMPAD0) && (keyCode <= WXK_NUMPAD9))
1902  keyCode -= WXK_NUMPAD0 - '0';
1903 
1904  if ((keyCode >= '0' && keyCode <= '9' && !event.HasAnyModifiers()) ||
1905  (keyCode == WXK_DELETE) ||
1906  (keyCode == WXK_BACK) ||
1907  (keyCode == WXK_UP) ||
1908  (keyCode == WXK_DOWN)) {
1909  Updated(true);
1910  }
1911 }

References Updated().

Here is the call graph for this function:

◆ OnMouse()

void NumericTextCtrl::OnMouse ( wxMouseEvent &  event)
private

Definition at line 1810 of file NumericTextCtrl.cpp.

1811 {
1812  if (event.LeftDown() && event.GetX() >= mWidth) {
1813  wxContextMenuEvent e;
1814  OnContext(e);
1815  }
1816  else if (event.LeftDown()) {
1817  SetFocus();
1818 
1819  int bestDist = 9999;
1820  unsigned int i;
1821 
1822  mFocusedDigit = 0;
1823  for(i = 0; i < mDigits.size(); i++) {
1824  int dist = abs(event.m_x - (mDigits[i].digitBox.x +
1825  mDigits[i].digitBox.width/2));
1826  if (dist < bestDist) {
1827  mFocusedDigit = i;
1828  bestDist = dist;
1829  }
1830  }
1831 
1832  Refresh(false);
1833  }
1834  else if (event.RightDown() && mMenuEnabled) {
1835  wxContextMenuEvent e;
1836  OnContext(e);
1837  }
1838  else if(!mReadOnly && event.m_wheelRotation != 0 ) {
1839  double steps = event.m_wheelRotation /
1840  (event.m_wheelDelta > 0 ? (double)event.m_wheelDelta : 120.0) +
1842  mScrollRemainder = steps - floor(steps);
1843  steps = floor(steps);
1844 
1845  Adjust((int)fabs(steps), steps < 0.0 ? -1 : 1);
1846  Updated();
1847  }
1848 }

References NumericConverter::Adjust(), NumericConverter::mDigits, NumericConverter::mFocusedDigit, mMenuEnabled, mReadOnly, mScrollRemainder, mWidth, OnContext(), and Updated().

Here is the call graph for this function:

◆ OnPaint()

void NumericTextCtrl::OnPaint ( wxPaintEvent &  event)
private

Definition at line 1706 of file NumericTextCtrl.cpp.

1707 {
1708  wxBufferedPaintDC dc(this);
1709  bool focused = (FindFocus() == this);
1710 
1711  dc.DrawBitmap(*mBackgroundBitmap, 0, 0);
1712 
1713  wxPen Pen;
1714  wxBrush Brush;
1715  if (focused) {
1716  theTheme.SetPenColour( Pen, clrTimeFontFocus );
1717  dc.SetPen(Pen);
1718  dc.SetBrush(*wxTRANSPARENT_BRUSH);
1719  dc.DrawRectangle(0, 0, mWidth, mHeight);
1720  dc.SetPen( wxNullPen );
1721  }
1722 
1723  dc.SetFont(*mDigitFont);
1724  dc.SetTextForeground(theTheme.Colour( clrTimeFont ));
1725  dc.SetTextBackground(theTheme.Colour( clrTimeBack ));
1726 
1727  dc.SetPen(*wxTRANSPARENT_PEN);
1728  theTheme.SetBrushColour( Brush , clrTimeBackFocus );
1729  dc.SetBrush( Brush );
1730 
1731  int i;
1732  for(i = 0; i < (int)mDigits.size(); i++) {
1733  wxRect box = mDigits[i].digitBox;
1734  if (focused && mFocusedDigit == i) {
1735  dc.DrawRectangle(box);
1736  dc.SetTextForeground(theTheme.Colour( clrTimeFontFocus ));
1737  dc.SetTextBackground(theTheme.Colour( clrTimeBackFocus ));
1738  }
1739  int pos = mDigits[i].pos;
1740  wxString digit = mValueString.Mid(pos, 1);
1741  int x = box.x + (mDigitBoxW - mDigitW)/2;
1742  int y = box.y + (mDigitBoxH - mDigitH)/2;
1743  dc.DrawText(digit, x, y);
1744  if (focused && mFocusedDigit == i) {
1745  dc.SetTextForeground(theTheme.Colour( clrTimeFont ));
1746  dc.SetTextBackground(theTheme.Colour( clrTimeBack ));
1747  }
1748  }
1749  dc.SetPen( wxNullPen );
1750  dc.SetBrush( wxNullBrush );
1751 }

References ThemeBase::Colour(), mBackgroundBitmap, mDigitBoxH, mDigitBoxW, mDigitFont, mDigitH, NumericConverter::mDigits, mDigitW, NumericConverter::mFocusedDigit, mHeight, NumericConverter::mValueString, mWidth, ThemeBase::SetBrushColour(), ThemeBase::SetPenColour(), and theTheme.

Here is the call graph for this function:

◆ SetDigitSize()

void NumericTextCtrl::SetDigitSize ( int  width,
int  height 
)

Definition at line 1479 of file NumericTextCtrl.cpp.

1480 {
1481  mDigitBoxW = width;
1482  mDigitBoxH = height;
1483  Layout();
1484  Fit();
1485 }

References Fit(), Layout(), mDigitBoxH, and mDigitBoxW.

Referenced by TimeToolBar::OnSize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetFieldFocus()

void NumericTextCtrl::SetFieldFocus ( int  digit)

Definition at line 2042 of file NumericTextCtrl.cpp.

2043 {
2044 #if wxUSE_ACCESSIBILITY
2045  if (mDigits.size() == 0)
2046  {
2047  mFocusedDigit = 0;
2048  return;
2049  }
2050  mFocusedDigit = digit;
2051  mLastField = mDigits[mFocusedDigit].field + 1;
2052 
2053  GetAccessible()->NotifyEvent(wxACC_EVENT_OBJECT_FOCUS,
2054  this,
2055  wxOBJID_CLIENT,
2056  mFocusedDigit + 1);
2057 #endif
2058 }

References NumericConverter::mDigits, NumericConverter::mFocusedDigit, and mLastField.

Referenced by OnKeyDown().

Here is the caller graph for this function:

◆ SetFormatName()

bool NumericTextCtrl::SetFormatName ( const NumericFormatSymbol formatName)

Definition at line 1443 of file NumericTextCtrl.cpp.

1444 {
1445  return
1446  SetFormatString(GetBuiltinFormat(formatName));
1447 }

References NumericConverter::GetBuiltinFormat(), and SetFormatString().

Referenced by EffectChangeSpeed::OnTimeCtrlUpdate(), EffectChangeSpeed::TransferDataToWindow(), and EffectChangeSpeed::Update_TimeCtrl_ToLength().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetFormatString()

bool NumericTextCtrl::SetFormatString ( const FormatStrings formatString)

Definition at line 1449 of file NumericTextCtrl.cpp.

1450 {
1451  auto result =
1452  NumericConverter::SetFormatString(formatString);
1453  if (result) {
1454  Layout();
1455  Fit();
1456  ValueToControls();
1457  ControlsToValue();
1458  UpdateAutoFocus();
1459  }
1460  return result;
1461 }

References ControlsToValue(), Fit(), Layout(), NumericConverter::SetFormatString(), UpdateAutoFocus(), and ValueToControls().

Referenced by OnContext(), TimeToolBar::SetAudioTimeFormat(), SetFormatName(), SelectionBar::SetSelectionFormat(), and TimeDialog::TransferDataToWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetInvalidValue()

void NumericTextCtrl::SetInvalidValue ( double  invalidValue)

Definition at line 1510 of file NumericTextCtrl.cpp.

1511 {
1512  const bool wasInvalid = mAllowInvalidValue && (mValue == mInvalidValue);
1513  mAllowInvalidValue = true;
1514  mInvalidValue = invalidValue;
1515  if (wasInvalid)
1516  SetValue(invalidValue);
1517 }

References mAllowInvalidValue, NumericConverter::mInvalidValue, NumericConverter::mValue, and SetValue().

Here is the call graph for this function:

◆ SetName()

void NumericTextCtrl::SetName ( const TranslatableString name)

Definition at line 1420 of file NumericTextCtrl.cpp.

1421 {
1422  wxControl::SetName( name.Translation() );
1423 }

References name, and TranslatableString::Translation().

Referenced by LV2Effect::BuildPlain(), VSTEffect::BuildPlain(), and TimeToolBar::Populate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetReadOnly()

void NumericTextCtrl::SetReadOnly ( bool  readOnly = true)

Definition at line 1487 of file NumericTextCtrl.cpp.

1488 {
1489  mReadOnly = readOnly;
1490 }

References mReadOnly.

Referenced by TimeToolBar::Populate().

Here is the caller graph for this function:

◆ SetSampleRate()

void NumericTextCtrl::SetSampleRate ( double  sampleRate)

Definition at line 1463 of file NumericTextCtrl.cpp.

1464 {
1465  NumericConverter::SetSampleRate(sampleRate);
1466  Layout();
1467  Fit();
1468  ValueToControls();
1469  ControlsToValue();
1470 }

References ControlsToValue(), Fit(), Layout(), NumericConverter::SetSampleRate(), and ValueToControls().

Referenced by TimeToolBar::OnRateChanged(), and TimeDialog::TransferDataToWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetValue()

void NumericTextCtrl::SetValue ( double  newValue)

◆ UpdateAutoFocus()

void NumericTextCtrl::UpdateAutoFocus ( )
private

Definition at line 1428 of file NumericTextCtrl.cpp.

1429 {
1430  if (!mAutoPos)
1431  return;
1432 
1433  mFocusedDigit = 0;
1434  while (mFocusedDigit < ((int)mDigits.size() - 1)) {
1435  wxChar dgt = mValueString[mDigits[mFocusedDigit].pos];
1436  if (dgt != '0') {
1437  break;
1438  }
1439  mFocusedDigit++;
1440  }
1441 }

References mAutoPos, NumericConverter::mDigits, NumericConverter::mFocusedDigit, and NumericConverter::mValueString.

Referenced by OnFocus(), and SetFormatString().

Here is the caller graph for this function:

◆ Updated()

void NumericTextCtrl::Updated ( bool  keyup = false)
private

Definition at line 2060 of file NumericTextCtrl.cpp.

2061 {
2062  wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
2063 
2064  // This will give listeners the ability to do tasks when the
2065  // update has been completed, like when the UP ARROW has been
2066  // held down and is finally released.
2067  event.SetInt(keyup);
2068  event.SetEventObject(this);
2069  GetEventHandler()->ProcessEvent(event);
2070 
2071 #if wxUSE_ACCESSIBILITY
2072  if (!keyup) {
2073  if (mDigits.size() == 0)
2074  {
2075  mFocusedDigit = 0;
2076  return;
2077  }
2078 
2079  // The object_focus event is only needed by Window-Eyes
2080  // and can be removed when we cease to support this screen reader.
2081  GetAccessible()->NotifyEvent(wxACC_EVENT_OBJECT_FOCUS,
2082  this,
2083  wxOBJID_CLIENT,
2084  mFocusedDigit + 1);
2085 
2086  GetAccessible()->NotifyEvent(wxACC_EVENT_OBJECT_NAMECHANGE,
2087  this,
2088  wxOBJID_CLIENT,
2089  mFocusedDigit + 1);
2090  }
2091 #endif
2092 }

References NumericConverter::mDigits, NumericConverter::mFocusedDigit, and wxEVT_COMMAND_TEXT_UPDATED.

Referenced by OnKeyDown(), OnKeyUp(), and OnMouse().

Here is the caller graph for this function:

◆ ValueToControls()

void NumericTextCtrl::ValueToControls ( )
overrideprivatevirtual

Reimplemented from NumericConverter.

Definition at line 2094 of file NumericTextCtrl.cpp.

2095 {
2096  const wxString previousValueString = mValueString;
2098  if (mValueString != previousValueString) {
2099  // Doing this only when needed is an optimization.
2100  // NumerixTextCtrls are used in the selection bar at the bottom
2101  // of Audacity, and are updated at high frequency through
2102  // SetValue() when Audacity is playing. This consumes a
2103  // significant amount of CPU. Typically, when a track is
2104  // playing, only one of the NumericTextCtrl actually changes
2105  // (the audio position). We save CPU by updating the control
2106  // only when needed.
2107  Refresh(false);
2108  }
2109 }

References NumericConverter::mValue, NumericConverter::mValueString, and NumericConverter::ValueToControls().

Referenced by OnKeyDown(), SetFormatString(), SetSampleRate(), and SetValue().

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ NumericTextCtrlAx

friend class NumericTextCtrlAx
friend

Definition at line 173 of file NumericTextCtrl.h.

Member Data Documentation

◆ mAllowInvalidValue

bool NumericTextCtrl::mAllowInvalidValue
private

Definition at line 298 of file NumericTextCtrl.h.

Referenced by OnKeyDown(), and SetInvalidValue().

◆ mAutoPos

bool NumericTextCtrl::mAutoPos
private

Definition at line 291 of file NumericTextCtrl.h.

Referenced by UpdateAutoFocus().

◆ mBackgroundBitmap

std::unique_ptr<wxBitmap> NumericTextCtrl::mBackgroundBitmap
private

Definition at line 273 of file NumericTextCtrl.h.

Referenced by Layout(), and OnPaint().

◆ mBorderBottom

int NumericTextCtrl::mBorderBottom
private

Definition at line 283 of file NumericTextCtrl.h.

Referenced by ComputeSizing().

◆ mBorderLeft

int NumericTextCtrl::mBorderLeft
private

Definition at line 280 of file NumericTextCtrl.h.

Referenced by ComputeSizing(), and Layout().

◆ mBorderRight

int NumericTextCtrl::mBorderRight
private

Definition at line 282 of file NumericTextCtrl.h.

Referenced by ComputeSizing().

◆ mBorderTop

int NumericTextCtrl::mBorderTop
private

Definition at line 281 of file NumericTextCtrl.h.

Referenced by ComputeSizing(), and Layout().

◆ mButtonWidth

int NumericTextCtrl::mButtonWidth
private

Definition at line 286 of file NumericTextCtrl.h.

Referenced by ComputeSizing(), EnableMenu(), Fit(), and Layout().

◆ mDigitBoxH

int NumericTextCtrl::mDigitBoxH
private

Definition at line 277 of file NumericTextCtrl.h.

Referenced by ComputeSizing(), Layout(), OnPaint(), and SetDigitSize().

◆ mDigitBoxW

int NumericTextCtrl::mDigitBoxW
private

Definition at line 276 of file NumericTextCtrl.h.

Referenced by ComputeSizing(), OnPaint(), and SetDigitSize().

◆ mDigitFont

std::unique_ptr<wxFont> NumericTextCtrl::mDigitFont
private

Definition at line 275 of file NumericTextCtrl.h.

Referenced by ComputeSizing(), and OnPaint().

◆ mDigitH

int NumericTextCtrl::mDigitH
private

Definition at line 279 of file NumericTextCtrl.h.

Referenced by ComputeSizing(), Layout(), and OnPaint().

◆ mDigitW

int NumericTextCtrl::mDigitW
private

Definition at line 278 of file NumericTextCtrl.h.

Referenced by ComputeSizing(), and OnPaint().

◆ mHeight

int NumericTextCtrl::mHeight
private

Definition at line 285 of file NumericTextCtrl.h.

Referenced by ComputeSizing(), Fit(), Layout(), and OnPaint().

◆ mLabelFont

std::unique_ptr<wxFont> NumericTextCtrl::mLabelFont
private

Definition at line 275 of file NumericTextCtrl.h.

Referenced by ComputeSizing(), and Layout().

◆ mLastField

int NumericTextCtrl::mLastField
private

Definition at line 288 of file NumericTextCtrl.h.

Referenced by SetFieldFocus().

◆ mMenuEnabled

bool NumericTextCtrl::mMenuEnabled
private

Definition at line 270 of file NumericTextCtrl.h.

Referenced by EnableMenu(), Layout(), OnContext(), and OnMouse().

◆ mReadOnly

bool NumericTextCtrl::mReadOnly
private

Definition at line 271 of file NumericTextCtrl.h.

Referenced by OnKeyDown(), OnMouse(), and SetReadOnly().

◆ mScrollRemainder

double NumericTextCtrl::mScrollRemainder
private

Definition at line 294 of file NumericTextCtrl.h.

Referenced by OnMouse().

◆ mType

NumericConverter::Type NumericTextCtrl::mType
private

Definition at line 296 of file NumericTextCtrl.h.

Referenced by OnContext().

◆ mWidth

int NumericTextCtrl::mWidth
private

Definition at line 284 of file NumericTextCtrl.h.

Referenced by ComputeSizing(), Fit(), Layout(), OnMouse(), and OnPaint().


The documentation for this class was generated from the following files:
NumericTextCtrl::Updated
void Updated(bool keyup=false)
Definition: NumericTextCtrl.cpp:2060
NumericConverter::SetFormatString
bool SetFormatString(const FormatStrings &formatString)
Definition: NumericTextCtrl.cpp:1115
DigitInfo
DigitInfo is a class used in NumericTextCtrl.
Definition: NumericTextCtrl.cpp:347
ComponentInterfaceSymbol::Translation
const wxString Translation() const
Definition: ComponentInterfaceSymbol.h:58
NumericTextCtrl::Fit
void Fit() override
Definition: NumericTextCtrl.cpp:1690
NumericTextCtrl::mLastField
int mLastField
Definition: NumericTextCtrl.h:288
NumericTextCtrl::SetFormatString
bool SetFormatString(const FormatStrings &formatString)
Definition: NumericTextCtrl.cpp:1449
NumericTextCtrl::mBorderTop
int mBorderTop
Definition: NumericTextCtrl.h:281
NumericTextCtrl::Layout
bool Layout() override
Definition: NumericTextCtrl.cpp:1633
NumericTextCtrl::SetName
void SetName(const TranslatableString &name)
Definition: NumericTextCtrl.cpp:1420
NumericConverter::mFields
std::vector< NumericField > mFields
Definition: NumericTextCtrl.h:151
NumericConverter::mValue
double mValue
Definition: NumericTextCtrl.h:143
NumericTextCtrl::mBorderBottom
int mBorderBottom
Definition: NumericTextCtrl.h:283
NumericTextCtrl::ComputeSizing
wxSize ComputeSizing(bool update=true, wxCoord digitW=0, wxCoord digitH=0)
Definition: NumericTextCtrl.cpp:1519
NumericTextCtrl::mBorderLeft
int mBorderLeft
Definition: NumericTextCtrl.h:280
NumericConverter::ValueToControls
virtual void ValueToControls()
Definition: NumericTextCtrl.cpp:947
NumericConverter::mDigits
std::vector< DigitInfo > mDigits
Definition: NumericTextCtrl.h:163
NumericTextCtrl::SetInvalidValue
void SetInvalidValue(double invalidValue)
Definition: NumericTextCtrl.cpp:1510
NumericTextCtrl::SetValue
void SetValue(double newValue)
Definition: NumericTextCtrl.cpp:1472
NumericConverter::mPrefix
wxString mPrefix
Definition: NumericTextCtrl.h:152
wxEVT_COMMAND_TEXT_UPDATED
wxEVT_COMMAND_TEXT_UPDATED
Definition: Nyquist.cpp:129
NumericConverter::BANDWIDTH
@ BANDWIDTH
Definition: NumericTextCtrl.h:55
NumericTextCtrl::mReadOnly
bool mReadOnly
Definition: NumericTextCtrl.h:271
NumericConverter::mInvalidValue
double mInvalidValue
Definition: NumericTextCtrl.h:147
NumericTextCtrl::mType
NumericConverter::Type mType
Definition: NumericTextCtrl.h:296
NumericTextCtrl::ValueToControls
void ValueToControls() override
Definition: NumericTextCtrl.cpp:2094
NumericTextCtrl::NumericTextCtrlAx
friend class NumericTextCtrlAx
Definition: NumericTextCtrl.h:173
NumericTextCtrl::UpdateAutoFocus
void UpdateAutoFocus()
Definition: NumericTextCtrl.cpp:1428
NumericTextCtrl::mWidth
int mWidth
Definition: NumericTextCtrl.h:284
NumericConverter::ControlsToValue
virtual void ControlsToValue()
Definition: NumericTextCtrl.cpp:1058
NumericConverter::GetBuiltinFormat
FormatStrings GetBuiltinFormat(const int index)
Definition: NumericTextCtrl.cpp:1207
NumericTextCtrl::mHeight
int mHeight
Definition: NumericTextCtrl.h:285
label
TranslatableString label
Definition: Tags.cpp:756
NumericTextCtrl::mDigitH
int mDigitH
Definition: NumericTextCtrl.h:279
NumericConverter::NumericConverter
NumericConverter(Type type, const NumericFormatSymbol &formatName={}, double value=0.0f, double sampleRate=1.0f)
Definition: NumericTextCtrl.cpp:720
NumericTextCtrl::mDigitBoxW
int mDigitBoxW
Definition: NumericTextCtrl.h:276
NumericTextCtrl::mDigitBoxH
int mDigitBoxH
Definition: NumericTextCtrl.h:277
NumericTextCtrl::OnContext
void OnContext(wxContextMenuEvent &event)
Definition: NumericTextCtrl.cpp:1753
NumericConverter::mMinValue
double mMinValue
Definition: NumericTextCtrl.h:145
name
const TranslatableString name
Definition: Distortion.cpp:98
ThemeBase::SetBrushColour
void SetBrushColour(wxBrush &Brush, int iIndex)
Definition: Theme.cpp:1204
NumericConverter::TIME
@ TIME
Definition: NumericTextCtrl.h:52
AColor::Arrow
static void Arrow(wxDC &dc, wxCoord x, wxCoord y, int width, bool down=true)
Definition: AColor.cpp:85
NumericTextCtrl::mMenuEnabled
bool mMenuEnabled
Definition: NumericTextCtrl.h:270
NumericConverter::GetNumBuiltins
int GetNumBuiltins()
Definition: NumericTextCtrl.cpp:1194
NumericConverter::mMaxValue
double mMaxValue
Definition: NumericTextCtrl.h:146
NumericConverter::FREQUENCY
@ FREQUENCY
Definition: NumericTextCtrl.h:54
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
NumericTextCtrl::mScrollRemainder
double mScrollRemainder
Definition: NumericTextCtrl.h:294
AColor::Bevel
static void Bevel(wxDC &dc, bool up, const wxRect &r)
Definition: AColor.cpp:191
NumericConverter::mFormatString
FormatStrings mFormatString
Definition: NumericTextCtrl.h:149
NumericTextCtrl::SetFieldFocus
void SetFieldFocus(int)
Definition: NumericTextCtrl.cpp:2042
NumericConverter::GetBuiltinName
NumericFormatSymbol GetBuiltinName(const int index)
Definition: NumericTextCtrl.cpp:1199
NumericTextCtrl::mLabelFont
std::unique_ptr< wxFont > mLabelFont
Definition: NumericTextCtrl.h:275
NumericConverter::SetValue
void SetValue(double newValue)
Definition: NumericTextCtrl.cpp:1136
_
#define _(s)
Definition: Internat.h:75
ID_MENU
#define ID_MENU
Definition: NumericTextCtrl.cpp:1333
NumericTextCtrl::mDigitFont
std::unique_ptr< wxFont > mDigitFont
Definition: NumericTextCtrl.h:275
NumericTextCtrl::mBackgroundBitmap
std::unique_ptr< wxBitmap > mBackgroundBitmap
Definition: NumericTextCtrl.h:273
KeyboardCapture::OnFocus
void OnFocus(wxWindow &window, wxFocusEvent &event)
a function useful to implement a focus event handler The window releases the keyboard if the event is...
Definition: KeyboardCapture.cpp:95
NumericConverter::Adjust
void Adjust(int steps, int dir)
Definition: NumericTextCtrl.cpp:1247
ExceptionType::Internal
@ Internal
Indicates internal failure from Audacity.
ThemeBase::Colour
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1197
NumericTextCtrl::ControlsToValue
void ControlsToValue() override
Definition: NumericTextCtrl.cpp:2112
NumericConverter::mFocusedDigit
int mFocusedDigit
Definition: NumericTextCtrl.h:162
theTheme
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:203
TranslatableString::Translation
wxString Translation() const
Definition: TranslatableString.h:79
NumericConverter::SetSampleRate
void SetSampleRate(double sampleRate)
Definition: NumericTextCtrl.cpp:1128
anonymous_namespace{wxWidgetsBasicUI.cpp}::GetParent
wxWindow * GetParent(const BasicUI::WindowPlacement &placement)
Definition: wxWidgetsBasicUI.cpp:39
NumericTextCtrl::mAllowInvalidValue
bool mAllowInvalidValue
Definition: NumericTextCtrl.h:298
safenew
#define safenew
Definition: MemoryX.h:10
NumericTextCtrl::mAutoPos
bool mAutoPos
Definition: NumericTextCtrl.h:291
NumericTextCtrl::mDigitW
int mDigitW
Definition: NumericTextCtrl.h:278
ThemeBase::SetPenColour
void SetPenColour(wxPen &Pen, int iIndex)
Definition: Theme.cpp:1210
NumericTextCtrl::mButtonWidth
int mButtonWidth
Definition: NumericTextCtrl.h:286
NumericConverter::mValueString
wxString mValueString
Definition: NumericTextCtrl.h:156
NumericTextCtrl::mBorderRight
int mBorderRight
Definition: NumericTextCtrl.h:282