Пример #1
0
void Window::checkIfIsOffScreen(bool partially, bool entirely)
{
    // Move the window onto screen if it has become off screen
    // For instance, because of resolution change...

    // First of all, don't deal when a window hasn't got
    // any size initialized yet...
    if (getWidth() == 0 && getHeight() == 0)
        return;

    // Made partially the default behaviour
    if (!partially && !entirely)
        partially = true;

  // Keep guichan window inside screen (supports resizing any side)

    gcn::Rectangle winDimension =  getDimension();

    if (winDimension.x < 0)
    {
        winDimension.width += winDimension.x;
        winDimension.x = 0;
    }
    if (winDimension.y < 0)
    {
        winDimension.height += winDimension.y;
        winDimension.y = 0;
    }

    // Look if the window is partially off-screen limits...
    if (partially)
    {
        if (winDimension.x + winDimension.width > graphics->getWidth())
        {
            winDimension.x = graphics->getWidth() - winDimension.width;
        }

        if (winDimension.y + winDimension.height > graphics->getHeight())
        {
            winDimension.y = graphics->getHeight() - winDimension.height;
        }
        setDimension(winDimension);
        return;
    }

    if (entirely)
    {
        if (winDimension.x > graphics->getWidth())
        {
            winDimension.x = graphics->getWidth() - winDimension.width;
        }

        if (winDimension.y > graphics->getHeight())
        {
            winDimension.y = graphics->getHeight() - winDimension.height;
        }
    }
    setDimension(winDimension);
}
void FilenameBox::resetPositions(){
    //make the window a standard size
    setDimension( gcn::Rectangle(0,0,450,100) );

    //position the elements
    bodyText->setX( 0 );
    //input field
    input->setX( bodyText->getX() + bodyText->getWidth() +2 );
    input->setWidth( getWidth() - (input->getX()+10) );

    //buttons
    cancelButton->setX( getWidth() - cancelButton->getWidth() -10 );
    doneButton->setX( cancelButton->getX() - doneButton->getWidth() );

    //label y near center
    bodyText->setY( 30 );
    input->setY( 30 );

    //button right bottom
    doneButton->setY( getHeight() - doneButton->getHeight() -20);
    doneButton->setFrameSize(0);
    cancelButton->setY( doneButton->getY() );
    cancelButton->setFrameSize(0);

    //put window in center
    setPosition((1024+getWidth())/4, (764+getHeight())/4);
}
Пример #3
0
RMatrix&  RMatrix::attachRows (const RMatrix& A)
 {
    //! \todo zcopy_ verwenden
    const LongInt n  = numberOfColumns();
    const LongInt m1 = numberOfRows();
    const LongInt m2 = A.numberOfRows();
    const LongInt m  = m1+m2; 

    RMatrix temp((*this));

    setDimension(m,n);
     
    for(LongInt j=0; j<n; j++)
     {  
        LongInt i;
        for(i=0; i<m1; i++)
         {
            (*this)(i,j) = temp(i,j);
         }
        for(i=0; i<m2; i++)
         {
            (*this)(i+m1,j) = A(i,j);
         }
     }

   return (*this);
 }
