コード例 #1
0
void P_Crop::checkSize()
{
   // is cropping even enabled?
   if( enableCBx.isSelected() )
   {
      // make certain that cropping is not beyond the scope of the image size
      P_Size *p_size = ((POV_LaunchDialog*)(owner()->owner()))->PSize;
      xStartSB->  setRange( IRange(1, p_size->width ) );
      yStartSB->  setRange( IRange(1, p_size->height) );
      xEndSB->    setRange( IRange(1, p_size->width ) );
      yEndSB->    setRange( IRange(1, p_size->height) );
   }
   return;
}
コード例 #2
0
/*------------------------------------------------------------------------------
| SampleDialog::circularSlider                                                 |
------------------------------------------------------------------------------*/
SampleDialog& SampleDialog :: circularSlider( ICircularSlider* pCircularSlider )
{
  pCircularSlider->setArmRange( IRange( 0, 50 ) )
                  .setRotationIncrement( 5 )
                  .setTickSpacing( 5 )
                  .setValue( 25 )
                  .enableNotification();

  sampleObserver.handleNotificationsFor( *pCircularSlider );

  return( *this );
}
コード例 #3
0
/*------------------------------------------------------------------------------
| Amp::Amp                                                                     |
|                                                                              |
|                                                                              |
------------------------------------------------------------------------------*/
Amp::Amp( IMMAmpMixer*  aAmp1,
          IMMAmpMixer*  aAmp2,
          IMMAmpMixer*  aAmp3,
          unsigned long windowid,
          IWindow*      parent,
          IWindow*      owner)
   : IMultiCellCanvas(windowid,parent,owner),
     name            (AMPNAMEID, this,owner),
     slVolume        (SL_VOLUME_ID,this,this,IRectangle(),
                      ICircularSlider::defaultStyle()
                      | ICircularSlider::proportionalTicks ),
     slBalance       (SL_BALANCE_ID,this,this,IRectangle(),
                      ICircularSlider::defaultStyle()
                      | ICircularSlider::proportionalTicks ),
     slBass          (SL_BASS_ID,this,this,IRectangle(),
                      ICircularSlider::defaultStyle()
                      | ICircularSlider::proportionalTicks ),
     slTreble        (SL_TREBLE_ID,this,this,IRectangle(),
                      ICircularSlider::defaultStyle()
                      | ICircularSlider::proportionalTicks ),
     slPitch         (SL_PITCH_ID,this,this,IRectangle(),
                      ICircularSlider::defaultStyle()
                      | ICircularSlider::proportionalTicks ),
     slGain          (SL_GAIN_ID,this,this,IRectangle(),
                      ICircularSlider::defaultStyle()
                      | ICircularSlider::proportionalTicks ),
     pAmpMixer1(aAmp1),
     pAmpMixer2(aAmp2),
     pAmpMixer3(aAmp3),
     ampHandler()
{
   IResourceLibrary reslib;

   //Set up the title
   name.setText(reslib.loadString(TITLE_MIXER));
   name.setForegroundColor     ( IColor(IColor::kRed)   );

   slVolume.setArmRange          (IRange(0,100));
   slVolume.setRotationIncrement (10);
   slVolume.setTickSpacing       (1);
   slVolume.setText              (reslib.loadString(STR_VOLUME));
   addToCell                     (&slVolume,     1, 1, 1, 1);

   slBalance.setArmRange         (IRange(0,100));
   slBalance.setRotationIncrement(10);
   slBalance.setTickSpacing      (1);
   slBalance.setText             (reslib.loadString(STR_BALANCE));
   addToCell                     (&slBalance,    2, 1, 1, 1);

   slBass.setArmRange            (IRange(0,100));
   slBass.setRotationIncrement   (10);
   slBass.setTickSpacing         (1);
   slBass.setText                (reslib.loadString(STR_BASS));
   addToCell                     (&slBass,       3, 1, 1, 1);

   slTreble.setArmRange          (IRange(0,100));
   slTreble.setRotationIncrement (10);
   slTreble.setTickSpacing       (1);
   slTreble.setText              (reslib.loadString(STR_TREBLE));
   addToCell                     (&slTreble,     4, 1, 1, 1);

   slPitch.setArmRange           (IRange(0,100));
   slPitch.setRotationIncrement  (10);
   slPitch.setTickSpacing        (1);
   slPitch.setText               (reslib.loadString(STR_PITCH));
   addToCell                     (&slPitch,      5, 1, 1, 1);

   slGain.setArmRange            (IRange(0,100));
   slGain.setRotationIncrement   (10);
   slGain.setTickSpacing         (1);
   slGain.setText                (reslib.loadString(STR_GAIN));
   addToCell                     (&slGain,       6, 1, 1, 1);

   addToCell                     (&name,         3, 2, 3, 1);

   ampHandler.handleEventsFor(this);
   IMMAmpMixer* tempAmp = 0;
   if (pAmpMixer3)
      tempAmp=pAmpMixer3;
   else if (pAmpMixer2)
      tempAmp=pAmpMixer2;
   else if (pAmpMixer1)
      tempAmp=pAmpMixer1;
   if (tempAmp)
   {
      slVolume.setValue (tempAmp->volume ());
      slBalance.setValue(tempAmp->balance());
      slBass.setValue   (tempAmp->bass   ());
      slTreble.setValue (tempAmp->treble ());
      slPitch.setValue  (tempAmp->pitch  ());
      slGain.setValue   (tempAmp->gain   ());
   } /* endif */
}
コード例 #4
0
//**************************************************************************
//                         1                   2                   3       *
// Col-> 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2   *
// Row                                                                     *
//  1                                                                      *
//  2                  Hr    Min                                           *
//  3    Start time:  ��Ŀ  ��Ŀ                                           *
//  4                 �  � :�  �                                           *
//  5                 ����  ����                                           *
//  6                                                                      *
//  7    End time:    ��Ŀ  ��Ŀ                                           *
//  8                 �  � :�  �                                           *
//  9                 ����  ����                                           *
// 10                                                                      *
//  1    Phone:       ��������������������������������������������Ŀ       *
//  2                 �                                            �       *
//  3                 ����������������������������������������������       *
//  4                                                                      *
//  5    Location:    ��������������������������������������������Ŀ       *
//  6                 �                                            �       *
//  7                 ����������������������������������������������       *
//  8                                                                      *
//  9    Subject:     ��������������������������������������������Ŀ       *
// 20                 �                                            �       *
//  1                 �                                            �       *
//  2                 �                                            �       *
//  3                 �                                            �       *
//  4                 �                                            �       *
//  5                 ����������������������������������������������       *
//  6                                                                      *
//  7    For user:    ��������������������������������������������Ŀ       *
//  8                 �                                            �       *
//  9                 �                                            �       *
// 30                 �                                            �       *
//  1                 �                                            �       *
//  2                 �                                            �       *
//  3                 ����������������������������������������������       *
//  4                                                                      *
//  5   ������������Ŀ  ������������Ŀ                                     *
//  6   �            �  �            �                                     *
//  7   ��������������  ��������������                                     *
//**************************************************************************
// ApptDialog :: ApptDialog - add a new meeting                            *
//**************************************************************************
ApptDialog :: ApptDialog(Appointment *appt, IWindow * ownerWnd)
            : IFrameWindow(WND_APPTDIALOG,
                           desktopWindow(), // parent
                           ownerWnd,        // owner
                           IRectangle(475,  // width
                                      500), // height
                           IWindow::synchPaint
                            |IWindow::clipSiblings
                            |IWindow::saveBits
                            |systemMenu
                            |titleBar
                            |dialogBorder
                            |dialogBackground,
                           "Create an Appointment"
                           ),
              clientCanvas(WND_CANVAS_APPTDIALOG,this,this),
              buttons(WND_CANVAS_APPTDIALOGBTN,this,this),
              txtStarthr(TXT_STARTHR,&clientCanvas,&clientCanvas),
              txtStophr(TXT_STOPHR,&clientCanvas,&clientCanvas),
              txtStartsep(TXT_STARTSEP,&clientCanvas,&clientCanvas),
              txtStopsep(TXT_STOPSEP,&clientCanvas,&clientCanvas),
              txtLoc(TXT_LOC,&clientCanvas,&clientCanvas),
              txtSubj(TXT_SUBJ,&clientCanvas,&clientCanvas),
              txtPhone(TXT_PHONE,&clientCanvas,&clientCanvas),
              txtUsers(TXT_USERS,&clientCanvas,&clientCanvas),
              fldStarthr(FLD_STARTHR,&clientCanvas,&clientCanvas),
              fldStophr(FLD_STOPHR,&clientCanvas,&clientCanvas),
              fldStartmin(FLD_STARTMIN,&clientCanvas,&clientCanvas),
              fldStopmin(FLD_STOPMIN,&clientCanvas,&clientCanvas),
              fldLoc(FLD_LOC,&clientCanvas,&clientCanvas),
              fldPhone(FLD_PHONE,&clientCanvas,&clientCanvas),
              mleSubj(FLD_SUBJ,&clientCanvas,&clientCanvas),
              lboxUsers(LB_USERS,&clientCanvas,&clientCanvas),
              btnOk(DID_OK,&buttons,&buttons),
              btnCancel(DID_CANCEL,&buttons,&buttons)
{
  ITime ctime;
  apptObject=(Appointment *)appt;
  if (appt->somIsA(_Meeting))
     apptType = MEETING;
  else
     apptType = CCALL;
  setClient(&clientCanvas);
  ICommandHandler::handleEventsFor(this); // Set self as command event handler

  fldStarthr.setInputType(ISpinButton::numeric)
                          .setLimit(2UL)
                          .setAlignment(ISpinButton::right)
                          .setRange(IRange(0,23))
                          .setCurrent((long)ctime.hours());
  fldStartmin.setInputType(ISpinButton::numeric)
                          .setLimit(2UL)
                          .setAlignment(ISpinButton::right)
                          .setRange(IRange(0,59))
                          .setCurrent((long)ctime.minutes());
  fldStophr.setInputType(ISpinButton::numeric)
                          .setLimit(2UL)
                          .setAlignment(ISpinButton::right)
                          .setRange(IRange(0,23))
                          .setCurrent((long)ctime.hours());
  fldStopmin.setInputType(ISpinButton::numeric)
                          .setLimit(2UL)
                          .setAlignment(ISpinButton::right)
                          .setRange(IRange(0,59))
                          .setCurrent((long)ctime.minutes());

  txtStarthr.setText(STR_START);
  txtStophr.setText(STR_STOP);
  txtStartsep.setText(":");
  txtStopsep.setText(":");
  if (apptType == CCALL)
     txtPhone.setText(STR_PHONE);
  else
     txtLoc.setText(STR_LOCATION);
  txtSubj.setText(STR_SUBJECT);
  txtUsers.setText(STR_USERS);
  btnOk.setText(STR_OK);
  btnCancel.setText(STR_CANCEL);
  //                      Field         Col  Row  #Col  #Row
  clientCanvas.addToCell(&txtStarthr  ,   1,   3,   6,   1);
  clientCanvas.addToCell(&txtStophr   ,   1,   7,   6,   1);
  if (apptType == CCALL)
     clientCanvas.addToCell(&txtPhone ,   1,  11,   6,   1);
  else
     clientCanvas.addToCell(&txtLoc   ,   1,  11,   6,   1);
  clientCanvas.addToCell(&txtSubj     ,   1,  15,   6,   1);
  clientCanvas.addToCell(&txtUsers    ,   1,  24,   6,   1);

  clientCanvas.addToCell(&fldStarthr  ,   7,   3,   2,   1);
  clientCanvas.addToCell(&fldStartmin ,  11,   3,   2,   1);
  clientCanvas.addToCell(&fldStophr   ,   7,   7,   2,   1);
  clientCanvas.addToCell(&fldStopmin  ,  11,   7,   2,   1);

  if (apptType == CCALL)
     clientCanvas.addToCell(&fldPhone ,   7,  11,  22,   2);
  else
     clientCanvas.addToCell(&fldLoc   ,   7,  11,  22,   2);
  clientCanvas.addToCell(&mleSubj     ,   7,  15,  22,   7);
  clientCanvas.addToCell(&lboxUsers   ,   7,  24,  22,   7);

  setFocus();
  buttons.setMargin(ISize());            // Set Canvas Margins to zero
  buttons.setPad(ISize());               // Set Button Canvas Pad to zero
  addExtension(&buttons, IFrameWindow::belowClient,
               (unsigned long)buttons.minimumSize().height()+10);
  fldStarthr.setFocus();
}
コード例 #5
0
ファイル: build_tet_faces.cpp プロジェクト: tjolsen/YAFEL
YAFEL_NAMESPACE_OPEN

