Exemplo n.º 1
0
ProgressWindow::ProgressWindow(ContainerWindow &parent)
  :background_color(COLOR_WHITE),
   background_brush(background_color),
   position(0)
{
  PixelRect rc = parent.GetClientRect();
  WindowStyle style;
  style.Hide();
  Create(parent, rc, style);

  const unsigned width = rc.right - rc.left, height = rc.bottom - rc.top;

  // Load progress bar background
  bitmap_progress_border.Load(IDB_PROGRESSBORDER);

  // Determine text height
#ifndef USE_GDI
  font.Load(FontDescription(Layout::FontScale(10)));
  text_height = font.GetHeight();
#else
  VirtualCanvas canvas({1, 1});
  text_height = canvas.GetFontHeight();
#endif

  // Make progress bar height proportional to window height
  const unsigned progress_height = height / 20;
  const unsigned progress_horizontal_border = progress_height / 2;
  progress_border_height = progress_height * 2;

  // Initialize message text field
  PixelRect message_rc = rc;
  message_rc.bottom -= progress_border_height + height / 48;
  message_rc.top = message_rc.bottom - text_height;
  TextWindowStyle message_style;
  message_style.center();
  message.Create(*this, NULL, message_rc, message_style);

#ifndef USE_GDI
  message.SetFont(font);
#endif

  // Initialize progress bar
  PixelRect pb_rc;
  pb_rc.left = progress_horizontal_border;
  pb_rc.right = pb_rc.left + width - progress_height;
  pb_rc.top = height - progress_border_height + progress_horizontal_border;
  pb_rc.bottom = pb_rc.top + progress_height;
  ProgressBarStyle pb_style;
  progress_bar.Create(*this, pb_rc, pb_style);

  message.InstallWndProc(); // needed for OnChildColor()

  // Set progress bar step size and range
  SetRange(0, 1000);
  SetStep(50);

  // Show dialog
  ShowOnTop();
}
	//
	// 加载步进时间
	//
	VOID CAffectorBase::LoadStepTime(TiXmlNode *pAffectorNode)
	{
		ASSERT(pAffectorNode);


		if (TiXmlNode *pStepTimeNode = pAffectorNode->FirstChild("StepTime")) {
			SetStep(pStepTimeNode->ToElement()->AttributeFloat("value"));
		}
	}
Exemplo n.º 3
0
	void WizardFrame::OnNextButtonClick (wxCommandEvent& event)
	{
		if (CurrentPage->IsValid())
		{
			WizardStep nextStep = ProcessPageChangeRequest (true);
			if (nextStep != CurrentStep)
				SetStep (nextStep);
		}
	}
Exemplo n.º 4
0
 void Initialize()
 {
     me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 9.0f);
     me->SetFloatValue(UNIT_FIELD_COMBATREACH, 9.0f);
     _enteredCombat = false;
     _doorsWebbed = false;
     _lastPlayerCombatState = false;
     SetStep(0);
     SetCombatMovement(true);
     SummonCrusherPack(SUMMON_GROUP_CRUSHER_1);
 }
Exemplo n.º 5
0
	void WizardFrame::OnPreviousButtonClick (wxCommandEvent& event)
	{
		ProcessPageChangeRequest (false);

		if (!StepHistory.empty())
		{
			WizardStep prevStep = *StepHistory.rbegin();
			StepHistory.pop_back();
			SetStep (prevStep, false);
		}
	}
