Ejemplo n.º 1
0
void BookmarkView::rangeSelection(BookmarkRangeEntryPtr re) {
    
    clearButtons();
    
    hideProps();
    
    m_labelText->SetValue(re->label);
    
    m_labelText->Show();
    m_labelLabel->Show();

    m_frequencyVal->Show();
    m_frequencyLabel->Show();

    std::string strFreq = frequencyToStr(re->startFreq) + "-" + frequencyToStr(re->endFreq);
    
    m_frequencyVal->SetLabelText(wxString(strFreq));
    
    showProps();

    addButton(m_buttonPanel, "Go to Range", wxCommandEventHandler( BookmarkView::onActivateRange ));
    addButton(m_buttonPanel, "Update Range", wxCommandEventHandler( BookmarkView::onUpdateRange ))->SetToolTip("Update range by setting it to the active range.");
    addButton(m_buttonPanel, "Remove Range", wxCommandEventHandler( BookmarkView::onRemoveRange ));
    
    showButtons();
    refreshLayout();
}
Ejemplo n.º 2
0
void BookmarkView::recentSelection(BookmarkEntryPtr bmSel) {
    
    m_frequencyVal->SetLabelText(frequencyToStr(bmSel->frequency));
    m_bandwidthVal->SetLabelText(frequencyToStr(bmSel->bandwidth));
    m_modulationVal->SetLabelText(bmSel->type);
    m_labelText->SetValue(bmSel->label);
    
    hideProps();
    
    m_frequencyVal->Show();
    m_frequencyLabel->Show();
    
    m_bandwidthVal->Show();
    m_bandwidthLabel->Show();
    
    m_modulationVal->Show();
    m_modulationLabel->Show();
    
    m_labelText->Show();
    m_labelLabel->Show();
    
    clearButtons();
    
    addBookmarkChoice(m_buttonPanel);
    addButton(m_buttonPanel, "Activate Recent", wxCommandEventHandler( BookmarkView::onActivateRecent ));
    addButton(m_buttonPanel, "Remove Recent", wxCommandEventHandler( BookmarkView::onRemoveRecent ));
    
    showProps();
    showButtons();
    refreshLayout();
}
Ejemplo n.º 3
0
void BookmarkView::activeSelection(DemodulatorInstancePtr dsel) {
   
    if (dsel == nullptr) {
        hideProps();
        clearButtons();
        showProps();
        showButtons();
        refreshLayout();
        return;
    }

    m_frequencyVal->SetLabelText(frequencyToStr(dsel->getFrequency()));
    m_bandwidthVal->SetLabelText(frequencyToStr(dsel->getBandwidth()));
    m_modulationVal->SetLabelText(dsel->getDemodulatorType());
    m_labelText->SetValue(dsel->getDemodulatorUserLabel());
    
    hideProps();
    
    m_frequencyVal->Show();
    m_frequencyLabel->Show();
    
    m_bandwidthVal->Show();
    m_bandwidthLabel->Show();
    
    m_modulationVal->Show();
    m_modulationLabel->Show();
    
    m_labelText->Show();
    m_labelLabel->Show();
    
    clearButtons();

    addBookmarkChoice(m_buttonPanel);
    
    if (!(dsel->isRecording())) {
         addButton(m_buttonPanel, "Start Recording", wxCommandEventHandler(BookmarkView::onStartRecording));
     } else {
         addButton(m_buttonPanel, "Stop Recording", wxCommandEventHandler(BookmarkView::onStopRecording));
     }
   
    addButton(m_buttonPanel, "Remove Active", wxCommandEventHandler( BookmarkView::onRemoveActive ));
    
    showProps();
    showButtons();
    refreshLayout();
}
Ejemplo n.º 4
0
void BookmarkView::rangeBranchSelection() {
    clearButtons();
    hideProps();
    
    m_labelText->SetValue(wxT(""));
    m_labelText->Show();
    m_labelLabel->Show();

    showProps();

    addButton(m_buttonPanel, "Add Active Range", wxCommandEventHandler( BookmarkView::onAddRange ));
    
    showButtons();
    refreshLayout();
    
    this->Layout();
}
Ejemplo n.º 5
0
void BookmarkView::groupSelection(std::string groupName) {
    
    clearButtons();
    
    hideProps();
    
    m_labelText->SetValue(groupName);
    
    m_labelText->Show();
    m_labelLabel->Show();
    
    addButton(m_buttonPanel, "Remove Group", wxCommandEventHandler( BookmarkView::onRemoveGroup ));
    
    showProps();
    
    showButtons();
    refreshLayout();
}
void DesignerEventHandler::onContextMenu(QContextMenuEvent * e)
{
  QMenu * menu = new QMenu(parentWidget);

  QAction * copy_action     = menu->addAction(tr("Copy"), this, SLOT(onCopy()));
  menu->addAction(tr("Paste"), this, SLOT(onPaste()));
  QAction * delete_action   = menu->addAction(tr("Delete"), this, SLOT(onDelete()));
  QAction * delete_with_s_action   = menu->addAction(tr("Delete with sourcers"), this, SLOT(onDeleteWithSourcers()));
  QMenu* go = menu->addMenu(tr("Geometry operations"));
  go->addAction(tr("Align left") , this, SLOT(onAlignLeft()));
  go->addAction(tr("Align top")  , this, SLOT(onAlignTop()));
  go->addAction(tr("Align right"), this, SLOT(onAlignRight()));
  go->addAction(tr("Align bottom"),this, SLOT(onAlignBottom()));
  go->addAction(tr("Align vertical"),this, SLOT(onAlignVertical()));
  go->addAction(tr("Align horisontal"), this, SLOT (onAlignHorizontal()) );
  go->addAction(tr("Queue x"), this, SLOT (onQuequeX()) );
  go->addAction(tr("Queue y"), this, SLOT (onQuequeY()) );
  go->insertSeparator();
  go->addAction(tr("Same width"), this, SLOT(onSameWidth()));
  go->addAction(tr("Same height"), this, SLOT(onSameHeight()));
  QMenu* popupWindows = menu->addMenu(tr("Popup windows"));
  QMenu* leftButtonPW = popupWindows->addMenu(tr("Left button"));
  QAction * left_pw_add_action    = leftButtonPW->addAction( tr("Add"), this, SLOT(onLeftPwAdd()));
  QAction * left_pw_copy_action   = leftButtonPW->addAction( tr("Copy"), this, SLOT(onLeftPwCopy()));
  leftButtonPW->addAction( tr("Paste"), this, SLOT(onLeftPwPaste()));
  QAction * left_pw_delete_action = leftButtonPW->addAction( tr("Delete"), this, SLOT(onLeftDelete()));
  QMenu* rightButtonPW = popupWindows->addMenu (tr ("Right button"));
  QAction * right_pw_add_action    = rightButtonPW->addAction( tr("Add"), this, SLOT(onRightPwAdd()));
  QAction * right_pw_copy_action   = rightButtonPW->addAction( tr("Copy"), this, SLOT(onRightPwCopy()));
  rightButtonPW->addAction( tr("Paste"), this, SLOT(onRightPwPaste()));
  QAction * right_pw_delete_action = rightButtonPW->addAction( tr("Delete"), this, SLOT(onRightDelete()));

  QAction* show_properties_action = menu->addAction(tr("Properties"), this, SLOT(showProps()));
  QFont f = show_properties_action->font();
  f.setBold(true);
  show_properties_action->setFont(f);

  menu->addAction( tr("Export lists"), this, SLOT(onExportLists()) );
  //menu->insertSeparator();
  QMenu * predef = menu->addMenu ("Predef windows");
  QStringList names = PredefPw::Factory::availableNames();
  for (QStringList::iterator iter = names.begin(); iter != names.end(); ++iter ) {
    QAction * a = predef->addAction (*iter);
    //a->setMenu (predef);
    a->setData (12345);
  }
  
  menu->addAction ( "Find sourcer", this, SLOT (onFindSourcerByWidget() ) );
   
  if (selected_widgets.count( ) == 0 ){
    copy_action->setEnabled(false);
    delete_action->setEnabled(false);
    delete_with_s_action->setEnabled(false);
    go->setEnabled(false);
    popupWindows->setEnabled(false);
  }
  else {
    VtlWidget * w = (VtlWidget*)checkWidget(e->pos());
    if (w) {
      if (w->isLbPopupCreated()) {
        left_pw_add_action->setEnabled(false);
      }
      else {
        left_pw_copy_action->setEnabled(false);
        left_pw_delete_action->setEnabled(false);
      }
      if (w->isRbPopupCreated()) {
        right_pw_add_action->setEnabled(false);
      }
      else {
        right_pw_copy_action->setEnabled(false);
        right_pw_delete_action->setEnabled(false);
      }
    }
  }
  
  if ( context_widget )
    context_widget->prepareContextMenu (menu);
  
  if (e->state() & Qt::ControlModifier )
    control_modifier = true;
    
  QAction * a = menu->exec(e->globalPos());
  
  control_modifier = false;
  
  if ( a && a->data().toInt() == 12345 ) {
    QMessageBox box ( vtl::app );
    QAbstractButton * left_btn  = box.addButton ("Left" , QMessageBox::ActionRole );
    QAbstractButton * right_btn = box.addButton ("Right", QMessageBox::ActionRole );
    box.setWindowTitle ("Mouse button?");
    
    box.exec ();
    if ( box.clickedButton()     == left_btn ) {
      for (SWPtrList::iterator iter = selected_widgets.begin(); iter != selected_widgets.end(); ++iter )  {
         (*iter)->createLbPredefPw ( a->text() );
      }
    }
    else if (box.clickedButton() == right_btn ) {
      for (SWPtrList::iterator iter = selected_widgets.begin(); iter != selected_widgets.end(); ++iter )  {
         (*iter)->createRbPredefPw ( a->text() );
      }
    }
  }

  delete menu;
}