Пример #4
0
WindowMenu::WindowMenu():
    mEmotePopup(0)
{
    int x = 0, h = 0;

    addButton(":-)", x, h, "button-icon-smilies.png");
    addButton(N_("Status"), x, h, "button-icon-status.png",
              KeyboardConfig::KEY_WINDOW_STATUS);
    addButton(N_("Inventory"), x, h, "button-icon-inventory.png",
              KeyboardConfig::KEY_WINDOW_INVENTORY);
    addButton(N_("Equipment"), x, h, "button-icon-equipment.png",
              KeyboardConfig::KEY_WINDOW_EQUIPMENT);

    if (skillDialog->hasSkills())
        addButton(N_("Skills"), x, h, "button-icon-skills.png",
                  KeyboardConfig::KEY_WINDOW_SKILL);

    if (specialsWindow->hasSpecials())
        addButton(N_("Specials"), x, h, "button-icon-specials.png");

    addButton(N_("Social"), x, h, "button-icon-social.png",
        KeyboardConfig::KEY_WINDOW_SOCIAL);
    addButton(N_("Shortcuts"), x, h, "button-icon-shortcut.png",
        KeyboardConfig::KEY_WINDOW_SHORTCUT);
    addButton(N_("Setup"), x, h, "button-icon-setup.png",
        KeyboardConfig::KEY_WINDOW_SETUP);

    setDimension(gcn::Rectangle(graphics->getWidth() - x, 3,
                                x - 3, h));
    setVisible(true);
}
Пример #5
0
TargetDebugTab::TargetDebugTab()
{
    LayoutHelper h(this);
    ContainerPlacer place = h.getPlacer(0, 0);

    mTargetLabel = new Label(strprintf("%s ?", _("Target:")));
    mTargetIdLabel = new Label(strprintf("%s ?     ", _("Target Id:")));
    mTargetLevelLabel = new Label(strprintf("%s ?", _("Target level:")));
    mTargetRaceLabel = new Label(strprintf("%s ?", _("Target race:")));
    mTargetPartyLabel = new Label(strprintf("%s ?", _("Target party:")));
    mTargetGuildLabel = new Label(strprintf("%s ?", _("Target guild:")));
    mAttackDelayLabel = new Label(strprintf("%s ?", _("Attack delay:")));
    mMinHitLabel = new Label(strprintf("%s ?", _("Minimal hit:")));
    mMaxHitLabel = new Label(strprintf("%s ?", _("Maximum hit:")));
    mCriticalHitLabel = new Label(strprintf("%s ?", _("Critical hit:")));

    place(0, 0, mTargetLabel, 2);
    place(0, 1, mTargetIdLabel, 2);
    place(0, 2, mTargetLevelLabel, 2);
    place(0, 3, mTargetRaceLabel, 2);
    place(0, 4, mAttackDelayLabel, 2);
    place(0, 5, mTargetPartyLabel, 2);
    place(0, 6, mTargetGuildLabel, 2);
    place(0, 7, mMinHitLabel, 2);
    place(0, 8, mMaxHitLabel, 2);
    place(0, 9, mCriticalHitLabel, 2);

    place.getCell().matchColWidth(0, 0);
    place = h.getPlacer(0, 1);
    setDimension(gcn::Rectangle(0, 0, 600, 300));
}
Пример #6
0
RMatrix&  RMatrix::isConversionOf (const AMatrix& A)
 {    
    const AMatrixType theMatrixA = A.type();
    
    if(theMatrixA==isRMatrix)
     {
        (*this) = (RMatrix&) A;
     }
    else if(theMatrixA==isRkRMatrix)
     {
        (*this) = ((RkRMatrix&) A).convert2RMatrix();
     }
    else 
     {
        const LongInt m = A.numberOfRows();
        const LongInt n = A.numberOfColumns();
        
        RVector temp(n);

        setDimension(m, n);

        for(LongInt j=0; j<n; j++)
         {
            RVector helpVp_w(m, &(*this)(0,j));
            temp(j) = 1.0;
            A(0, helpVp_w, 0, temp);
            temp(j) = 0.0;
         }           
     }

   return (*this);
 }
