void inline CWaveEditControl::MoveWaveLines(QPoint p) { size_t Pos=BufferPos(p.x()); if (Pos>m_Length) Pos=m_Length; if (WaveLines==wlStart) { if (m_LoopOn) { if (Pos>m_LP.LoopStart) Pos=m_LP.LoopStart; } else { if (Pos>m_LP.End-(m_LP.FadeIn+m_LP.FadeOut)) Pos=m_LP.End-(m_LP.FadeIn+m_LP.FadeOut); } m_LP.Start=Pos; } else if (WaveLines==wlEnd) { if (m_LoopOn) { if (Pos<m_LP.LoopEnd) Pos=m_LP.LoopEnd; } else { if (Pos<m_LP.Start+m_LP.FadeIn+m_LP.FadeOut) Pos=m_LP.Start+m_LP.FadeIn+m_LP.FadeOut; } m_LP.End=Pos; } else if (WaveLines==wlLoopStart) { if (Pos<m_LP.Start) Pos=m_LP.Start; if (Pos>m_LP.LoopEnd) Pos=m_LP.LoopEnd; m_LP.LoopStart=Pos; } else if (WaveLines==wlLoopEnd) { if (Pos<m_LP.LoopStart) Pos=m_LP.LoopStart; if (Pos>m_LP.End) Pos=m_LP.End; m_LP.LoopEnd=Pos; } else if (WaveLines==wlFadeIn) { if (Pos<m_LP.Start) Pos=m_LP.Start; if (Pos>m_LP.End-m_LP.FadeOut) Pos=m_LP.End-m_LP.FadeOut; m_LP.FadeIn=Pos-m_LP.Start; m_LP.Volume=Pos2Vol(p.y()); } else if (WaveLines==wlFadeOut) { if (Pos<m_LP.Start+m_LP.FadeIn) Pos=m_LP.Start+m_LP.FadeIn; if (Pos>m_LP.End) Pos=m_LP.End; m_LP.FadeOut=m_LP.End-Pos; m_LP.Volume=Pos2Vol(p.y()); } DrawLines(m_LP,m_LoopOn); emit ParameterChanged(m_LP); }
QCSXCAD::QCSXCAD(QWidget *parent) : QMainWindow(parent) { QStringList argList=qApp->arguments(); for (int i=1;i<argList.size();++i) { if (argList.at(i).startsWith("-")) QCSX_Settings.parseCommandLineArgument(argList.at(i)); } m_ViewDir = 2; m_RenderDiscModels = QCSX_Settings.GetRenderDiscMaterial(); StructureVTK = new QVTKStructure(); StructureVTK->SetGeometry(this); setCentralWidget(StructureVTK->GetVTKWidget()); CSTree = new QCSTreeWidget(this); QObject::connect(CSTree,SIGNAL(Edit()),this,SLOT(Edit())); QObject::connect(CSTree,SIGNAL(Copy()),this,SLOT(Copy())); QObject::connect(CSTree,SIGNAL(ShowHide()),this,SLOT(ShowHide())); QObject::connect(CSTree,SIGNAL(Delete()),this,SLOT(Delete())); QObject::connect(CSTree,SIGNAL(NewBox()),this,SLOT(NewBox())); QObject::connect(CSTree,SIGNAL(NewMultiBox()),this,SLOT(NewMultiBox())); QObject::connect(CSTree,SIGNAL(NewSphere()),this,SLOT(NewSphere())); QObject::connect(CSTree,SIGNAL(NewCylinder()),this,SLOT(NewCylinder())); QObject::connect(CSTree,SIGNAL(NewUserDefined()),this,SLOT(NewUserDefined())); QObject::connect(CSTree,SIGNAL(NewMaterial()),this,SLOT(NewMaterial())); QObject::connect(CSTree,SIGNAL(NewMetal()),this,SLOT(NewMetal())); QObject::connect(CSTree,SIGNAL(NewExcitation()),this,SLOT(NewExcitation())); QObject::connect(CSTree,SIGNAL(NewChargeBox()),this,SLOT(NewChargeBox())); QObject::connect(CSTree,SIGNAL(NewResBox()),this,SLOT(NewResBox())); QObject::connect(CSTree,SIGNAL(NewDumpBox()),this,SLOT(NewDumpBox())); QDockWidget *dock = new QDockWidget(tr("Properties and Structures"),this); dock->setAllowedAreas(Qt::LeftDockWidgetArea); dock->setWidget(CSTree); dock->setFeatures(QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable); dock->setObjectName("Properties_and_Structures_Dock"); addDockWidget(Qt::LeftDockWidgetArea,dock); GridEditor = new QCSGridEditor(&clGrid); QObject::connect(GridEditor,SIGNAL(OpacityChange(int)),StructureVTK,SLOT(SetGridOpacity(int))); QObject::connect(GridEditor,SIGNAL(signalDetectEdges(int)),this,SLOT(DetectEdges(int))); QObject::connect(GridEditor,SIGNAL(GridChanged()),StructureVTK,SLOT(RenderGrid())); QObject::connect(GridEditor,SIGNAL(GridPlaneXChanged(int)),StructureVTK,SLOT(RenderGridX(int))); QObject::connect(GridEditor,SIGNAL(GridPlaneYChanged(int)),StructureVTK,SLOT(RenderGridY(int))); QObject::connect(GridEditor,SIGNAL(GridPlaneZChanged(int)),StructureVTK,SLOT(RenderGridZ(int))); dock = new QDockWidget(tr("Rectilinear Grid"),this); dock->setAllowedAreas(Qt::LeftDockWidgetArea); dock->setWidget(GridEditor); dock->setFeatures(QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable); dock->setObjectName("Rectilinear_Grid_Dock"); addDockWidget(Qt::LeftDockWidgetArea,dock); QParaSet= new QParameterSet(); QObject::connect(QParaSet,SIGNAL(ParameterChanged()),this,SLOT(CheckGeometry())); QObject::connect(QParaSet,SIGNAL(ParameterChanged()),this,SLOT(setModified())); clParaSet=QParaSet; dock = new QDockWidget(tr("Rectilinear Grid - Plane Position"),this); dock->setAllowedAreas(Qt::LeftDockWidgetArea); dock->setWidget(GridEditor->BuildPlanePosWidget()); dock->setFeatures(QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable); dock->setObjectName("Grid_Plane_Pos"); addDockWidget(Qt::LeftDockWidgetArea,dock); dock = new QDockWidget(tr("Parameter"),this); dock->setAllowedAreas(Qt::LeftDockWidgetArea); dock->setWidget(QParaSet); dock->setFeatures(QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable); dock->setObjectName("Parameter_Dock"); addDockWidget(Qt::LeftDockWidgetArea,dock); BuildToolBar(); bModified=true; GridEditor->SetOpacity(30); Render(); }