Ejemplo n.º 1
0
void UserInterface::connected(bool connected)
{
    enableMenuItem(UserInterface::menuDisconnect, connected);
    enableMenuItem(UserInterface::menuRegister, !connected);

    if (!connected)
    {
        enableMenuItem(UserInterface::menuLogin, true);
        enableMenuItem(UserInterface::menuJoinChannel, false);
        enableMenuItem(UserInterface::menuChannels, false);
        channelsWindow_->hide();
        Fl::remove_timeout(checkAway);
    }
}
Ejemplo n.º 2
0
void CMainFrame::ajourMenuItems() {
  TextView    *view    = getActiveTextView();
  bool         hasView = view != NULL;
  CWinDiffDoc *doc     = getDoc();
  const Diff &diff     = doc->m_diff;

  if(!hasView) {
    enableMenuItem(this, ID_EDIT_COPY                     , false);
    enableMenuItem(this, ID_EDIT_SELECTALL                , false);

    enableToolbarButtonAndMenuItem(ID_EDIT_FIND           , false);
    enableToolbarButtonAndMenuItem(ID_EDIT_FIND_NEXT      , false);
    enableToolbarButtonAndMenuItem(ID_EDIT_FIND_PREV      , false);
    enableToolbarButtonAndMenuItem(ID_EDIT_PREV_DIFF      , false);

    enableMenuItem(this, ID_EDIT_GOTO                     , false);
    enableMenuItem(this, ID_EDIT_REFRESHFILES             , false);
    enableMenuItem(this, ID_VIEW_HIGHLIGHTCOMPAREEQUAL    , false);

    enableToolbarButtonAndMenuItem(ID_EDIT_NEXT_DIFF      , false);
    enableToolbarButtonAndMenuItem(ID_EDIT_SHOWDETAILS    , false);
    showStatusBarPanes(false);
  } else {
    const bool hasText = !diff.getDoc(view->getId()).isEmpty();

    enableMenuItem(this, ID_EDIT_COPY                     , !view->getSelectedRange().isEmpty());
    enableMenuItem(this, ID_EDIT_SELECTALL                , hasText);

    enableToolbarButtonAndMenuItem(ID_EDIT_FIND           , hasText);
    enableToolbarButtonAndMenuItem(ID_EDIT_FIND_NEXT      , hasText);
    enableToolbarButtonAndMenuItem(ID_EDIT_FIND_NEXT      , hasText);
    enableToolbarButtonAndMenuItem(ID_EDIT_FIND_PREV      , hasText);
    enableToolbarButtonAndMenuItem(ID_EDIT_FIND_PREV      , hasText);

    enableMenuItem(this, ID_EDIT_GOTO                     , hasText);
    enableMenuItem(this, ID_EDIT_REFRESHFILES             , diff.hasFileDoc());
    enableMenuItem(this, ID_VIEW_HIGHLIGHTCOMPAREEQUAL    , doc->m_filter.hasLineFilter());
    if(!doc->m_filter.hasLineFilter()) {
      checkMenuItem(this, ID_VIEW_HIGHLIGHTCOMPAREEQUAL, false);
    }
    enableToolbarButtonAndMenuItem( ID_EDIT_SHOWDETAILS   , !diff.isEmpty() && !diff.getDiffLines()[view->getCurrentLine()].linesAreEqual());
    enableToolbarButtonAndMenuItem( ID_EDIT_PREV_DIFF     , !diff.isEmpty() && (view->getCurrentLine() > diff.getFirstDiffLine()));
    enableToolbarButtonAndMenuItem( ID_EDIT_NEXT_DIFF     , !diff.isEmpty() && (view->getCurrentLine() < diff.getLastDiffLine()));

    showStatusBarPanes(!diff.isEmpty());
  }
  updateNameFontSizeMenuItems(getOptions().m_nameFontSizePct);
}
Ejemplo n.º 3
0
void UserInterface::loginResult(bool success, std::string const & info)
{
    enableMenuItem(UserInterface::menuLogin, !success);
    enableMenuItem(UserInterface::menuJoinChannel, success);
    enableMenuItem(UserInterface::menuChannels, success);

    if (success)
    {
        char * val;
        prefs().get(PrefAutoJoinChannels, val, "");
        autoJoinChannels(val);
        ::free(val);

        checkAway(this);
    }
}
Ejemplo n.º 4
0
void CShowGrafView::OnDraw(CDC *pDC) {
  try {
    if(m_firstDraw) {
      m_coordinateSystem.substituteControl(this, IDC_SYSTEMPANEL);
      m_firstDraw = false;
    }
    const CRect rect = getClientRect(this);

    if(paintAll(*pDC, rect, &m_axisFont, &m_buttonFont)) {
      DoubleInterval maxNormInterval(0,1);
      const DataRange dr = m_coordinateSystem.getDataRange();
      enableMenuItem(ID_VIEW_SCALE_X_LOGARITHMIC       , dr.getMinX() > 0);
      enableMenuItem(ID_VIEW_SCALE_Y_LOGARITHMIC       , dr.getMinY() > 0);
      enableMenuItem(ID_VIEW_SCALE_X_NORMALDIST        , maxNormInterval.contains(dr.getXInterval()));
      enableMenuItem(ID_VIEW_SCALE_Y_NORMALDIST        , maxNormInterval.contains(dr.getYInterval()));
      checkMenuItem( ID_VIEW_RETAINASPECTRATIO         , m_coordinateSystem.isRetainingAspectRatio());
      enableMenuItem(ID_VIEW_RETAINASPECTRATIO         , m_coordinateSystem.canRetainAspectRatio()  );
      checkMenuItem( ID_VIEW_ROLLAVG                   , getDoc()->getRollAvg()                     );
    }
  } catch(Exception e) {
    showException(e);
  }
}
Ejemplo n.º 5
0
void CMainFrame::enableToolbarButtonAndMenuItem(int id, bool enable) {
  CToolBarCtrl &ctrlBar = m_wndToolBar.GetToolBarCtrl();
  if(ctrlBar.m_hWnd) {
    if(enable != isToolbarButtonEnabled(id)) {
      if(enable) {
        ctrlBar.SetState(id, TBSTATE_ENABLED);
        ctrlBar.EnableButton(id, TRUE);
      } else {
        ctrlBar.SetState(id, TBSTATE_INDETERMINATE);
        ctrlBar.EnableButton(id, FALSE);
      }
    }
  }
  enableMenuItem(this, id, enable);
}