Пример #7
0
Setup_Keyboard::Setup_Keyboard():
    mKeyListModel(new KeyListModel),
    mKeyList(new ListBox(mKeyListModel)),
    mKeySetting(false)
{
    keyboard.setSetupKeyboard(this);
    setName(_("Keyboard"));

    refreshKeys();

    mKeyList->addActionListener(this);

    ScrollArea *scrollArea = new ScrollArea(mKeyList);
    scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);

    mAssignKeyButton = new Button(_("Assign"), "assign", this);
    mAssignKeyButton->addActionListener(this);
    mAssignKeyButton->setEnabled(false);

    mMakeDefaultButton = new Button(_("Default"), "makeDefault", this);
    mMakeDefaultButton->addActionListener(this);

    // Do the layout
    LayoutHelper h(this);
    ContainerPlacer place = h.getPlacer(0, 0);

    place(0, 0, scrollArea, 4, 6).setPadding(2);
    place(0, 6, mMakeDefaultButton);
    place(3, 6, mAssignKeyButton);

    setDimension(gcn::Rectangle(0, 0, 365, 280));
}
Пример #8
0
void LeastSquareSolver::solve(const Matrix& A,const Vector& b)
{
    // Assert the combination
    if (A.rows()!=b.size())
    {
        std::cerr<<"Warning: The shape of input matrix 'A' and vector 'b' is not consistent! Least square solver ends"<<std::endl;
        return;
    }
    else if (A.cols() != __dim)
    {
        std::cerr<<"Warning: The shape of input matrix 'A' is not consistent with the dimension of the problem. The dimension is changed automatically"<<std::endl;
        setDimension(A.cols());
    }

    switch (__lstype)
    {
    case Tra:
        solveTraditional(A,b);
        break;
    case LMS:
        solveLMS(A,b);
        break;
    case RLS:
        solveRLS(A,b);
        break;
    default:
        break;
    }

}
Пример #9
0
void NTNDArrayRecord::update()
{
    lock();
    try
    {
        beginGroupPut();
        PVUByteArray::svector bytes;
        imageGen->fillSharedVector(bytes,angle);
        setValue(freeze(bytes));
        if (firstTime)
        {
            int dims[] = { imageGen->getWidth(), imageGen->getHeight() };
            setDimension(dims, 2);
            setAttributes();
            setSizes(static_cast<int64_t>(imageGen->getSize()));
            firstTime = false;
        }
        setDataTimeStamp();
        setUniqueId(count++);
        process();
        endGroupPut();
    }
    catch(...)
    {
        unlock();
        throw;
    }
    angle += 1;
    unlock();
}
Пример #10
0
MapDebugTab::MapDebugTab() :
    mTexturesLabel(nullptr)
{
    LayoutHelper h(this);
    ContainerPlacer place = h.getPlacer(0, 0);

    mMusicFileLabel = new Label(strprintf(_("Music:")));
    mMapLabel = new Label(strprintf(_("Map:")));
    mMinimapLabel = new Label(strprintf(_("Minimap:")));
    mTileMouseLabel = new Label(strprintf("%s (%d, %d)", _("Cursor:"), 0, 0));
    mXYLabel = new Label(strprintf("%s (?,?)", _("Player Position:")));

    mParticleCountLabel = new Label(strprintf("%s %d",
        _("Particle count:"), 88888));
    mMapActorCountLabel = new Label(strprintf("%s %d",
        _("Map actors count:"), 88888));

    mUpdateTime = 0;

#ifdef USE_OPENGL
    switch (imageHelper->useOpenGL())
    {
        case 0:
            mFPSText = _("%d FPS (Software)");
            break;
        case 1:
        default:
            mFPSText = _("%d FPS (fast OpenGL)");
            break;
        case 2:
            mFPSText = _("%d FPS (old OpenGL)");
            break;
    };
#else
    mFPSText = _("%d FPS (Software)");
#endif

    mFPSLabel = new Label(strprintf(_("%d FPS"), 0));
    mLPSLabel = new Label(strprintf(_("%d LPS"), 0));

    place(0, 0, mFPSLabel, 2);
    place(0, 1, mLPSLabel, 2);
    place(0, 2, mMusicFileLabel, 2);
    place(0, 3, mMapLabel, 2);
    place(0, 4, mMinimapLabel, 2);
    place(0, 5, mXYLabel, 2);
    place(0, 6, mTileMouseLabel, 2);
    place(0, 7, mParticleCountLabel, 2);
    place(0, 8, mMapActorCountLabel, 2);
#ifdef USE_OPENGL
#ifdef DEBUG_OPENGL_LEAKS
    mTexturesLabel = new Label(strprintf("%s %s", _("Textures count:"), "?"));
    place(0, 9, mTexturesLabel, 2);
#endif
#endif
    place.getCell().matchColWidth(0, 0);
    place = h.getPlacer(0, 1);
    setDimension(gcn::Rectangle(0, 0, 600, 300));
}
void NonGradient::initialize_mesh_iteration(PatchData &pd, MsqError &err)
{
  int elementDimension = getPatchDimension( pd, err );  // to do: react to error
  int dimension = elementDimension * pd.num_free_vertices();
  //printPatch( pd, err );
  setDimension(dimension);
  int maxNumEval = 100*dimension;  // 1. Make this a user parameter
  setMaxNumEval(maxNumEval);
  double threshold = 1.e-10; // avoid division by zero
  setThreshold(threshold);
  double minEdgeLen = 0.0;
  double maxEdgeLen = 0.0;
//  double ftol = 0.;
  if( dimension > 0 )
  {
    pd.get_minmax_edge_length( minEdgeLen, maxEdgeLen );
    //ftol = minEdgeLen * 1.e-4; // Turn off Amoeba convergence criterion
    if( mNonGradDebug >= 1 ) 
    {      
         std::cout << "minimum edge length " << minEdgeLen << " maximum edge length " << maxEdgeLen << std::endl;
    }      
    MSQ_PRINT(3)("minimum edge length %e    maximum edge length %e\n", minEdgeLen,  maxEdgeLen);
  }
//  setTolerance(ftol);
  int numRow = dimension;
  int numCol = numRow+1;  
  if( numRow*numCol <= simplex.max_size() )
  { 
    simplex.assign(numRow*numCol, 0.);  // guard against previous simplex value
    double scale = minEdgeLen * mScaleDiameter;; 
    const MsqVertex* coord = pd.get_vertex_array(err);
    if( pd.num_free_vertices() > 1 )
    {
      MSQ_SETERR(err)("Only one free vertex per patch implemented", MsqError::NOT_IMPLEMENTED);
    }
    size_t index = 0;
    for( int col = 0; col < numCol; col++ )
    {
      for (int row=0;row<numRow;row++)
      {
        simplex[ row + col*numRow ] = coord[index][row];
        if( row == col-1 )
        {
          simplex[ row + col*numRow ] += scale/ static_cast<double>(numCol);
        }
      }
    }
  }
  else
  {
    MSQ_SETERR(err)("Use patch with fewer free vertices", MsqError::OUT_OF_MEMORY);
    if( mNonGradDebug >= 1 ) 
    {      
      std::cout << "ERROR: Too many free vertices in patch" << std::endl;
    }      
    //MSQ_PRINT(1)("ERROR: Too many free vertices in patch\n");
  }
}
Пример #12
0
PgSQLType::PgSQLType(unsigned type_id, unsigned length, unsigned dimension, int precision, bool with_timezone, IntervalType interv_type, SpatialType spatial_type) : PgSQLType()
{
	(*this)=type_id;
	setLength(length);
	setDimension(dimension);
	setPrecision(precision);
	setWithTimezone(with_timezone);
	setIntervalType(interv_type);
	setSpatialType(spatial_type);
}
Пример #13
0
PgSQLType::PgSQLType(const QString &type_name, unsigned length, unsigned dimension, int precision, bool with_timezone, IntervalType interv_type, SpatialType spatial_type)
{
	(*this)=type_name;
	setLength(length);
	setDimension(dimension);
	setPrecision(precision);
	setWithTimezone(with_timezone);
	setIntervalType(interv_type);
	setSpatialType(spatial_type);
}
Пример #14
0
void RadioButton::setText(string text) {
    label->setText(text);
    int radius = label->getFont()->lineHeight() * 0.7;

    label->setLocation(radius * 2, 0);

    if (isAutoDimension()) {
        setDimension(getCalculatedDimension());
    }
}
Пример #15
0
CheckBox::CheckBox(Component *component): Component(component), checked(false) {
//	emptyTexture = loadAsTexture(component.getRenderer(), "tick.png");
//	checkedTexture = loadAsTexture(component.getRenderer(), "tick-checked.png");

	setDimension(20, 20);

	onClick.push_back([&]() -> void {
		checked = !checked;
	});
}
Пример #16
0
Schema InPlaceReprojection::alterSchema(Schema& schema)
{


    const std::string x_name = getOptions().getValueOrDefault<std::string>("x_dim", "X");
    const std::string y_name = getOptions().getValueOrDefault<std::string>("y_dim", "Y");
    const std::string z_name = getOptions().getValueOrDefault<std::string>("z_dim", "Z");

    log()->get(logDEBUG2) << "x_dim '" << x_name <<"' requested" << std::endl;
    log()->get(logDEBUG2) << "y_dim '" << y_name <<"' requested" << std::endl;
    log()->get(logDEBUG2) << "z_dim '" << z_name <<"' requested" << std::endl;

    Dimension const& dimX = schema.getDimension(x_name);
    Dimension const& dimY = schema.getDimension(y_name);
    Dimension const& dimZ = schema.getDimension(z_name);
    
    log()->get(logDEBUG3) << "Fetched x_name: " << dimX;
    log()->get(logDEBUG3) << "Fetched y_name: " << dimY;
    log()->get(logDEBUG3) << "Fetched z_name: " << dimZ;
    
    double offset_x = getOptions().getValueOrDefault<double>("offset_x", dimX.getNumericOffset());
    double offset_y = getOptions().getValueOrDefault<double>("offset_y", dimY.getNumericOffset());
    double offset_z = getOptions().getValueOrDefault<double>("offset_z", dimZ.getNumericOffset());

    log()->floatPrecision(8);

    log()->get(logDEBUG2) << "original offset x,y: " << offset_x <<"," << offset_y << std::endl;
    reprojectOffsets(offset_x, offset_y, offset_z);
    log()->get(logDEBUG2) << "reprojected offset x,y: " << offset_x <<"," << offset_y << std::endl;

    double scale_x = getOptions().getValueOrDefault<double>("scale_x", dimX.getNumericScale());
    double scale_y = getOptions().getValueOrDefault<double>("scale_y", dimY.getNumericScale());
    double scale_z = getOptions().getValueOrDefault<double>("scale_z", dimZ.getNumericScale());

    setDimension(x_name, m_old_x_id, m_new_x_id, schema, scale_x, offset_x);
    setDimension(y_name, m_old_y_id, m_new_y_id, schema, scale_y, offset_y);
    setDimension(z_name, m_old_z_id, m_new_z_id, schema, scale_z, offset_z);
    
    return schema;
    
}
Пример #17
0
void OccupationMap::setCellSize(int cx, int cy) {
  if (cx == 0 || cy == 0) {
    return;
  }
  MatrixDimension gridDim;
  if (m_winSize.cx > 0) {
    gridDim.columnCount = (int)ceil((double)m_winSize.cx / cx);
  }
  if (m_winSize.cy > 0) {
    gridDim.rowCount = (int)ceil((double)m_winSize.cy / cy);
  }
  m_cellSize = CSize(cx, cy);
  setDimension(gridDim);
}
Пример #18
0
ProfileChooser::ProfileChooser ( GuiMain *gMain ) : GuiObject(gMain)
{
	setVisible ( false );

	mOk.setCaption ( "Ok" );
	mCancel.setCaption ( "Cancel" );

	mOk.addActionListener ( this );
	mCancel.addActionListener ( this );
	mCreateNew.addActionListener ( this );

	mOk.setActionEventId ( "mOk" );
	mCancel.setActionEventId ( "mCancel" );
	mCreateNew.setActionEventId ( "mCreateNew" );

	mProfileLabel.setCaption ( "Profile" );
	mNewProfileLabel.setCaption ( "Profile" );
	mCreateNew.setCaption ( "Create New" );

	mProfile.setListModel ( &mProfileList );

	/*
	 * Size and place our widgets
	 */
	add ( &mProfileLabel );
	add ( &mNewProfileLabel );
	add ( &mProfile );
	add ( &mNewProfile );
	add ( &mCreateNew );
	add ( &mOk );
	add ( &mCancel );

	setCaption ( "Choose Profile or Create New" );
	setDimension ( mGuiMain->getRectangle(10,8,60,10) );
	mProfileLabel.setDimension ( mGuiMain->getRectangle(2,1,8,1.2) );
	mProfile.setDimension ( mGuiMain->getRectangle(10,1,45,1.2) );
	mCreateNew.setDimension ( mGuiMain->getRectangle(2,3,10,1.2) );
	mNewProfileLabel.setDimension ( mGuiMain->getRectangle(2,5,8,1.2) );
	mNewProfile.setDimension ( mGuiMain->getRectangle(10,5,45,1.2) );
	mOk.setDimension ( mGuiMain->getRectangle(21,7,4,1.2) );
	mCancel.setDimension ( mGuiMain->getRectangle(31,7,4,1.2) );

	mProfileLabel.adjustSize();
	mProfile.adjustHeight();
	mCreateNew.adjustSize();
	mNewProfile.adjustHeight();
	mOk.adjustSize();
	mCancel.adjustSize();
}
Пример #19
0
int main() {

  std::cout << "Initialising problem..." << std::endl;
  auto initialiser = std::make_shared<vof::DoubleMachInitialiser>();
  initialiser->setResolution(0, 400);
  initialiser->setResolution(1, 300);
  initialiser->setDimension(2);

  std::cout << "Running simulation..." << std::endl;
  vof::Controller<2, vof::FluxCalculatorGodunovImpl<2> > controller(initialiser);
  controller.runSimulation();
  std::cout << "Simulation completed successfully!" << std::endl;

  return 0;
}
Пример #20
0
NetDebugTab::NetDebugTab()
{
    LayoutHelper h(this);
    ContainerPlacer place = h.getPlacer(0, 0);

    mPingLabel = new Label("                ");
    mInPackets1Label = new Label("                ");
    mOutPackets1Label = new Label("                ");

    place(0, 0, mPingLabel, 2);
    place(0, 1, mInPackets1Label, 2);
    place(0, 2, mOutPackets1Label, 2);

    place.getCell().matchColWidth(0, 0);
    place = h.getPlacer(0, 1);
    setDimension(gcn::Rectangle(0, 0, 600, 300));
}
Пример #21
0
InfoClanTab::InfoClanTab(const Widget2 *const widget) :
    Container(widget),
    mNameLabel(new Label(this, "                ")),
    mMasterLabel(new Label(this, "                ")),
    mMapLabel(new Label(this, "                "))
{
    setSelectable(false);

    LayoutHelper h(this);
    ContainerPlacer place = h.getPlacer(0, 0);

    place(0, 0, mNameLabel, 2, 1);
    place(0, 1, mMasterLabel, 2, 1);
    place(0, 2, mMapLabel, 2, 1);

    place.getCell().matchColWidth(0, 0);
    setDimension(Rect(0, 0, 600, 300));
}
Пример #22
0
RMatrix& RMatrix :: operator = (const RMatrix& A)
 {	
    LongInt n = A.numberOfRows();
    LongInt m = A.numberOfColumns();   
    
    setDimension(n, m);
 
    attr_type  =  A.attr_type;
    setTranspose(A.isTranspose());
    

    integer dim = n*m;
    integer nx  = 1;

    TensorCalculus::Blas<double>::copy (dim, (&A._pelm[0]), nx, (&this->_pelm[0]), nx);
    
   return (*this);
 }
