void TextFieldEditor::handleTextDomAreaKeyTyped       (KeyEventDetails* const details)
{
    if(details->getKey() == KeyEventDetails::KEY_ESCAPE)
    {
        cancelEditing();
        startEditing();
    }
}
/***************************************************************************\
 *                           Instance methods                              *
\***************************************************************************/
bool FieldEditorComponent::attachField(FieldContainer* fc, UInt32 fieldId, UInt32 index)
{
    //Cancel current editing
    cancelEditing();

    //Check that this is a valid FieldContainer
    if(fc == NULL)
    {
        SWARNING << "Cannot attach to a Null FieldContainer." << std::endl;
        return false;
    }

    //Check that this is a valid FieldId
    const FieldDescriptionBase* Desc(fc->getFieldDescription(fieldId));
    if(Desc == NULL)
    {
        SWARNING << "Cannot attach to field with id " << fieldId
                 << ", on a FieldContainer with type " << fc->getType().getCName()
                 << " because that is an invalid field id." << std::endl;
        return false;
    }
    //Check that this is a type to edit for this editor
    if(!isTypeEditable(Desc->getFieldType().getContentType()))
    {
        SWARNING << " Cannot attach to field " << Desc->getCName() 
                 << ", with content type " << Desc->getFieldType().getContentType().getCName()
                 << " because that content type is not supported by this editor type." << std::endl;
        return false;
    }

    //Check that this is a valid index
    GetFieldHandlePtr TheFieldHandle = fc->getField(fieldId);
    if(!TheFieldHandle.get())
    {
        SWARNING << "Cannot attach to field " << Desc->getCName() 
                 << ", on a FieldContainer with type " << fc->getType().getCName()
                 << " because no GetFieldHandle is defined for that field type." << std::endl;
        return false;
    }

    if(!internalAttachField(fc, fieldId, index))
    {
        return false;
    }

    //Attach to the field
    setEditingFC(fc);
    setEditingFieldId(fieldId);

    //Tell the Editor that the field has changed
    fieldChanged(fc, Desc->getFieldMask());

    //Attach to the Changed function callback for the container
    attachFieldCallback();

    return true;
}
bool FieldEditorComponent::dettachField(void)
{
    //Cancel current editing
    cancelEditing();

    //Dettach from the field
    setEditingFC(NULL);
    setEditingFieldId(0);

    //Dettach from the Changed function callback for the container
    dettachFieldCallback();

    return internalDettachField();
}
Exemple #4
0
void List::onEntryKeyPressed(Widget& widget, Key key, Action action, uint mods)
{
  if (action != PRESSED)
    return;

  switch (key)
  {
    case KEY_ENTER:
    {
      applyEditing();
      break;
    }

    case KEY_ESCAPE:
    {
      cancelEditing();
      break;
    }

    default:
      break;
  }
}
Exemple #5
0
void List::setEditable(bool newState)
{
  if (m_editable == newState)
    return;

  m_editable = newState;

  if (m_editable)
  {
    m_entry = new UI::Entry(layer());
    m_entry->hide();
    m_entry->focusChangedSignal().connect(*this, &List::onEntryFocusChanged);
    m_entry->keyPressedSignal().connect(*this, &List::onEntryKeyPressed);
    m_entry->destroyedSignal().connect(*this, &List::onEntryDestroyed);
    layer().addRootWidget(*m_entry);
  }
  else
  {
    cancelEditing();
    delete m_entry;
    m_entry = nullptr;
  }
}
// ******************************************************************************************
// Create the edit widget
// ******************************************************************************************
QWidget* VirtualJointsWidget::createEditWidget()
{
  // Main widget
  QWidget *edit_widget = new QWidget( this );
  // Layout
  QVBoxLayout *layout = new QVBoxLayout();


  // Simple form -------------------------------------------
  QFormLayout *form_layout = new QFormLayout();
  //form_layout->setContentsMargins( 0, 15, 0, 15 );
  form_layout->setRowWrapPolicy( QFormLayout::WrapAllRows );

  // Name input
  vjoint_name_field_ = new QLineEdit( this );
  form_layout->addRow( "Virtual Joint Name:", vjoint_name_field_ );

  // Child Link input
  child_link_field_ = new QComboBox( this );
  child_link_field_->setEditable( false );
  form_layout->addRow( "Child Link:", child_link_field_ );

  // Parent frame name input
  parent_name_field_ = new QLineEdit( this );
  form_layout->addRow( "Parent Frame Name:", parent_name_field_ );

  // Type input
  joint_type_field_ = new QComboBox( this );
  joint_type_field_->setEditable( false );
  loadJointTypesComboBox(); // only do this once
  //connect( joint_type_field_, SIGNAL( currentIndexChanged( const QString & ) ),
  //         this, SLOT( loadJoinSliders( const QString & ) ) );
  form_layout->addRow( "Joint Type:", joint_type_field_ );

  layout->addLayout( form_layout );

  // Bottom Buttons --------------------------------------------------

  QHBoxLayout *controls_layout = new QHBoxLayout();
  controls_layout->setContentsMargins( 0, 25, 0, 15 );

  // Spacer
  QWidget *spacer = new QWidget( this );
  spacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
  controls_layout->addWidget( spacer );

  // Save
  QPushButton *btn_save_ = new QPushButton( "&Save", this );
  btn_save_->setMaximumWidth( 200 );
  connect( btn_save_, SIGNAL(clicked()), this, SLOT( doneEditing() ) );
  controls_layout->addWidget( btn_save_ );
  controls_layout->setAlignment(btn_save_, Qt::AlignRight);

  // Cancel
  QPushButton *btn_cancel_ = new QPushButton( "&Cancel", this );
  btn_cancel_->setMaximumWidth( 200 );
  connect( btn_cancel_, SIGNAL(clicked()), this, SLOT( cancelEditing() ) );
  controls_layout->addWidget( btn_cancel_ );
  controls_layout->setAlignment(btn_cancel_, Qt::AlignRight);

  // Add layout
  layout->addLayout( controls_layout );


  // Set layout -----------------------------------------------------
  edit_widget->setLayout(layout);

  return edit_widget;
}
// ******************************************************************************************
// Constructor
// ******************************************************************************************
KinematicChainWidget::KinematicChainWidget( QWidget *parent, moveit_setup_assistant::MoveItConfigDataPtr config_data )
  :  QWidget( parent ), config_data_( config_data )
{
  // Basic widget container
  QVBoxLayout *layout = new QVBoxLayout( );

  // Label ------------------------------------------------
  title_ = new QLabel( "", this ); // specify the title from the parent widget
  QFont group_title_font( "Arial", 12, QFont::Bold );
  title_->setFont(group_title_font);
  layout->addWidget( title_ );

  // Create link tree ------------------------------------------------------
  link_tree_ = new QTreeWidget( this );
  link_tree_->setHeaderLabel( "Robot Links" );
  connect( link_tree_, SIGNAL( itemSelectionChanged() ), this, SLOT( itemSelected() ) );
  layout->addWidget( link_tree_ );

  // Create Grid Layout for form --------------------------------------------
  QGridLayout *form_grid = new QGridLayout();
  form_grid->setContentsMargins( 20, 20, 20, 20 ); // left top right bottom

  // Row 1: Base Link
  QLabel *base_link_label = new QLabel( "Base Link", this );
  form_grid->addWidget( base_link_label, 0, 0, Qt::AlignRight );

  base_link_field_ = new QLineEdit( this );
  base_link_field_->setMinimumWidth( 300 );
  form_grid->addWidget( base_link_field_, 0, 1, Qt::AlignLeft );

  QPushButton *btn_base_link = new QPushButton( "Choose Selected", this );
  connect( btn_base_link, SIGNAL( clicked() ), this, SLOT( baseLinkTreeClick() ));
  form_grid->addWidget( btn_base_link, 0, 2, Qt::AlignLeft );

  // Row 2: Tip Link
  QLabel *tip_link_label = new QLabel( "Tip Link", this );
  form_grid->addWidget( tip_link_label, 1, 0, Qt::AlignRight );

  tip_link_field_ = new QLineEdit( this );
  tip_link_field_->setMinimumWidth( 300 );
  form_grid->addWidget( tip_link_field_, 1, 1, Qt::AlignLeft );

  QPushButton *btn_tip_link = new QPushButton( "Choose Selected", this );
  connect( btn_tip_link, SIGNAL( clicked() ), this, SLOT( tipLinkTreeClick() ));
  form_grid->addWidget( btn_tip_link, 1, 2, Qt::AlignLeft );

  // Add form grid layout
  layout->addLayout( form_grid );

  // Bottom Controls ---------------------------------------------------------
  QHBoxLayout *controls_layout = new QHBoxLayout();

  // Expand/Contract controls
  QLabel *expand_controls = new QLabel( this );
  expand_controls->setText("<a href='expand'>Expand All</a> <a href='contract'>Collapse All</a>");
  connect( expand_controls, SIGNAL(linkActivated( const QString )), this, SLOT( alterTree( const QString )));
  controls_layout->addWidget( expand_controls );

  // Spacer
  QWidget *spacer = new QWidget( this );
  spacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
  controls_layout->addWidget( spacer );

  // Save
  QPushButton *btn_save = new QPushButton( "&Save", this );
  btn_save->setMaximumWidth( 200 );
  connect( btn_save, SIGNAL(clicked()), this, SIGNAL( doneEditing() ) );
  controls_layout->addWidget( btn_save );
  controls_layout->setAlignment(btn_save, Qt::AlignRight);

  // Cancel
  QPushButton *btn_cancel = new QPushButton( "&Cancel", this );
  btn_cancel->setMaximumWidth( 200 );
  connect( btn_cancel, SIGNAL(clicked()), this, SIGNAL( cancelEditing() ) );
  controls_layout->addWidget( btn_cancel );
  controls_layout->setAlignment(btn_cancel, Qt::AlignRight);

  // Add layout
  layout->addLayout( controls_layout );

  // Finish Layout --------------------------------------------------
  this->setLayout(layout);

  // Remember that we have no loaded the chains yet
  kinematic_chain_loaded_ = false;
}
Exemple #8
0
TextEditor::TextEditor(QWidget* parent)
   : QDialog(parent)
      {
      setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
      QVBoxLayout* vl = new QVBoxLayout;
      setLayout(vl);
      QFrame* f = new QFrame;
      QHBoxLayout* hl = new QHBoxLayout;
      hl->setSpacing(0);
      f->setLayout(hl);

      typefaceBold = new QToolButton;
      typefaceBold->setIcon(*icons[int(Icons::textBold_ICON)]);
      typefaceBold->setToolTip(tr("Bold"));
      typefaceBold->setCheckable(true);

      typefaceItalic = new QToolButton;
      typefaceItalic->setIcon(*icons[int(Icons::textItalic_ICON)]);
      typefaceItalic->setToolTip(tr("Italic"));
      typefaceItalic->setCheckable(true);

      typefaceUnderline = new QToolButton;
      typefaceUnderline->setIcon(*icons[int(Icons::textUnderline_ICON)]);
      typefaceUnderline->setToolTip(tr("Underline"));
      typefaceUnderline->setCheckable(true);

      leftAlign   = new QToolButton;
      leftAlign->setIcon(*icons[int(Icons::textLeft_ICON)]);
      leftAlign->setToolTip(tr("Align left"));
      leftAlign->setCheckable(true);

      centerAlign = new QToolButton;
      centerAlign->setIcon(*icons[int(Icons::textCenter_ICON)]);
      centerAlign->setToolTip(tr("Align center"));
      centerAlign->setCheckable(true);

      rightAlign  = new QToolButton;
      rightAlign->setIcon(*icons[int(Icons::textRight_ICON)]);
      rightAlign->setToolTip(tr("Align right"));
      rightAlign->setCheckable(true);

      typefaceSubscript = new QToolButton;
      typefaceSubscript->setIcon(*icons[int(Icons::textSub_ICON)]);
      typefaceSubscript->setToolTip(tr("Subscript"));
      typefaceSubscript->setCheckable(true);

      typefaceSuperscript = new QToolButton;
      typefaceSuperscript->setIcon(*icons[int(Icons::textSuper_ICON)]);
      typefaceSuperscript->setToolTip(tr("Superscript"));
      typefaceSuperscript->setCheckable(true);

      typefaceSize = new QDoubleSpinBox(this);
      typefaceSize->setRange(0.0, 100.0);
      typefaceFamily = new QFontComboBox(this);

      hl->addWidget(typefaceBold);
      hl->addWidget(typefaceItalic);
      hl->addWidget(typefaceUnderline);
      hl->addStretch(10);
      hl->addWidget(leftAlign);
      hl->addWidget(centerAlign);
      hl->addWidget(rightAlign);
      hl->addStretch(10);
      hl->addWidget(typefaceSubscript);
      hl->addWidget(typefaceSuperscript);
      hl->addStretch(10);
      hl->addWidget(typefaceFamily);
      hl->addWidget(typefaceSize);
      hl->addStretch(10);

      vl->addWidget(f);
      edit = new QTextEdit;
      vl->addWidget(edit);

      dialogButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
      vl->addWidget(dialogButtons);

      charFormatChanged(edit->currentCharFormat());
      cursorPositionChanged();

      connect(typefaceBold,        SIGNAL(clicked(bool)), SLOT(toggleBold(bool)));
      connect(typefaceItalic,      SIGNAL(clicked(bool)), SLOT(toggleItalic(bool)));
      connect(typefaceUnderline,   SIGNAL(clicked(bool)), SLOT(toggleUnderline(bool)));
      connect(leftAlign,           SIGNAL(clicked(bool)), SLOT(toggleLeftAlign(bool)));
      connect(centerAlign,         SIGNAL(clicked(bool)), SLOT(toggleCenterAlign(bool)));
      connect(rightAlign,          SIGNAL(clicked(bool)), SLOT(toggleRightAlign(bool)));
      connect(typefaceSubscript,   SIGNAL(clicked(bool)), SLOT(toggleTypefaceSubscript(bool)));
      connect(typefaceSuperscript, SIGNAL(clicked(bool)), SLOT(toggleTypefaceSuperscript(bool)));
      connect(edit, SIGNAL(currentCharFormatChanged(const QTextCharFormat&)), SLOT(charFormatChanged(const QTextCharFormat&)));
      connect(edit, SIGNAL(cursorPositionChanged()), SLOT(cursorPositionChanged()));
      connect(typefaceSize,        SIGNAL(valueChanged(double)), SLOT(sizeChanged(double)));
      connect(typefaceFamily,      SIGNAL(currentFontChanged(const QFont&)), SLOT(fontChanged(const QFont&)));
      connect(dialogButtons,       SIGNAL(accepted()), this, SLOT(okClicked()));
      connect(dialogButtons,       SIGNAL(rejected()), this, SLOT(cancelClicked()));
      connect(this,                SIGNAL(rejected()), SLOT(cancelEditing()));
      }