Exemplo n.º 6
0
////////////////////////////////////////////////////////////////////////////
// popis experimentu ...
//
main()
{
  SetOutput("3telesa.dat");
  _Print("# Model obØhu dru§ice kolem soustavy dvou tØles v C++/SIMLIB \n");
  Init(0, 300);                   // inicializace experimentu
  InitGraphics();
  SetStep(1e-12,0.01);
  SetAccuracy(1e-14);             // je nutn  vysok  pýesnost
  Run();                          // simulace
  DoneGraphics();
  return 0;
}
Exemplo n.º 7
0
// Create the CProgressCtrl as a child of the status bar positioned
// over the first pane, extending "nSize" percentage across pane.
// Sets the range to be 0 to MaxValue, with a step of 1.
BOOL CProgressBar::Create(LPCTSTR strMessage, int nSize /*=100*/, 
						  int MaxValue /*=100*/, BOOL bSmooth /*=FALSE*/, 
                          int nPane /*=0*/)
{
	BOOL bSuccess = FALSE;
	
	CStatusBar *pStatusBar = GetStatusBar();
	if (!pStatusBar)
		return FALSE;

	DWORD dwStyle = WS_CHILD|WS_VISIBLE;
#ifdef PBS_SMOOTH	 
	if (bSmooth)
		dwStyle |= PBS_SMOOTH;
#endif

    // Until m_nPane is initialized, Resize() must not be called. But it can be called (which 
    // happens in multi-threaded programs) in CProgressBar::OnEraseBkgnd after the control is 
    // created in CProgressBar::Create.
    m_strMessage  = strMessage;	
    m_nSize 	  = nSize;	
    m_nPane 	  = nPane;	
    m_strPrevText = pStatusBar->GetPaneText(m_nPane); 

	// Get CRect coordinates for requested status bar pane
	CRect PaneRect;
	pStatusBar->GetItemRect(nPane, &PaneRect);

	// Create the progress bar
	bSuccess = CProgressCtrl::Create(dwStyle, PaneRect, pStatusBar, 1);
	ASSERT(bSuccess);
	if (!bSuccess)
		return FALSE;

	// Set range and step
	SetRange(0, MaxValue);
	SetStep(1);

	m_strMessage  = strMessage;
	m_nSize 	  = nSize;
	m_nPane 	  = nPane;
    m_strPrevText = pStatusBar->GetPaneText(m_nPane); 

	// Resize the control to its desired width
	Resize();

	return TRUE;
}
Exemplo n.º 8
0
/* ==============================================================================
   フォントロード後の初期設定
============================================================================== */
void VnXFont::Init()
{
    VnRect rect;
    GetFontRect(mFont, rect);

    mLeft   = rect.x;
    mTop    = rect.y;
    mWidth  = rect.width;
    mHeight = rect.height;

    delete mpImage;
    delete mpShmImage;
    mpShmImage = new VnShmImage(mrWidget.get_window(), mWidth, mHeight, 0x0);
    mpImage    = new VnImage(mWidth, mHeight, 0x0);

    // デフォルト設定
    SetStep(mWidth, mHeight);
}
Exemplo n.º 9
0
// 初始化
bool Counter::Init(int begin, int step)
{
	if (!m_bInit) {
		m_lock = IAutoLock::CreateAutoLock();
		if (NULL != m_lock) {
			m_bInit = m_lock->Init();
		}

		if (m_bInit) {
			m_begin = begin;
			// 设置步长
			SetStep(step);
			// 重置计数器
			Reset();
		}
	}
	return m_bInit;
}
Exemplo n.º 10
0
 void DoAction(int32 action) override
 {
     switch (action)
     {
         case ACTION_CRUSHER_ENGAGED:
             if (_enteredCombat)
                 break;
             instance->SetBossState(DATA_HADRONOX, IN_PROGRESS);
             _enteredCombat = true;
             SummonCrusherPack(SUMMON_GROUP_CRUSHER_2);
             SummonCrusherPack(SUMMON_GROUP_CRUSHER_3);
             break;
         case ACTION_HADRONOX_MOVE:
             if (_step < NUM_STEPS-1)
             {
                 SetStep(_step + 1);
                 Talk(HADRONOX_EMOTE_MOVE);
             }
             break;
     }
 }