AlgMultiArranque::AlgMultiArranque(vector<Cluster*>& clusters, vector<Objeto*>& objetos) {
	setNombreAlgoritmo(" Técnica MultiArranque ");
	setObjetos(objetos);
	setClusters(clusters);
	setDimension(getClusters()[0]->getDimension());

	int* sol = new int [getObjetos().size()];
	_solActual = new int [getObjetos().size()];
	_mejorSol = new int [getObjetos().size()];
	for (unsigned int i = 0; i < getObjetos().size(); ++i) {
		sol[i] = -1;
	}
	setSolucion(sol);
	delete [] sol;
	_tecnicaLocal = NULL;
	_centroidesFin = new int *[getClusters().size()];
	for (unsigned int i = 0; i < getClusters().size(); ++i)
		_centroidesFin[i] = new int[getDimension()];
}
Пример #24
0
//! constructor
CGameUnitsFormation::CGameUnitsFormation(
	core::dimension2di dim, s32 formation_id
	) :
FormationID(-1), MaxUnitsCount(0), FormationState(EFS_FORMING), Commander(0),
FirstForming(true)
{
#if MY_DEBUG_MODE  
	setClassName("CGameUnitsFormation");
#endif

	setFormationID(formation_id);
	setDimension(dim);	

	core::array< core::vector2df > points;

	points.push_back( core::vector2df(   0.0f,  0.0f ) );
	points.push_back( core::vector2df(  50.0f, 0.25f ) );
	points.push_back( core::vector2df( 100.0f,  1.0f ) );

	SpeedInterpolator.init(points.pointer(), points.size());	
}
Пример #25
0
RMatrix& RMatrix::isReorganized(const RMatrix& A)
 {    
    const LongInt n = A.numberOfColumns();

    if(true) //!todo Pr�fe ob n eine Quadratzahl ist!
     {
       const LongInt m = (LongInt) (sqrt((LongReal)n)+0.5);

       setDimension(n, n);
    
       LongInt i=0, j=0, iA=0, jA=0;

       for(LongInt i1=0; i1<m; i1++)
        {
           for(LongInt i2=0; i2<m; i2++)
            {
               for(LongInt j1=0; j1<m; j1++)
                {
                   for(LongInt j2=0; j2<m; j2++)
                    {
                       i  = i1+j1*m;
                       j  = i2+j2*m;

                       iA = i1+i2*m;
                       jA = j1+j2*m;
     
                       (*this)(i,j) = A(iA,jA);
                    }
                }
            }
        }
     }
    else
     {
        throw SimpleException(IString("Warning In RMatrix::isReorganized(const RMatrix& A), rows!=columns!!!"));
     }

   return (*this);
 }
