bool CDialogVolumes::_CurrentVolumeModified()
{
  bool bRtn = false;
  if((m_pVolumeCurrent != NULL) &&
    (m_pPanelLab != NULL) &&
    (!m_bReadOnly) &&
    (!m_pPanelLab->IsReadOnly()) )
  {
    m_pPanelLab->TransferDataFromWindow();
    CLabSettings *pLab(m_pVolumeCurrent->GetLabSettings());
    bRtn = (*pLab) != m_labCopy;
  }
  return bRtn;
}
Пример #2
0
bool CDialogVolumes::_CurrentVolumeModified()
{
    bool bRtn = false;
    {
        CMessageSuppressor xxx;
        bRtn = !TransferDataFromWindow();
    }
    if(!bRtn)
    {
        CLabSettings *pLab(m_pVolumeCurrent->GetLabSettings());
        bRtn = (*pLab) != m_labCopy;
    }
    return bRtn;
}
bool CDialogVolumes::_SetVolume(/*bool bFit*/)
{
  bool bRtn = true;
  bool bReadOnly = false;
  CVolume *pHold = m_pVolumeCurrent;
  if(m_sSelection.IsEmpty())
  {
    m_sSelection = m_pChoice->GetStringSelection();
  }
  m_pVolumeCurrent = m_volumes.Find(m_sSelection);
  if(m_pVolumeCurrent == NULL)
  {
    bRtn = _ResetVolume(pHold);
  }
  else if(m_pVolumeCurrent == pHold)
  {} // do nothing
  else
  {
    CLabSettings *pLab(m_pVolumeCurrent->GetLabSettings());
    m_labCopy = *pLab;
    bReadOnly = 
      m_bReadOnly || !m_pVolumeCurrent->Lock();
    bool bOK = m_pPanelLab->SetupAll(m_pVolumeCurrent);
    if(!bOK)
    {
      bRtn = _ResetVolume(pHold);
    }
    else
    {
      if(!m_bReadOnly && (pHold != NULL) && !pHold->IsNewVolume())
      {
        // do not release lock on new volumes until window is closed

        pHold->ReleaseLock();
      }
      _EnableRenameRemove(!bReadOnly);
      m_pPanelLab->Layout();
      bool bIsShown = IsShown();
      wxSize szSave;
      if(bIsShown)
      {
        // purpose of this is to not change the width of the window
        // when calling Fit()
        //
        // need to allow the height to increate because otherwise
        // the thresholds table will have scrollbars
        // even if the height does not change automatically
        //
        //  if Fit() is NOT called, then
        //  the scrollbars will not appear on the tables 
        //  even if needed
        //    scrollbar fix is below nwxGrid::ForceRefreshAll
        //    the following is probably not needed

        szSave = GetSize();
        SetMinSize(szSave); // do not allow height to decrease

        // sz.SetHeight(-1); // allow height to increase - 12/19/11 do not
        SetMaxSize(szSave); 
        Layout();
      }
      else
      {
        m_pPanelLab->Fit();
        Fit();
      }
      Refresh();
      if(bIsShown)
      {
        SetMinSize(wxDefaultSize);
        SetMaxSize(wxDefaultSize);
        // scrollbars were not showing in tables, so the following was added
        // the code above is probably not needed.
        nwxGrid::ForceRefreshAll(this);
      }
    }
  }
  return bRtn;
}