CBCGPAnalogClock::CBCGPAnalogClock(CBCGPVisualContainer* pContainer) :
	CBCGPCircularGaugeImpl(pContainer)
{
	m_nTimerID = 0;
	m_bSecondHand = TRUE;
	m_pDate = NULL;

	SetColors(CBCGPCircularGaugeColors::BCGP_CIRCULAR_GAUGE_WHITE);
	SetFrameSize(6);

	SetClosedRange(0, 12);	// 0 - 12 hours
    SetStep(.2);			// 1/5
    SetMajorTickMarkStep(5);
	SetTickMarkStyle(CBCGPCircularGaugeScale::BCGP_TICKMARK_CIRCLE, TRUE, 7.);
	SetTickMarkSize(3, FALSE);

	AddPointer(
		CBCGPCircularGaugePointer(CBCGPCircularGaugePointer::BCGP_GAUGE_NEEDLE_TRIANGLE, .6));
    AddPointer(
		CBCGPCircularGaugePointer(CBCGPCircularGaugePointer::BCGP_GAUGE_NEEDLE_RECT, 0.0, 1.0, TRUE)); 
}
Exemplo n.º 12
0
// Create the CProgressCtrl as a child of the status bar positioned
// over the first pane, extending "nSize" percentage across pane.
// Sets the range to be 0 to MaxValue, with a step of 1.
BOOL CProgressBar::Create(LPCTSTR strMessage, int nSize /*=100*/, 
						  int MaxValue /*=100*/, BOOL bSmooth /*=FALSE*/, 
                          int nPane /*=0*/)
{
	BOOL bSuccess = FALSE;
	
	CStatusBar *pStatusBar = GetStatusBar();
	if (!pStatusBar)
		return FALSE;

	DWORD dwStyle = WS_CHILD|WS_VISIBLE;
#ifdef PBS_SMOOTH	 
	if (bSmooth)
		dwStyle |= PBS_SMOOTH;
#endif

	// Get CRect coordinates for requested status bar pane
	CRect PaneRect;
	pStatusBar->GetItemRect(nPane, &PaneRect);

	// Create the progress bar
	bSuccess = CProgressCtrl::Create(dwStyle, PaneRect, pStatusBar, 1);
	ASSERT(bSuccess);
	if (!bSuccess)
		return FALSE;

	// Set range and step
	SetRange(0, MaxValue);
	SetStep(1);

	m_strMessage  = strMessage;
	m_nSize 	  = nSize;
	m_nPane 	  = nPane;
    m_strPrevText = pStatusBar->GetPaneText(m_nPane); 

	// Resize the control to its desired width
	Resize();

	return TRUE;
}
Exemplo n.º 13
0
void pedometer_init(void)
{
    /*gPedoData = mallocPanic( 55 );*/
    InitCntStep(gPedoData, AMP_THRES, INTERVAL_THRES);
    SetStep(0);
}
Exemplo n.º 14
0
	void WizardFrame::SetStep (WizardStep newStep)
	{
		SetStep (newStep, true);
	}