Пример #26
0
RMatrix& RMatrix::attachColumns (const RMatrix& A)
 {
    const LongInt m  = numberOfRows();
    const LongInt n1 = numberOfColumns();
    const LongInt n2 = A.numberOfColumns();
    const LongInt n  = n1+n2;

    RMatrix temp((*this));
  
    setDimension(m, n);

    integer dim1 = m*n1;
    integer nx   = 1;

    // dcopy (&dim1, (LongReal*)(&temp._pelm[0]), &nx, (LongReal*)(&_pelm[0]), &nx);
    TensorCalculus::Blas<double>::copy (dim1, (&temp._pelm[0]), nx, (&_pelm[0]), nx);

    integer dim2 = m*n2;

    // dcopy (&dim2, (LongReal*)(&A._pelm[0]), &nx, (LongReal*)(&_pelm[dim1]), &nx);
    TensorCalculus::Blas<double>::copy (dim2, (&A._pelm[0]), nx, (&_pelm[dim1]), nx);

   return (*this);
 }
Пример #27
0
Setup_Joystick::Setup_Joystick():
    mCalibrateLabel(new Label(_("Press the button to start calibration"))),
    mCalibrateButton(new Button(_("Calibrate"), "calibrate", this)),
    mJoystickEnabled(new CheckBox(_("Enable joystick")))
{
    setName(_("Joystick"));

    mOriginalJoystickEnabled = !config.getBoolValue("joystickEnabled");
    mJoystickEnabled->setSelected(mOriginalJoystickEnabled);

    mJoystickEnabled->addActionListener(this);

    // Do the layout
    LayoutHelper h(this);
    ContainerPlacer place = h.getPlacer(0, 0);

    place(0, 0, mJoystickEnabled);
    place(0, 1, mCalibrateLabel);
    place.getCell().matchColWidth(0, 0);
    place = h.getPlacer(0, 1);
    place(0, 0, mCalibrateButton);

    setDimension(gcn::Rectangle(0, 0, 370, 75));
}
Пример #28
0
WindowMenu::WindowMenu():
    mEmotePopup(0)
{
    int x = 0, h = 0;

    //addButton(":-)", x, h);
    addButton(N_("Status"), x, h);
    addButton(N_("Equipment"), x, h);
    addButton(N_("Inventory"), x, h);

    //if (skillDialog->hasSkills())
    //addButton(N_("Skills"), x, h);

    // if (specialsWindow->hasSpecials())
    //addButton(N_("Specials"), x, h);

    //addButton(N_("Social"), x, h);
    addButton(N_("Shortcut"), x, h);
    addButton(N_("Setup"), x, h);

    setDimension(gcn::Rectangle(graphics->getWidth() - x - 3, 3,
                                x - 3, h));
    setVisible(true);
}
Пример #29
0
Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) :
    SetupTabScroll(widget),