void Element::build_tet_faces()
{
    std::vector<std::function<bool(coordinate<>)>> boundary_funcs{
            [](coordinate<> xi) { return std::abs(sum(xi) - 1.0) < 1.0e-6; },
            [](coordinate<> xi) { return std::abs(xi(0)) < 1.0e-6; },
            [](coordinate<> xi) { return std::abs(xi(1)) < 1.0e-6; },
            [](coordinate<> xi) { return std::abs(xi(2)) < 1.0e-6; },
    };

    face_perm.resize(4);
    for (auto &F : face_perm) {
        F.resize(3);
        for (auto &f : F) {
            f.resize(2);
        }
    }


    std::vector<std::vector<int>> face_node_indices(4);
    for(auto n_idx : IRange(0,localMesh.nNodes())) {
        auto xi = localMesh.getGeometryNodes()[n_idx];
        for(auto f_idx : IRange(0,4)) {
            if(boundary_funcs[f_idx](xi)) {
                face_node_indices[f_idx].push_back(n_idx);
            }
        }
    }

    std::vector<std::function<coordinate<>(coordinate<>)>> space_to_face_coords
            {
                    [](coordinate<> xi)->coordinate<>{return {xi(1),xi(2),0};},
                    [](coordinate<> xi)->coordinate<>{return {xi(1), xi(2),0};},
                    [](coordinate<> xi)->coordinate<>{return {xi(0), xi(2),0};},
                    [](coordinate<> xi)->coordinate<>{return {xi(0), xi(1), 0};}
            };


    std::vector<std::function<coordinate<>(coordinate<>)>> face_to_neighbor_coords
            {
                    [](coordinate<> xi)->coordinate<>{return {xi(1),xi(0),0};},
                    [](coordinate<> xi)->coordinate<>{return {1 - sum(xi),xi(1),0};},
                    [](coordinate<> xi)->coordinate<>{return {xi(0),1-sum(xi),0};}
            };



    for(auto f_idx : IRange(0,4)) {

        std::vector<coordinate<>> f_coords;
        for(auto n : face_node_indices[f_idx]) {
            auto x = localMesh.getGeometryNodes()[n];
            auto xf = space_to_face_coords[f_idx](x);
            f_coords.push_back(xf);
        }

        for(auto p : IRange(0,3)) {
            std::vector<coordinate<>> neighbor_f_coords;

            for(auto xf : f_coords) {
                auto nxf = face_to_neighbor_coords[p](xf);
                neighbor_f_coords.push_back(nxf);
            }

            //do something with the neighbor face params (sorting?)
        }

    }
}
コード例 #6
0
/*------------------------------------------------------------------------------
| SampleDialog::numericSpinButton                                              |
------------------------------------------------------------------------------*/
SampleDialog& SampleDialog ::
              numericSpinButton( INumericSpinButton* pSpinButton )
{
  pSpinButton->setRange( IRange( 0, 50 ) );
  return( *this );
}
コード例 #7
0
ファイル: build_faces.cpp プロジェクト: tjolsen/YAFEL
void Mesh::buildInternalFaces()
{
    if(faces_built) {
        return;
    }
    faces_built = true;


    //build naive list of faces
    int num_naive_faces{0};
    for (auto i : IRange(0, nCells())) {
        num_naive_faces += numCellFaces(getCellType(i));
    }

    internal_faces_.clear();
    internal_faces_.reserve(num_naive_faces);
    std::vector<int> cell_nodes(8);

    for (auto i : IRange(0, nCells())) {

        getCellNodes(i, cell_nodes);
        auto ct = getCellType(i);

        for(auto f : IRange(0, numCellFaces(ct))) {
            auto F = CellFace::canonicalCellFace(ct,f);
            for(auto n : IRange(0,F.n_nodes)) {
                F.nodes[n] = cell_nodes[F.nodes[n]];
            }
            F.left = i;
            F.left_flocal = f;
            F.orient();
            internal_faces_.push_back(F);
        }
    }

    std::sort(internal_faces_.begin(), internal_faces_.end(),
              [](const CellFace &L, const CellFace &R) { return L.nodes < R.nodes; }
    );

    for (auto i : IRange(1, static_cast<int>(internal_faces_.size()))) {
        auto &F = internal_faces_[i];
        auto &Fprev = internal_faces_[i - 1];
        if (F.nodes == Fprev.nodes) {

            Fprev.left = std::max(Fprev.left, F.left);
            Fprev.right = std::max(Fprev.right, F.right);
            Fprev.left_flocal = std::max(Fprev.left_flocal, F.left_flocal);
            Fprev.right_flocal = std::max(Fprev.right_flocal, F.right_flocal);
            Fprev.left_rot = std::max(Fprev.left_rot, F.left_rot);
            Fprev.right_rot = std::max(Fprev.right_rot, F.right_rot);
        }

    }

    auto new_end = std::unique(internal_faces_.begin(),
                               internal_faces_.end(),
                               [](const CellFace &L, const CellFace &R) { return L.nodes == R.nodes; });

    auto new_size = std::distance(internal_faces_.begin(), new_end);
    internal_faces_.resize(new_size);
    internal_faces_.shrink_to_fit();

    for (auto i : IRange(0, static_cast<int>(internal_faces_.size()))) {
        if (internal_faces_[i].left < 0 || internal_faces_[i].right < 0) {
            boundary_face_idxs_.push_back(i);
        }
    }
}