Exemple #9
0
void List::onEntryDestroyed(Widget& widget)
{
  cancelEditing();
  m_entry = nullptr;
}
// ******************************************************************************************
//
// ******************************************************************************************
GroupEditWidget::GroupEditWidget(QWidget* parent, const MoveItConfigDataPtr& config_data)
  : QWidget(parent), config_data_(config_data)
{
  // Basic widget container
  QVBoxLayout* layout = new QVBoxLayout();

  QGroupBox* group1 = new QGroupBox("Kinematics");
  QGroupBox* group2 = new QGroupBox("OMPL Planning");

  // Label ------------------------------------------------
  title_ = new QLabel(this);  // specify the title from the parent widget
  QFont group_title_font(QFont().defaultFamily(), 12, QFont::Bold);
  title_->setFont(group_title_font);
  layout->addWidget(title_);

  // Kinematic form -------------------------------------------
  QFormLayout* form_layout = new QFormLayout();
  form_layout->setContentsMargins(0, 12, 0, 12);

  // Name input
  group_name_field_ = new QLineEdit(this);
  group_name_field_->setMaximumWidth(400);
  form_layout->addRow("Group Name:", group_name_field_);

  // Kinematic solver
  kinematics_solver_field_ = new QComboBox(this);
  kinematics_solver_field_->setEditable(false);
  kinematics_solver_field_->setMaximumWidth(400);
  form_layout->addRow("Kinematic Solver:", kinematics_solver_field_);

  // resolution to use with solver
  kinematics_resolution_field_ = new QLineEdit(this);
  kinematics_resolution_field_->setMaximumWidth(400);
  form_layout->addRow("Kin. Search Resolution:", kinematics_resolution_field_);

  // resolution to use with solver
  kinematics_timeout_field_ = new QLineEdit(this);
  kinematics_timeout_field_->setMaximumWidth(400);
  form_layout->addRow("Kin. Search Timeout (sec):", kinematics_timeout_field_);

  group1->setLayout(form_layout);

  // OMPL Planner form --------------------------------------------

  QFormLayout* form_layout2 = new QFormLayout();
  form_layout2->setContentsMargins(0, 12, 0, 12);

  // Kinematic default planner
  default_planner_field_ = new QComboBox(this);
  default_planner_field_->setEditable(false);
  default_planner_field_->setMaximumWidth(400);
  form_layout2->addRow("Group Default Planner:", default_planner_field_);

  group2->setLayout(form_layout2);

  layout->addWidget(group1);
  layout->addWidget(group2);

  layout->setAlignment(Qt::AlignTop);

  // New Group Options  ---------------------------------------------------------
  new_buttons_widget_ = new QWidget();

  QVBoxLayout* new_buttons_layout_container = new QVBoxLayout();
  QHBoxLayout* label_layout = new QHBoxLayout();
  QHBoxLayout* recommended_options = new QHBoxLayout();
  QHBoxLayout* advanced_options = new QHBoxLayout();

  QLabel* save_and_add = new QLabel("Next, Add Components To Group:", this);
  QFont save_and_add_font(QFont().defaultFamily(), 12, QFont::Bold);
  save_and_add->setFont(save_and_add_font);
  label_layout->addWidget(save_and_add);

  // Recommended options
  QLabel* add_subtitle = new QLabel("Recommended: ", this);
  QFont add_subtitle_font(QFont().defaultFamily(), 10, QFont::Bold);
  add_subtitle->setFont(add_subtitle_font);
  recommended_options->addWidget(add_subtitle, 0, Qt::AlignLeft);

  // Save and add joints
  QPushButton* btn_save_joints = new QPushButton("Add Joints", this);
  btn_save_joints->setMaximumWidth(200);
  connect(btn_save_joints, SIGNAL(clicked()), this, SIGNAL(saveJoints()));
  recommended_options->addWidget(btn_save_joints);

  // Advanced options
  QLabel* add_subtitle2 = new QLabel("Advanced Options:", this);
  add_subtitle2->setFont(add_subtitle_font);
  advanced_options->addWidget(add_subtitle2, 0, Qt::AlignLeft);

  // Save and add links
  QPushButton* btn_save_links = new QPushButton("Add Links", this);
  btn_save_links->setMaximumWidth(200);
  connect(btn_save_links, SIGNAL(clicked()), this, SIGNAL(saveLinks()));
  advanced_options->addWidget(btn_save_links);

  // Save and add chain
  QPushButton* btn_save_chain = new QPushButton("Add Kin. Chain", this);
  btn_save_chain->setMaximumWidth(200);
  connect(btn_save_chain, SIGNAL(clicked()), this, SIGNAL(saveChain()));
  advanced_options->addWidget(btn_save_chain);

  // Save and add subgroups
  QPushButton* btn_save_subgroups = new QPushButton("Add Subgroups", this);
  btn_save_subgroups->setMaximumWidth(200);
  connect(btn_save_subgroups, SIGNAL(clicked()), this, SIGNAL(saveSubgroups()));
  advanced_options->addWidget(btn_save_subgroups);

  // Add layouts
  new_buttons_layout_container->addLayout(label_layout);
  new_buttons_layout_container->addLayout(recommended_options);
  new_buttons_layout_container->addLayout(advanced_options);

  // Create widget and add to main layout
  new_buttons_widget_->setLayout(new_buttons_layout_container);
  layout->addWidget(new_buttons_widget_);

  // Verticle Spacer -----------------------------------------------------
  QWidget* vspacer = new QWidget(this);
  vspacer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
  layout->addWidget(vspacer);

  // Bottom Controls ---------------------------------------------------------
  QHBoxLayout* controls_layout = new QHBoxLayout();

  // Delete
  btn_delete_ = new QPushButton("&Delete Group", this);
  btn_delete_->setMaximumWidth(200);
  connect(btn_delete_, SIGNAL(clicked()), this, SIGNAL(deleteGroup()));
  controls_layout->addWidget(btn_delete_);
  controls_layout->setAlignment(btn_delete_, Qt::AlignRight);

  // Horizontal Spacer
  QWidget* spacer = new QWidget(this);
  spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
  controls_layout->addWidget(spacer);

  // Save
  btn_save_ = new QPushButton("&Save", this);
  btn_save_->setMaximumWidth(200);
  connect(btn_save_, SIGNAL(clicked()), this, SIGNAL(save()));
  controls_layout->addWidget(btn_save_);
  controls_layout->setAlignment(btn_save_, Qt::AlignRight);

  // Cancel
  QPushButton* btn_cancel = new QPushButton("&Cancel", this);
  btn_cancel->setMaximumWidth(200);
  connect(btn_cancel, SIGNAL(clicked()), this, SIGNAL(cancelEditing()));
  controls_layout->addWidget(btn_cancel);
  controls_layout->setAlignment(btn_cancel, Qt::AlignRight);

  // Add layout
  layout->addLayout(controls_layout);

  // Finish Layout --------------------------------------------------
  this->setLayout(layout);
}
Exemple #11
0
bool Editor_keyDown(int key, int keyCode, int modifiers)
{
	enum Selection selection = modifiers & EMGUI_KEY_SHIFT ? DO_SELECTION : NO_SELECTION;
	int highlightRowStep = getTrackData()->highlightRowStep; 

	if (Emgui_hasKeyboardFocus())
	{
		Editor_update();
		return true;
	}

	// Update editing of values

	if (doEditing(key))
		return true;

	switch (key)
	{
		case EMGUI_KEY_ARROW_UP :
		case EMGUI_KEY_ARROW_DOWN :
		case EMGUI_KEY_ARROW_LEFT : 
		case EMGUI_KEY_ARROW_RIGHT : 
		case EMGUI_KEY_TAB : 
		case EMGUI_KEY_ENTER : 
		{
            if (is_editing)
            {
                endEditing();
                
                if (key == EMGUI_KEY_ENTER)
                    return true;
            }
            
			break;
		}

		case EMGUI_KEY_ESC :
		{
			cancelEditing();
			break;
		}
	}

	switch (key)
	{
		// this is a bit hacky but we don't want to have lots of combos in the menus
		// of arrow keys so this makes it a bit easier
	
		case EMGUI_KEY_ARROW_UP : 
		{
			if (modifiers & EMGUI_KEY_CTRL)
				onPrevNextKey(true, selection);
			else if (modifiers & EMGUI_KEY_COMMAND)
				onBookmarkDir(ARROW_UP, selection);
			else if (modifiers & EMGUI_KEY_ALT)
				onRowStep(-highlightRowStep , selection); 
			else
				onRowStep(-1, selection); 

			break;
		}

		case EMGUI_KEY_ARROW_DOWN : 
		{
			if (modifiers & EMGUI_KEY_CTRL)
				onPrevNextKey(false, selection);
			else if (modifiers & EMGUI_KEY_COMMAND)
				onBookmarkDir(ARROW_DOWN, selection);
			else if (modifiers & EMGUI_KEY_ALT)
				onRowStep(highlightRowStep, selection); 
			else
				onRowStep(1, selection); 
			break;
		}

		case EMGUI_KEY_ARROW_LEFT : onTrackSide(ARROW_LEFT, false, selection); break;
		case EMGUI_KEY_ARROW_RIGHT : onTrackSide(ARROW_RIGHT, false, selection); break;
		case EMGUI_KEY_TAB : onTab(); break;
		default : return false;
	}

	return true;
}
Exemple #12
0
void Editor_menuEvent(int menuItem)
{
	int highlightRowStep = getTrackData()->highlightRowStep; 

	switch (menuItem)
	{
		case EDITOR_MENU_ENTER_CURRENT_V : 
		case EDITOR_MENU_ROWS_UP :
		case EDITOR_MENU_ROWS_DOWN :
		case EDITOR_MENU_PREV_BOOKMARK :
		case EDITOR_MENU_NEXT_BOOKMARK :
		case EDITOR_MENU_PREV_KEY :
		case EDITOR_MENU_NEXT_KEY :
		case EDITOR_MENU_PLAY : 
		{
			endEditing();
		}
	}

	cancelEditing();

	// If some internal control has focus we let it do its thing

	if (Emgui_hasKeyboardFocus())
	{
		Editor_update();
		return;
	}

	switch (menuItem)
	{
		// File

		case EDITOR_MENU_OPEN: onOpen(); break;
		case EDITOR_MENU_SAVE: onSave(); break;
		case EDITOR_MENU_SAVE_AS: onSaveAs(); break;
		case EDITOR_MENU_REMOTE_EXPORT : RemoteConnection_sendSaveCommand(); break;

		case EDITOR_MENU_RECENT_FILE_0:
		case EDITOR_MENU_RECENT_FILE_1:
		case EDITOR_MENU_RECENT_FILE_2:
		case EDITOR_MENU_RECENT_FILE_3:
		{

			Editor_loadRecentFile(menuItem - EDITOR_MENU_RECENT_FILE_0);
			break;
		}

		// Edit
		
		case EDITOR_MENU_UNDO : onUndo(); break;
		case EDITOR_MENU_REDO : onRedo(); break;

		case EDITOR_MENU_CANCEL_EDIT :  onCancelEdit(); break;
		case EDITOR_MENU_DELETE_KEY  :  onDeleteKey(); break;
		case EDITOR_MENU_CUT :          onCutAndCopy(true); break;
		case EDITOR_MENU_COPY :         onCutAndCopy(false); break;
		case EDITOR_MENU_PASTE :        onPaste(); break;
		case EDITOR_MENU_SELECT_TRACK : onSelectTrack(); break;

		case EDITOR_MENU_BIAS_P_001 : biasSelection(0.01f); break;
		case EDITOR_MENU_BIAS_P_01 :  biasSelection(0.1f); break;
		case EDITOR_MENU_BIAS_P_1:    biasSelection(1.0f); break;
		case EDITOR_MENU_BIAS_P_10:   biasSelection(10.0f); break;
		case EDITOR_MENU_BIAS_P_100:  biasSelection(100.0f); break;
		case EDITOR_MENU_BIAS_P_1000: biasSelection(1000.0f); break;
		case EDITOR_MENU_BIAS_N_001:  biasSelection(-0.01f); break;
		case EDITOR_MENU_BIAS_N_01:   biasSelection(-0.1f); break;
		case EDITOR_MENU_BIAS_N_1:    biasSelection(-1.0f); break;
		case EDITOR_MENU_BIAS_N_10:   biasSelection(-10.0f); break;
		case EDITOR_MENU_BIAS_N_100 : biasSelection(-100.0f); break;
		case EDITOR_MENU_BIAS_N_1000: biasSelection(-1000.0f); break;
		
		case EDITOR_MENU_INTERPOLATION : onInterpolation(); break;
		case EDITOR_MENU_ENTER_CURRENT_V : onEnterCurrentValue(); break;

		// View

		case EDITOR_MENU_PLAY : onPlay(); break;
		case EDITOR_MENU_ROWS_UP : onRowStep(-highlightRowStep , NO_SELECTION); break;
		case EDITOR_MENU_ROWS_DOWN : onRowStep(highlightRowStep , NO_SELECTION); break;
		case EDITOR_MENU_ROWS_2X_UP : onRowStep(-highlightRowStep * 2 , NO_SELECTION); break;
		case EDITOR_MENU_ROWS_2X_DOWN : onRowStep(highlightRowStep * 2 , NO_SELECTION); break;
		case EDITOR_MENU_PREV_BOOKMARK : onBookmarkDir(ARROW_UP, NO_SELECTION); break;
		case EDITOR_MENU_NEXT_BOOKMARK : onBookmarkDir(ARROW_DOWN, NO_SELECTION); break;
		case EDITOR_MENU_FIRST_TRACK : onTrackSide(ARROW_LEFT, true, NO_SELECTION); break;
		case EDITOR_MENU_LAST_TRACK : onTrackSide(ARROW_RIGHT, true, NO_SELECTION); break;
		case EDITOR_MENU_PREV_KEY : onPrevNextKey(true, NO_SELECTION); break;
		case EDITOR_MENU_NEXT_KEY : onPrevNextKey(false, NO_SELECTION); break;
		case EDITOR_MENU_FOLD_TRACK : onFoldTrack(true); break;
		case EDITOR_MENU_UNFOLD_TRACK : onFoldTrack(false); break;
		case EDITOR_MENU_FOLD_GROUP : onFoldGroup(true); break;
		case EDITOR_MENU_UNFOLD_GROUP : onFoldGroup(false); break;
		case EDITOR_MENU_TOGGLE_BOOKMARK : onToggleBookmark(); break;
		case EDITOR_MENU_CLEAR_BOOKMARKS : onClearBookmarks(); break;
		case EDITOR_MENU_TAB : onTab(); break;
	}

	Editor_update();
}
Exemple #13
0
static void onCancelEdit()
{
	cancelEditing();
}
// ******************************************************************************************
// Create the edit widget
// ******************************************************************************************
QWidget* EndEffectorsWidget::createEditWidget()
{
  // Main widget
  QWidget *edit_widget = new QWidget( this );
  // Layout
  QVBoxLayout *layout = new QVBoxLayout();


  // Simple form -------------------------------------------
  QFormLayout *form_layout = new QFormLayout();
  //form_layout->setContentsMargins( 0, 15, 0, 15 );
  form_layout->setRowWrapPolicy( QFormLayout::WrapAllRows );

  // Name input
  effector_name_field_ = new QLineEdit( this );
  form_layout->addRow( "End Effector Name:", effector_name_field_ );

  // Group input
  group_name_field_ = new QComboBox( this );
  group_name_field_->setEditable( false );
  form_layout->addRow( "End Effector Group:", group_name_field_ );

  // Parent Link input
  parent_name_field_ = new QComboBox( this );
  parent_name_field_->setEditable( false );
  form_layout->addRow( "Parent Link (usually part of the arm):", parent_name_field_ );

  // Parent Group input
  parent_group_name_field_ = new QComboBox( this );
  parent_group_name_field_->setEditable( false );
  form_layout->addRow( "Parent Group (optional):", parent_group_name_field_ );
  
  layout->addLayout( form_layout );

  // Bottom Buttons --------------------------------------------------

  QHBoxLayout *controls_layout = new QHBoxLayout();
  controls_layout->setContentsMargins( 0, 25, 0, 15 );

  // Spacer
  QWidget *spacer = new QWidget( this );
  spacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
  controls_layout->addWidget( spacer );

  // Save
  QPushButton *btn_save_ = new QPushButton( "&Save", this );
  btn_save_->setMaximumWidth( 200 );
  connect( btn_save_, SIGNAL(clicked()), this, SLOT( doneEditing() ) );
  controls_layout->addWidget( btn_save_ );
  controls_layout->setAlignment(btn_save_, Qt::AlignRight);

  // Cancel
  QPushButton *btn_cancel_ = new QPushButton( "&Cancel", this );
  btn_cancel_->setMaximumWidth( 200 );
  connect( btn_cancel_, SIGNAL(clicked()), this, SLOT( cancelEditing() ) );
  controls_layout->addWidget( btn_cancel_ );
  controls_layout->setAlignment(btn_cancel_, Qt::AlignRight);
  
  // Add layout
  layout->addLayout( controls_layout );

  
  // Set layout -----------------------------------------------------
  edit_widget->setLayout(layout);

  return edit_widget;
}