#ifdef USE_SDL2
    mSdlDriversList(new NamesModel),
#endif  // USE_SDL2
    mTexturesList(new NamesModel)
{
    // TRANSLATORS: settings tab name
    setName(_("Performance"));

    // Do the layout
    LayoutHelper h(this);
    ContainerPlacer place = h.getPlacer(0, 0);
    place(0, 0, mScroll, 10, 10);

#ifdef USE_SDL2
    StringVect sdlDriversList;
    SDL::getRenderers(sdlDriversList,
        config.getStringValue("sdlDriver"));
    sdlDriversList.insert(sdlDriversList.begin(),
        // TRANSLATORS: sdl driver name
        N_("default"));
#endif  // USE_SDL2

    // TRANSLATORS: settings option
    new SetupItemLabel(_("Better performance (enable for better performance)"),
        "", this,
        Separator_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Auto adjust performance"), "",
        "adjustPerfomance", this, "adjustPerfomanceEvent",
        MainConfig_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Hw acceleration"), "",
        "hwaccel", this, "hwaccelEvent",
        MainConfig_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Enable opacity cache (Software, can "
        "use much memory)"), "", "alphaCache", this, "alphaCacheEvent",
        MainConfig_true);

#ifndef USE_SDL2
    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Enable map reduce (Software)"), "",
        "enableMapReduce", this, "enableMapReduceEvent",
        MainConfig_true);