Exemplo n.º 15
0
int main(int argc, char *argv[])
{
    MPI_Init(&argc, &argv);
    int rank, size;
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);

    /** Application variable */
    std::vector<float> myFloats = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    std::vector<int> myInts = {0, -1, -2, -3, -4, -5, -6, -7, -8, -9};
    const std::size_t Nx = myFloats.size();

    try
    {
        /** ADIOS class factory of IO class objects, DebugON is recommended */
        adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON);

        /*** IO class object: settings and factory of Settings: Variables,
         * Parameters, Transports, and Execution: Engines */
        adios2::IO &bpIO = adios.DeclareIO("BPFile_N2N");

        /// Setting flush policy
        // the user can set the memory explicitly for ADIOS (more advance users)
        bpIO.SetSingleParameter("MaxBufferSize", "100Mb");
        // or by number of steps (naively trying to allocate "N=3" steps before
        // flushing
        // bpIO.SetSingleParameter("StepsToBuffer", "3");

        /** global array : name, { shape (total) }, { start (local) }, {
         * count
         * (local) }, all are constant dimensions */
        adios2::Variable<float> &bpFloats = bpIO.DefineVariable<float>(
            "bpFloats", {size * Nx}, {rank * Nx}, {Nx}, adios2::ConstantDims);

        adios2::Variable<int> &bpInts = bpIO.DefineVariable<int>(
            "bpInts", {size * Nx}, {rank * Nx}, {Nx}, adios2::ConstantDims);

        /** Engine derived class, spawned to start IO operations */
        /** Deferred Mode: Write buffering will be done at Put(), the user makes
         *  the commitment that pointers passed at Write won't be reused */
        auto bpWriter = bpIO.Open("myVector.bp",
                                  adios2::Mode::Write | adios2::Mode::Deferred);

        // default = 0, in bp1 format this is translated to 1, but user should
        // be able to start at any step
        bpWriter.SetStep(1);

        /** Write variable for buffering */
        for (unsigned int t = 0; t < 100; ++t)
        {
            bpWriter.Write<float>(bpFloats, myFloats.data());
            bpWriter.Write<int>(bpInts, myInts.data());
            bpWriter.Advance(); // advances step

            if (t % 10 == 0) // checkpoint/restart every 10 steps, force flush
            {
                bpWriter.Flush();
            }
        }

        /** Engine becomes unreachable after Close */
        bpWriter.Close();
    }
    catch (std::invalid_argument &e)
    {
        std::cout << "Invalid argument exception, STOPPING PROGRAM from rank "
                  << rank << "\n";
        std::cout << e.what() << "\n";
    }
    catch (std::ios_base::failure &e)
    {
        std::cout << "IO System base failure exception, STOPPING PROGRAM "
                     "from rank "
                  << rank << "\n";
        std::cout << e.what() << "\n";
    }
    catch (std::exception &e)
    {
        std::cout << "Exception, STOPPING PROGRAM from rank " << rank << "\n";
        std::cout << e.what() << "\n";
    }

    MPI_Finalize();

    return 0;
}
Exemplo n.º 16
0
ScreenOptionsMaster::ScreenOptionsMaster( const CString &sClassName ):
	ScreenOptions( sClassName )
{
	LOG->Trace("ScreenOptionsMaster::ScreenOptionsMaster(%s)", m_sName.c_str() );

	/* If this file doesn't exist, leave the music alone (eg. ScreenPlayerOptions music sample
	 * left over from ScreenSelectMusic).  If you really want to play no music, add a redir
	 * to _silent. */
	CString MusicPath = THEME->GetPathToS( ssprintf("%s music", m_sName.c_str()), true );
	if( MusicPath != "" )
		SOUND->PlayMusic( MusicPath );

	CStringArray asLineNames;
	split( LINE_NAMES, ",", asLineNames );
	if( asLineNames.empty() )
		RageException::Throw( "%s::LineNames is empty.", m_sName.c_str() );


	CStringArray Flags;
	split( OPTION_MENU_FLAGS, ";", Flags, true );
	InputMode im = INPUTMODE_INDIVIDUAL;
	bool Explanations = false;
	
	unsigned i;
	for( i = 0; i < Flags.size(); ++i )
	{
		CString &flag = Flags[i];
		flag.MakeLower();

		if( flag == "together" )
			im = INPUTMODE_SHARE_CURSOR;
		else if( flag == "explanations" )
			Explanations = true;
		else if( flag == "forceallplayers" )
		{
			FOREACH_PlayerNumber( pn )
				GAMESTATE->m_bSideIsJoined[pn] = true;
			GAMESTATE->m_MasterPlayerNumber = PlayerNumber(0);
		}
		else if( flag == "smnavigation" )
			SetNavigation( NAV_THREE_KEY_MENU );
		else if( flag == "toggle" || flag == "firstchoicegoesdown" )
			SetNavigation( PREFSMAN->m_bArcadeOptionsNavigation? NAV_TOGGLE_THREE_KEY:NAV_TOGGLE_FIVE_KEY );
	}

	m_OptionRowAlloc = new OptionRowData[asLineNames.size()];
	for( i = 0; i < asLineNames.size(); ++i )
	{
		OptionRowData &row = m_OptionRowAlloc[i];
		
		vector<ParsedCommand> vCommands;
		ParseCommands( LINE(asLineNames[i]), vCommands );
		
		if( vCommands.size() < 1 )
			RageException::Throw( "Parse error in %s::Line%i", m_sName.c_str(), i+1 );

		OptionRowHandler hand;
		for( unsigned part = 0; part < vCommands.size(); ++part)
		{
			ParsedCommand& command = vCommands[part];

			HandleParams;

			const CString name = sParam(0);

			if( !name.CompareNoCase("list") )
			{
				SetList( row, hand, sParam(1), row.name );
			}
			else if( !name.CompareNoCase("steps") )
			{
				SetStep( row, hand );
				row.name = "Steps";
			}
			else if( !name.CompareNoCase("conf") )
			{
				SetConf( row, hand, sParam(1), row.name );
			}
			else if( !name.CompareNoCase("characters") )
			{
				SetCharacter( row, hand );
				row.name = "Characters";
			}
			else
				RageException::Throw( "Unexpected type '%s' in %s::Line%i", name.c_str(), m_sName.c_str(), i );

			CheckHandledParams;
		}

		// TRICKY:  Insert a down arrow as the first choice in the row.
		if( m_OptionsNavigation == NAV_TOGGLE_THREE_KEY )
		{
			row.choices.insert( row.choices.begin(), ENTRY_NAME("NextRow") );
			hand.ListEntries.insert( hand.ListEntries.begin(), ModeChoice() );
		}

		OptionRowHandlers.push_back( hand );
	}

	ASSERT( OptionRowHandlers.size() == asLineNames.size() );

	Init( im, m_OptionRowAlloc, asLineNames.size() );
}
Exemplo n.º 17
0
Forces::Forces(int argc,char **argv,int NInEdge,char *ConfFileExt){
  Shout("Constructor/no starting configuration");
  InitConst();
  sprintf(ConfFile,"%s",ConfFileExt);
  char ConfF[40];
  sprintf(ConfF,ConfFile);
  if(ReadConfDinamica(ConfF)){
    Dx = 1./(double)(NEdge-1);
  }
  if(VAR_IF_TYPE(SysShape,SYS_2D)){
    nEdge[0] = NEdge;
    double Ratio = pEdge(1)*pInvEdge(0);
    nEdge[1] = (int)(nEdge[0]*Ratio + 0.0001);
    for(int i=0;;i++){
      if((int)(nEdge[1]/Ratio) == nEdge[0]) break;
      nEdge[0]++;
      nEdge[1] = (int)(nEdge[0]*Ratio + 0.0001);
      printf("using: nEdge[0] %d nEdge[1] %d\n",nEdge[0],nEdge[1]);
      if(i>=10){
	printf("Could not find the appropriate border partition %d %d\n",nEdge[0],nEdge[1]);
	exit(0);
      }
    }
    SetNLink(4);
    ReSetNPart(nEdge[0]*nEdge[1]);
    ReSetNChain(nEdge[1]);
    SetNPCh(nEdge[0]);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_3D)){
    SetNLink(6);
    ReSetNChain(NEdge*NEdge);
    ReSetNPart(NEdge*NEdge*NEdge);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_ROD)){
    SetNLink(1);
    ReSetNChain(1);
    ReSetNPart(NEdge);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_STALK)){
    SetNLink(3);
    ReSetNPart(4*NEdge);
    ReSetNChain(4);
    //    Kf.El[0] *= Gen->NPart;
  }
  else if(VAR_IF_TYPE(SysShape,SYS_LEAVES)){
    SetNLink(3);
    ReSetNPart(NEdge);
    ReSetNChain(1);
    //    Kf.El[0] *= Gen->NPart;
  }
  else if(VAR_IF_TYPE(SysShape,SYS_PORE)){
    SetNLink(3);
    ReSetNPart(NEdge);
    ReSetNChain(1);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_1D)){
    SetNLink(2);
    ReSetNPart(NEdge);
    ReSetNChain(1);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_RIGID)){
    ReSetNPart(0);
    SetNLink(0);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_TRIAL)){
    ReSetNPart(3*3*3);
    SetNLink(0);
    ReSetNChain(1);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_MD)){
    SetNLink(0);
    ReSetNPart(NEdge);
    ReSetNChain(1);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_MC)){
    SetNLink(0);
    ReSetNPart(NEdge);
    ReSetNChain(1);
  }
  else if(VAR_IF_TYPE(SysShape,SYS_ELECTRO)){
    SetNLink(4);
    ReSetNPart(NEdge+NSpline);
    ReSetNChain(1);
  }
  ReSetNPCh(pNPart()/pNChain());
  //SetNPCh(NEdge);
  SetDeltat(Deltat);
  SetStep(0);
  SetNType(2);
  CreateInitial();
  {
    MInt = new MatInt(3,3);
    MInt->SetCoeff(-24.33,0,0);
    MInt->SetCoeff(-7.22,0,1);
    MInt->SetCoeff(-24.33,0,2);
    MInt->SetCoeff(-0.1,1,1);
    MInt->SetCoeff(-7.22,1,2);
    MInt->SetCoeff(0.,2,2);
    MInt->SetCoeff(3.,0,0,0);
    MInt->SetCoeff(3.,0,0,1);
    MInt->SetCoeff(3.,0,0,2);
    MInt->SetCoeff(3.,0,1,1);
    MInt->SetCoeff(3.,0,1,2);
    MInt->SetCoeff(3.,0,2,2);
    MInt->SetCoeff(0.,1,1,1);
    MInt->SetCoeff(3.,1,1,2);
    MInt->SetCoeff(3.,1,2,2);
    MInt->SetCoeff(0.,2,2,2);
  }
  AllocMethod();
  PrepareSys();
  PrepareParallel(argc,argv);
  if(VAR_IF_TYPE(SysShape,SYS_LEAVES)) IfNano = 2;
  if(VAR_IF_TYPE(SysShape,SYS_PORE)) IfNano = 2;
  if(VAR_IF_TYPE(SysShape,SYS_ELECTRO)){
    Pm[NEdge].Typ = 2;
    Pm[NEdge+1].Typ = 2;
  }
  //Pc->PrintCells();
  //for(int p=0;p<pNPart();p++) CheckDomDec(p);
  //Interp();
}