/** \param comp \param parent \param selectMode **/ TipoArticuloList::TipoArticuloList ( BfCompany *comp, QWidget *parent, bool selectMode ) : BfForm ( comp, parent ) { BL_FUNC_DEBUG setupUi ( this ); m_listTipos->setColumnCount ( 3 ); QStringList headers; headers << _ ( "Id" ) << _ ( "Codigo" ) << _ ( "Descripcion" ); m_listTipos->setHeaderLabels ( headers ); m_semaforoPintar = FALSE; m_idtipo = ""; mui_codigotipo_articulo->setEnabled ( FALSE ); mui_desctipo_articulo->setEnabled ( FALSE ); if ( selectMode ) { setSelectMode(); groupBox1->hide(); mui_detalles->hide(); mui_crear->hide(); mui_guardar->hide(); mui_borrar->hide(); mui_cancelar->hide(); mui_aceptar->hide(); } else { setEditMode(); setAttribute ( Qt::WA_DeleteOnClose ); mainCompany()->insertWindow ( windowTitle(), this, FALSE ); } // end if pintar(); blScript(this); }
/** \param comp \param parent \param selectMode **/ FamiliasView::FamiliasView ( BfCompany *comp, QWidget *parent, bool selectMode ) : BfForm ( comp, parent ) { BL_FUNC_DEBUG setupUi ( this ); m_listFamilias->setColumnCount ( 3 ); QStringList headers; headers << _ ( "Nombre" ) << _ ( "Codigo" ) << _ ( "Descripcion" ) << _ ( "Id familia" ) << _ ( "Codigo completo" ); m_listFamilias->setHeaderLabels ( headers ); m_listFamilias->setColumnWidth ( 0, 200 ); m_listFamilias->setColumnWidth ( 1, 100 ); m_listFamilias->setColumnHidden ( COL_IDFAMILIA, TRUE ); m_listFamilias->setColumnHidden ( COL_CODFAMILIA, TRUE ); m_listFamilias->setColumnHidden ( COL_PRODUCTOFISICOFAMILIA, TRUE ); m_semaforoPintar = FALSE; m_idfamilia = ""; mui_nomFamilia->setEnabled ( FALSE ); mui_descFamilia->setEnabled ( FALSE ); mui_codCompletoFamilia->setEnabled ( FALSE ); mui_codFamilia->setEnabled ( FALSE ); /// Disparamos los plugins. int res = g_plugins->run ( "FamiliasView_FamiliasView", this ); if ( res != 0 ) { return; } // end if if ( selectMode ) { setSelectMode(); mui_tab->hide(); // mui_detalles->hide(); // mui_crear->hide(); // mui_guardar->hide(); mui_borrar->hide(); mui_cancelar->hide(); mui_aceptar->hide(); mui_imprimir->hide(); } else { setEditMode(); setAttribute ( Qt::WA_DeleteOnClose ); mainCompany()->insertWindow ( windowTitle(), this, FALSE ); } // end if pintar(); blScript(this); }
long FileDlg::onToggleMulti(FXObject*o,FXSelector sel,void*p) { setSelectMode(p?SELECTFILE_MULTIPLE:SELECTFILE_EXISTING); fsel()->txtfld()->setText(FXString::null); fsel()->fbox()->killSelection(true); if (p) { fsel()->fbox()->setFocus(); fsel()->fbox()->setCurrentItem(0); } else { fsel()->txtfld()->setFocus(); } return 1; }
/** \param comp \param parent \param selectMode **/ PartidasView::PartidasView ( BfCompany *comp, QWidget *parent, bool selectMode ) : BfForm ( comp, parent ) { BL_FUNC_DEBUG setupUi ( this ); m_listPartidas->setColumnCount ( 3 ); QStringList headers; headers << _ ( "Nombre" ) << _ ( "Codigo" ) << _ ( "Descripcion" ) << _ ( "Id partida" ) << _ ( "Codigo completo" ); m_listPartidas->setHeaderLabels ( headers ); m_listPartidas->setColumnWidth ( 0, 200 ); m_listPartidas->setColumnWidth ( 1, 100 ); m_listPartidas->setColumnHidden ( COL_IDPARTIDA, true ); m_listPartidas->setColumnHidden ( COL_CODIGOPARTIDA, true ); m_semaforoPintar = false; m_idpartida = ""; mui_nombrePartida->setEnabled ( false ); mui_descPartida->setEnabled ( false ); mui_codigoCompletoPartida->setEnabled ( false ); mui_codigoPartida->setEnabled ( false ); if ( selectMode ) { setSelectMode(); groupBox1->hide(); mui_detalles->hide(); mui_crear->hide(); mui_guardar->hide(); mui_borrar->hide(); mui_cancelar->hide(); mui_aceptar->hide(); mui_imprimir->hide(); } else { setEditMode(); setAttribute ( Qt::WA_DeleteOnClose ); mainCompany()->insertWindow ( windowTitle(), this, false ); } // end if pintar(); blScript(this); }
void MainWindow::createActions() { //saveToXML = new QAction(QIcon(":/images/save.png"), tr("&Save..."), this); //saveToXML = new QAction(("&Save..."), this); //saveToXML->setShortcuts(QKeySequence::Save); //saveToXML->setStatusTip(tr("Save your current sketch to an XML file")); //saveToXML->setText("Save"); //connect(saveToXML, SIGNAL(triggered()), this, SLOT(saveTreeToXML())); newSketch = new QAction(("&New"), this); newSketch->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N)); newSketch->setStatusTip(tr("Start a new sketch")); connect(newSketch, SIGNAL(triggered()), this, SLOT(clearSketch())); generate = new QAction(("&Generate"), this); generate->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G)); generate->setStatusTip(tr("Generate a tree from your current sketch")); connect(generate, SIGNAL(triggered()), this, SLOT(generateFromCurrent())); generate->setEnabled(false); generationOption = new QAction(("&Options"), this); generationOption->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O)); generationOption->setStatusTip(tr("Choose settings for the tree generation process")); connect(generationOption, SIGNAL(triggered()), this, SLOT(generationOptions())); newVariation = new QAction(("&New Variation"), this); //newVariation->setShortcuts(QKeySequence(Qt::CTRL + Qt::Key_G)); newVariation->setStatusTip(tr("Generate a new variation of the last type of tree you generated")); connect(newVariation, SIGNAL(triggered()), this, SLOT(generateNewVariation())); newVariation->setEnabled(false); displayFoliage = new QCheckBox(("&Foliage"), this); displayFoliage->setChecked(true); //newVariation->setShortcuts(QKeySequence(Qt::CTRL + Qt::Key_G)); displayFoliage->setStatusTip(tr("Display foliage")); connect(displayFoliage, SIGNAL(toggled(bool)), this, SLOT(toggleFoliage( bool))); displayFoliage->setEnabled(false); displayFoliage->setChecked(true); displayTexture = new QCheckBox(("&Texture"), this); displayTexture->setChecked(true); //newVariation->setShortcuts(QKeySequence(Qt::CTRL + Qt::Key_G)); displayTexture->setStatusTip(tr("Display texture")); connect(displayTexture, SIGNAL(toggled(bool)), this, SLOT(toggleTexture(bool))); displayTexture->setEnabled(false); displayTexture->setChecked(true); displaySubdivisionSurface = new QCheckBox(("&Subdivision Surface"), this); //newVariation->setShortcuts(QKeySequence(Qt::CTRL + Qt::Key_G)); displaySubdivisionSurface->setStatusTip(tr("Generate a subdivision surface for the trunk and branches")); displaySubdivisionSurface->setChecked(true); connect(displaySubdivisionSurface, SIGNAL(toggled(bool)), this, SLOT(displayAsMesh(bool))); displaySubdivisionSurface->setEnabled(false); SubdivSpinBox = new QSpinBox(); SubdivSpinBox->setSingleStep(1); SubdivSpinBox->setMaximumWidth(40); SubdivSpinBox->setValue(subdivs); SubdivSpinBox->setMaximum(3); SubdivSpinBox->setEnabled(false); connect(SubdivSpinBox, SIGNAL( valueChanged(int)), this, SLOT(SubdivSliderChange(int))); undo = new QAction(QIcon("./Resources/Icons/Undo.png"),("&Undo"), this); undo->setStatusTip(tr("Undo your last action")); connect(undo, SIGNAL(triggered()), this, SLOT(undoAction())); redo = new QAction(QIcon("./Resources/Icons/Redo.png"),("&Redo"), this); redo->setStatusTip(tr("Redo your last undone action")); connect(redo, SIGNAL(triggered()), this, SLOT(redoAction())); //viewXML = new QAction(("&Display XML file..."), this); //connect(viewXML, SIGNAL(triggered()), this, SLOT(viewXMLAction())); //viewLST = new QAction(("&Display LST file..."), this); //connect(viewLST, SIGNAL(triggered()), this, SLOT(viewLSTAction())); lineMode = new QToolButton(this); lineMode->setText("Line Mode"); lineMode->setIcon(QIcon("./Resources/Icons/LineMode.png")); lineMode->setStatusTip(tr("Change to line drawing mode in the sketch interface")); connect(lineMode, SIGNAL(clicked()), this, SLOT(setLineMode())); lineMode->setCheckable(true); lineMode->setChecked(true); lineMode->setAutoExclusive(true); selectMode = new QToolButton(this); selectMode->setText("Select Mode"); selectMode->setIcon(QIcon("./Resources/Icons/SelectMode.png")); selectMode->setStatusTip(tr("Change to selection mode in the sketch interface")); connect(selectMode, SIGNAL(clicked()), this, SLOT(setSelectMode())); selectMode->setCheckable(true); selectMode->setAutoExclusive(true); pencilMode = new QToolButton(this); pencilMode->setText("Pencil Mode"); pencilMode->setIcon(QIcon("./Resources/Icons/PencilMode.png")); pencilMode->setStatusTip(tr("Change to pencil drawing mode in the sketch interface")); connect(pencilMode, SIGNAL(clicked()), this, SLOT(setPencilMode())); pencilMode->setCheckable(true); pencilMode->setAutoExclusive(true); brushSize = new QComboBox(this); QIntValidator *val = new QIntValidator(brushSize); val->setRange(3, 30); brushSize->setValidator(val); connect(brushSize, SIGNAL(activated(const QString&)), this, SLOT(setBrushSize(const QString&))); for (int i=0; i<BRUSH_SIZE_COUNT; ++i) { QString s; s.setNum(BRUSH_SIZE_OPTION[i]); brushSize->insertItem(i+1, s); } brushLabel = new QLabel(this); brushLabel->setText(" Brush size: "); texSynthOption = new QAction(("&Synthesize Texture"), this); // texSynthOption->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O)); texSynthOption->setStatusTip(tr("Synthesize a new texture from a sample")); connect(texSynthOption, SIGNAL(triggered()), this,SLOT(SynthesizeTexture())); }
// File selector object FileSelector::FileSelector(FXComposite *p,FXObject* tgt,FXSelector sel,FXuint opts,FXint x,FXint y,FXint w,FXint h): FXPacker(p,opts,x,y,w,h,0,0,0,0,0,0) { FXAccelTable *table=getShell()->getAccelTable(); target=tgt; message=sel; // Global container FXVerticalFrame* cont=new FXVerticalFrame(this,LAYOUT_FILL_Y|LAYOUT_FILL_X|FRAME_NONE,0,0,0,0, 0,0,0,0, 0,0); // Container for the action buttons FXHorizontalFrame* buttons=new FXHorizontalFrame(cont,LAYOUT_SIDE_TOP|LAYOUT_FILL_X|FRAME_RAISED,0,0,0,0, 5,5,5,5, 0,0); // Container for the path linker FXHorizontalFrame* pathframe=new FXHorizontalFrame(cont,LAYOUT_FILL_X|FRAME_RAISED,0,0,0,0, 0,0,0,0, 0,0); // File list FXuint options = _ICONLIST_BROWSESELECT|LAYOUT_FILL_X|LAYOUT_FILL_Y; FXbool thumbnails=getApp()->reg().readUnsignedEntry("FILEDIALOG","thumbnails",FALSE); list=new FileList(this,cont,this,ID_FILELIST,thumbnails,options); // Set list colors and columns size for detailed mode list->setTextColor(getApp()->reg().readColorEntry("SETTINGS","listforecolor",FXRGB(0,0,0))); list->setBackColor(getApp()->reg().readColorEntry("SETTINGS","listbackcolor",FXRGB(255,255,255))); list->setHeaderSize(0,getApp()->reg().readUnsignedEntry("FILEDIALOG","name_size",200)); list->setHeaderSize(1,getApp()->reg().readUnsignedEntry("FILEDIALOG","size_size",60)); list->setHeaderSize(2,getApp()->reg().readUnsignedEntry("FILEDIALOG","type_size",100)); list->setHeaderSize(3,getApp()->reg().readUnsignedEntry("FILEDIALOG","ext_size",100)); list->setHeaderSize(4,getApp()->reg().readUnsignedEntry("FILEDIALOG","modd_size",150)); list->setHeaderSize(5,getApp()->reg().readUnsignedEntry("FILEDIALOG","user_size",50)); list->setHeaderSize(6,getApp()->reg().readUnsignedEntry("FILEDIALOG","grou_size",50)); list->setHeaderSize(7,getApp()->reg().readUnsignedEntry("FILEDIALOG","attr_size",100)); // Set file selector options FXbool hiddenfiles=getApp()->reg().readUnsignedEntry("FILEDIALOG","hiddenfiles",FALSE); showHiddenFiles(hiddenfiles); FXuint listmode=getApp()->reg().readUnsignedEntry("FILEDIALOG","listmode",0); setFileBoxStyle(listmode); // Entry buttons FXMatrix* fields=new FXMatrix(cont,3,MATRIX_BY_COLUMNS|LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X); new FXLabel(fields,_("&File Name:"),NULL,JUSTIFY_LEFT|LAYOUT_CENTER_Y); filename=new FXTextField(fields,25,this,ID_ACCEPT,TEXTFIELD_ENTER_ONLY|LAYOUT_FILL_COLUMN|LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK); new FXButton(fields,_("&OK"),NULL,this,ID_ACCEPT,BUTTON_INITIAL|BUTTON_DEFAULT|FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X,0,0,0,0,20,20); accept=new FXButton(buttons,FXString::null,NULL,NULL,0,LAYOUT_FIX_X|LAYOUT_FIX_Y|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,0,0,0,0, 0,0,0,0); new FXLabel(fields,_("File F&ilter:"),NULL,JUSTIFY_LEFT|LAYOUT_CENTER_Y); FXHorizontalFrame* filterframe=new FXHorizontalFrame(fields,LAYOUT_FILL_COLUMN|LAYOUT_FILL_X|LAYOUT_FILL_Y); filefilter=new FXComboBox(filterframe,10,this,ID_FILEFILTER,COMBOBOX_STATIC|FRAME_SUNKEN|LAYOUT_FILL_X); filefilter->setNumVisible(4); readonly=new FXCheckButton(filterframe,_("Read Only"),NULL,0,ICON_BEFORE_TEXT|JUSTIFY_LEFT|LAYOUT_CENTER_Y); cancel=new FXButton(fields,_("&Cancel"),NULL,NULL,0,BUTTON_DEFAULT|FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X,0,0,0,0,20,20); // Action buttons FXString key; FXHotKey hotkey; FXButton *btn; FXToggleButton *tglbtn; new FXFrame(buttons,LAYOUT_FIX_WIDTH,0,0,4,1); key=getApp()->reg().readStringEntry("KEYBINDINGS","go_back","Ctrl-Backspace"); btn=new FXButton(buttons,TAB+_("Go to previous directory")+PARS(key),dirbackicon,this,ID_DIR_BACK,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3); hotkey=_parseAccel(key); btn->addHotKey(hotkey); btnbackhist=new FXArrowButton(buttons,this,ID_DIR_BACK_HIST,LAYOUT_FILL_Y|FRAME_RAISED|FRAME_THICK|ARROW_DOWN|ARROW_TOOLBAR); key=getApp()->reg().readStringEntry("KEYBINDINGS","go_forward","Shift-Backspace"); btn=new FXButton(buttons,TAB+_("Go to next directory")+PARS(key),dirforwardicon,this,ID_DIR_FORWARD,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3); hotkey=_parseAccel(key); btn->addHotKey(hotkey); btnforwardhist=new FXArrowButton(buttons,this,ID_DIR_FORWARD_HIST,LAYOUT_FILL_Y|FRAME_RAISED|FRAME_THICK|ARROW_DOWN|ARROW_TOOLBAR); key=getApp()->reg().readStringEntry("KEYBINDINGS","go_up","Backspace"); btn=new FXButton(buttons,TAB+_("Go to parent directory")+PARS(key),dirupicon,this,ID_DIR_UP,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3); hotkey=_parseAccel(key); btn->addHotKey(hotkey); key=getApp()->reg().readStringEntry("KEYBINDINGS","go_home","Ctrl-H"); btn=new FXButton(buttons,TAB+_("Go to home directory")+PARS(key),homeicon,this,ID_HOME,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3); hotkey=_parseAccel(key); btn->addHotKey(hotkey); key=getApp()->reg().readStringEntry("KEYBINDINGS","go_work","Shift-F2"); btn=new FXButton(buttons,TAB+_("Go to working directory")+PARS(key),workicon,this,ID_WORK,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3); hotkey=_parseAccel(key); btn->addHotKey(hotkey); key=getApp()->reg().readStringEntry("KEYBINDINGS","new_folder","F7"); btn=new FXButton(buttons,TAB+_("New folder")+PARS(key),newfoldericon,this,ID_NEWDIR,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3); hotkey=_parseAccel(key); btn->addHotKey(hotkey); key=getApp()->reg().readStringEntry("KEYBINDINGS","big_icons","F10"); btn=new FXButton(buttons,TAB+_("Big icon list")+PARS(key),bigiconsicon,list,FileList::ID_SHOW_BIG_ICONS,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3); hotkey=_parseAccel(key); btn->addHotKey(hotkey); key=getApp()->reg().readStringEntry("KEYBINDINGS","small_icons","F11"); btn=new FXButton(buttons,TAB+_("Small icon list")+PARS(key),smalliconsicon,list,FileList::ID_SHOW_MINI_ICONS,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3); hotkey=_parseAccel(key); btn->addHotKey(hotkey); key=getApp()->reg().readStringEntry("KEYBINDINGS","detailed_file_list","F12"); btn=new FXButton(buttons,TAB+_("Detailed file list")+PARS(key),detailsicon,list,FileList::ID_SHOW_DETAILS,BUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3); hotkey=_parseAccel(key); btn->addHotKey(hotkey); key=getApp()->reg().readStringEntry("KEYBINDINGS","hidden_files","Ctrl-F6"); tglbtn=new FXToggleButton(buttons,TAB+_("Show hidden files")+PARS(key),TAB+_("Hide hidden files")+PARS(key),showhiddenicon,hidehiddenicon,list,FileList::ID_TOGGLE_HIDDEN,TOGGLEBUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3); hotkey=_parseAccel(key); tglbtn->addHotKey(hotkey); key=getApp()->reg().readStringEntry("KEYBINDINGS","thumbnails","Ctrl-F7"); tglbtn=new FXToggleButton(buttons,TAB+_("Show thumbnails")+PARS(key),TAB+_("Hide thumbnails")+PARS(key),showthumbicon,hidethumbicon,list,FileList::ID_TOGGLE_THUMBNAILS,TOGGLEBUTTON_TOOLBAR|FRAME_RAISED,0,0,0,0, 3,3,3,3); hotkey=_parseAccel(key); tglbtn->addHotKey(hotkey); // Path text pathtext=new TextLabel(pathframe,0,this,0,LAYOUT_FILL_X|LAYOUT_FILL_Y); pathtext->setBackColor(getApp()->getBaseColor()); // Path linker pathlink = new PathLinker(pathframe,list,NULL,LAYOUT_FILL_X); readonly->hide(); if(table) { FXString key; FXHotKey hotkey; key=getApp()->reg().readStringEntry("KEYBINDINGS","select_all","Ctrl-A"); hotkey=_parseAccel(key); table->addAccel(hotkey,list,FXSEL(SEL_COMMAND,FileList::ID_SELECT_ALL)); key=getApp()->reg().readStringEntry("KEYBINDINGS","deselect_all","Ctrl-Z"); hotkey=_parseAccel(key); table->addAccel(hotkey,list,FXSEL(SEL_COMMAND,FileList::ID_DESELECT_ALL)); key=getApp()->reg().readStringEntry("KEYBINDINGS","invert_selection","Ctrl-I"); hotkey=_parseAccel(key); table->addAccel(hotkey,list,FXSEL(SEL_COMMAND,FileList::ID_SELECT_INVERSE)); key=getApp()->reg().readStringEntry("KEYBINDINGS","new_file","F2"); hotkey=_parseAccel(key); table->addAccel(hotkey,this,FXSEL(SEL_COMMAND,ID_NEWFILE)); } setSelectMode(SELECT_FILE_ANY); // For backward compatibility, this HAS to be the default! setPatternList(allfiles); setDirectory(FXSystem::getCurrentDirectory()); // Update file list pathlink->setPath(FXSystem::getCurrentDirectory()); // Update path linker pathtext->setText(FXSystem::getCurrentDirectory()); // Update path text list->setFocus(); accept->hide(); // Change default cursor if single click navigation if (single_click==SINGLE_CLICK_DIR_FILE) list->setDefaultCursor(getApp()->getDefaultCursor(DEF_HAND_CURSOR)); }
void Scene::mousePressEvent( QMouseEvent* e ) { // Regular behavior QGLViewer::mousePressEvent(e); if ((e->button() == Qt::RightButton) && (e->modifiers() == Qt::ShiftModifier)) { QMenu menu( this ); QAction* selectControllerAction = menu.addAction("Select controller"); QAction* selectCurveAction = menu.addAction("Select curve"); menu.addSeparator(); QAction* action = NULL; /*switch (selectMode){ case CONTROLLER: case CONTROLLER_ELEMENT: if(selection.isEmpty()){ print("Please select some controllers."); break; }*/ Controller * ctrl = (Controller *)activeObject()->ptr["controller"]; QAction* symmGrp = menu.addAction("Create Symmetry group.."); QAction* concentricGrp = menu.addAction("Create Concentric group.."); QAction* coplanGrp = menu.addAction("Create Coplanar group.."); menu.addSeparator(); QAction* self1foldSymm = menu.addAction("Create 1-fold Self-Symmetry.."); QAction* self2foldSymm = menu.addAction("Create 2-fold Self-Symmetry.."); menu.addSeparator(); QAction* addFixedPoint = menu.addAction("Add fixed Point"); // == Deformer stuff === menu.addSeparator(); QAction* selectFFD = menu.addAction("FFD"); QAction* selectVoxelDeformer = menu.addAction("Voxel Deformer"); // == end deformer === // == Primitive geometry stuff == menu.addSeparator(); QMenu & mesh_menu = *menu.addMenu("Modify geometry"); QAction* simplifyAction = mesh_menu.addAction("Simplify"); QAction* remeshAction = mesh_menu.addAction("Re-mesh"); QAction* replaceAction = mesh_menu.addAction("Replace geometry..."); mesh_menu.addSeparator(); QAction* loopAction = mesh_menu.addAction("Loop"); QAction* longEdgeAction = mesh_menu.addAction("Longest Edge"); QAction* butterflyAction = mesh_menu.addAction("Modified Butterfly"); mesh_menu.addSeparator(); QAction* laplacianSmoothAction = mesh_menu.addAction("Laplacian smoothing"); QAction* scaleSmoothAction = mesh_menu.addAction("Scale dependent smoothing"); QAction* mcfSmoothAction = mesh_menu.addAction("MCF smoothing"); // == end === action = menu.exec(e->globalPos()); // show menu // Selections if(action == selectControllerAction) setSelectMode(CONTROLLER); if(action == selectCurveAction) setSelectMode(CONTROLLER_ELEMENT); if(action == selectFFD) setSelectMode(FFD_DEFORMER); if(action == selectVoxelDeformer) setSelectMode(VOXEL_DEFORMER); Group* newGroup = NULL; int opt = 0; if(action == symmGrp) newGroup = new SymmetryGroup(SYMMETRY); if(action == self1foldSymm) ctrl->getSelectedPrimitive()->setSymmetryPlanes(1); if(action == self2foldSymm) ctrl->getSelectedPrimitive()->setSymmetryPlanes(2); if(action == addFixedPoint) { Primitive * prim = ctrl->getSelectedPrimitive(); Point pos = prim->getSelectedCurveCenter(); prim->addFixedPoint(pos); } if(newGroup) { newGroup->process(ctrl->getPrimitives(selection)); newGroup->id = QString::number(ctrl->groups.size()); ctrl->groups[newGroup->id] = newGroup; emit(groupsChanged()); print("New group added."); } if(mesh_menu.actions().contains(action)) { Primitive * prim = ctrl->getSelectedPrimitive(); if(prim){ QSurfaceMesh * mesh = prim->getMesh(); double avgEdge = mesh->getAverageEdgeLength(); if(action == simplifyAction) Decimater::simplify(mesh, 0.5); if(action == remeshAction) LaplacianRemesher::remesh(mesh, avgEdge * 0.6); if(action == loopAction) LoopSubdivider().subdivide(*mesh,1); if(action == butterflyAction) ModifiedButterfly().subdivide(*mesh, 1); if(action == longEdgeAction) LongestEdgeSubdivision(avgEdge * 0.5).subdivide(*mesh, 1); if(action == laplacianSmoothAction) Smoother::LaplacianSmoothing(mesh, 1); if(action == scaleSmoothAction) Smoother::ScaleDependentSmoothing(mesh, 1); if(action == mcfSmoothAction) Smoother::MeanCurvatureFlow(mesh, 1); if(action == replaceAction) { QMenu prim_menu( this ); foreach(Primitive * prim, ctrl->getPrimitives()) prim_menu.addAction(prim->id); action = prim_menu.exec(e->globalPos()); // Replace geometry QSurfaceMesh * originalMesh = prim->getMesh(); Primitive * otherPrim = ctrl->getPrimitive(action->text()); if(otherPrim){ QSurfaceMesh * toMesh = otherPrim->getMesh(); originalMesh->setFromOther(toMesh); } } mesh->garbage_collection(); mesh->buildUp(); updateActiveObject(); prim->computeMeshCoordinates(); } } /*break; }*/ } }