#endif  // USE_SDL2

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Enable compound sprite delay (Software)"), "",
        "enableCompoundSpriteDelay", this, "enableCompoundSpriteDelayEvent",
        MainConfig_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Enable delayed images load (OpenGL)"), "",
        "enableDelayedAnimations", this, "enableDelayedAnimationsEvent",
        MainConfig_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Enable texture sampler (OpenGL)"), "",
        "useTextureSampler", this, "useTextureSamplerEvent",
        MainConfig_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Enable OpenGL context creation"),
        "", "openglContext", this, "openglContextEvent",
        MainConfig_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Enable OpenGL direct state access"),
        "", "enableDSA", this, "enableDSAEvent",
        MainConfig_true);


    // TRANSLATORS: settings option
    new SetupItemLabel(_("Better quality (disable for better performance)"),
        "", this,
        Separator_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Enable alpha channel fix (Software, can "
        "be very slow)"), "Can slow down drawing", "enableAlphaFix",
        this, "enableAlphaFixEvent",
        MainConfig_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Show beings transparency"), "",
        "beingopacity", this, "beingopacityEvent",
        MainConfig_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Enable reorder sprites (need for mods support)."),
        "", "enableReorderSprites", this, "enableReorderSpritesEvent",
        MainConfig_true);


#ifndef USE_SDL2
    // TRANSLATORS: settings option
    new SetupItemLabel(_("Small memory (enable for lower memory usage)"),
         "", this,
        Separator_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Disable advanced beings caching (Software)"), "",
        "disableAdvBeingCaching", this, "disableAdvBeingCachingEvent",
        MainConfig_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Disable beings caching (Software)"), "",
        "disableBeingCaching", this, "disableBeingCachingEvent",
        MainConfig_true);
#endif  // USE_SDL2


    // TRANSLATORS: settings group
    new SetupItemLabel(_("Different options (enable or disable can "
        "improve performance)"), "", this,
        Separator_true);

#ifdef USE_SDL2
    mSdlDriversList->fillFromVector(sdlDriversList);
    new SetupItemDropDownStr(
        // TRANSLATORS: settings option
        _("Try first sdl driver (only for SDL2 default mode)"),
        "", "sdlDriver", this, "sdlDriverEvent", mSdlDriversList, 100,
        MainConfig_true);
#endif  // USE_SDL2

    mTexturesList->fillFromArray(&texturesList[0], texturesListSize);
    // TRANSLATORS: settings option
    new SetupItemDropDown(_("Enable texture compression (OpenGL)"), "",
        "compresstextures", this, "compresstexturesEvent", mTexturesList, 100,
        MainConfig_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Enable rectangular texture extension (OpenGL)"),
        "", "rectangulartextures", this, "rectangulartexturesEvent",
        MainConfig_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Use new texture internal format (OpenGL)"),
        "", "newtextures", this, "newtexturesEvent",
        MainConfig_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Enable texture atlases (OpenGL)"), "",
        "useAtlases", this, "useAtlasesEvent",
        MainConfig_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Cache all sprites per map (can use "
        "additional memory)"), "", "uselonglivesprites", this,
        "uselonglivespritesEvent",
        MainConfig_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Cache all sounds (can use additional memory)"),
        "", "uselonglivesounds", this,
        "uselonglivesoundsEvent",
        MainConfig_true);

    // TRANSLATORS: settings group
    new SetupItemLabel(_("Critical options (DO NOT change if you don't "
        "know what you're doing)"), "", this,
        Separator_true);

    // TRANSLATORS: settings option
    new SetupItemCheckBox(_("Disable logging in game (do not enable)"),
        "", "disableLoggingInGame", this, "disableLoggingInGameEvent",
        MainConfig_true);

    setDimension(Rect(0, 0, 550, 350));
}
Пример #30
0
Setup_Relations::Setup_Relations():
    mPlayerTableTitleModel(new StaticTableModel(1, COLUMNS_NR)),
    mPlayerTableModel(new PlayerTableModel),
    mPlayerTable(new GuiTable(mPlayerTableModel)),
    mPlayerTitleTable(new GuiTable(mPlayerTableTitleModel)),
    mPlayerScrollArea(new ScrollArea(mPlayerTable)),
    mDefaultTrading(new CheckBox(_("Allow trading"),
                player_relations.getDefault() & PlayerRelation::TRADE)),
    mDefaultWhisper(new CheckBox(_("Allow whispers"),
                player_relations.getDefault() & PlayerRelation::WHISPER)),
    mDeleteButton(new Button(_("Delete"), ACTION_DELETE, this))
{
    setName(_("Relations"));

    mPlayerTable->setOpaque(false);

    mPlayerTableTitleModel->fixColumnWidth(NAME_COLUMN, NAME_COLUMN_WIDTH);
    mPlayerTableTitleModel->fixColumnWidth(RELATION_CHOICE_COLUMN,
                                           RELATION_CHOICE_COLUMN_WIDTH);
    mPlayerTitleTable->setBackgroundColor(gcn::Color(0xbf, 0xbf, 0xbf));

    mIgnoreActionChoicesModel = new IgnoreChoicesListModel;
    mIgnoreActionChoicesBox = new DropDown(mIgnoreActionChoicesModel);

    for (int i = 0; i < COLUMNS_NR; i++)
        mPlayerTableTitleModel->set(0, i, new Label(gettext(table_titles[i])));

    mPlayerTitleTable->setLinewiseSelection(true);

    mPlayerScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
    mPlayerTable->setActionEventId(ACTION_TABLE);
    mPlayerTable->setLinewiseSelection(true);
    mPlayerTable->addActionListener(this);

    gcn::Label *ignore_action_label = new Label(_("When ignoring:"));

    mIgnoreActionChoicesBox->setActionEventId(ACTION_STRATEGY);
    mIgnoreActionChoicesBox->addActionListener(this);

    int ignore_strategy_index = 0; // safe default

    if (player_relations.getPlayerIgnoreStrategy())
    {
        ignore_strategy_index = player_relations.getPlayerIgnoreStrategyIndex(
            player_relations.getPlayerIgnoreStrategy()->mShortName);
        if (ignore_strategy_index < 0)
            ignore_strategy_index = 0;
    }
    mIgnoreActionChoicesBox->setSelected(ignore_strategy_index);
    mIgnoreActionChoicesBox->adjustHeight();

    reset();

    // Do the layout
    LayoutHelper h(this);
    ContainerPlacer place = h.getPlacer(0, 0);

    place(0, 0, mPlayerTitleTable, 6);
    place(0, 1, mPlayerScrollArea, 6, 4).setPadding(2);
    place(0, 5, mDeleteButton);
    place(3, 5, ignore_action_label, 1);
    place(4, 5, mIgnoreActionChoicesBox, 2).setPadding(2);
    place(3, 6, mDefaultTrading, 3);
    place(3, 7, mDefaultWhisper, 3);

    player_relations.addListener(this);

    setDimension(gcn::Rectangle(0, 0, 500, 350));
}