Example #1
0
AnimateCommands
AnimateCompile::Compile(const CC_show& show, AnimationVariables& variablesStates, AnimationErrors& errors, CC_show::const_CC_sheet_iterator_t c_sheet, unsigned pt_num, SYMBOL_TYPE cont_symbol, std::list<std::unique_ptr<ContProcedure>> const& procs)
{
	AnimateCommands cmds;
	unsigned beats_rem = c_sheet->GetBeats();
	auto pt = c_sheet->GetPosition(pt_num);
	AnimateCompile ac(show, cont_symbol, pt_num, c_sheet, beats_rem, pt, variablesStates, errors, cmds);

	if (procs.empty())
	{
// no continuity was specified
		auto s = c_sheet + 1;
		for (; s != show.GetSheetEnd(); ++s)
		{
			if (s->IsInAnimation())
			{
//use EVEN REM NP
				ContProcEven defcont(new ContValueFloat(beats_rem), new ContNextPoint());
				defcont.Compile(ac);
				break;
			}
		}
		if (s == show.GetSheetEnd())
		{
//use MTRM E
			ContProcMTRM defcont(new ContValueDefined(CC_E));
			defcont.Compile(ac);
		}
	}

	for (auto& proc : procs)
	{
		proc->Compile(ac);
	}

	if ((c_sheet + 1) != show.GetSheetEnd())
	{
		auto next_point = (c_sheet + 1)->GetPosition(pt_num);
		if (pt != next_point)
		{
			auto c = next_point - pt;
			ac.RegisterError(ANIMERR_WRONGPLACE, NULL);
			ac.Append(std::make_shared<AnimateCommandMove>(beats_rem, c), NULL);
		}
	}
	if (beats_rem)
	{
		ac.RegisterError(ANIMERR_EXTRATIME, NULL);
		ac.Append(std::make_shared<AnimateCommandMT>(beats_rem, ANIMDIR_E), NULL);
	}
	return cmds;
}
Example #2
0
void
HomeViewView::OnWizardSetup(CC_show& show)
{
	wxWizard *wizard = new wxWizard(mFrame, wxID_ANY, wxT("New Show Setup Wizard"));
	// page 1:
	// set the number of points and the labels
	ShowInfoReqWizard *page1 = new ShowInfoReqWizard(wizard);
	
	// page 2:
	// choose the show mode
	ChooseShowModeWizard *page2 = new ChooseShowModeWizard(wizard);
	
	// page 3:
	// and maybe a description
	SetDescriptionWizard *page3 = new SetDescriptionWizard(wizard);
	// page 4:
	
	wxWizardPageSimple::Chain(page1, page2);
	wxWizardPageSimple::Chain(page2, page3);
	
	wizard->GetPageAreaSizer()->Add(page1);
	if (wizard->RunWizard(page1))
	{
		show.SetNumPoints(page1->GetNumberPoints(), page1->GetNumberColumns());
		show.SetPointLabel(page1->GetLabels());
		ShowMode *newmode = ShowModeList_Find(wxGetApp().GetModeList(), page2->GetValue());
		if (newmode)
		{
			show.SetMode(newmode);
		}
		show.SetDescr(page3->GetValue());
	}
	else
	{
		wxMessageBox(
					 wxT("Show setup not completed.\n")
					 wxT("You can change the number of marchers\n")
					 wxT("and show mode via the menu options"), wxT("Show not setup"), wxICON_INFORMATION|wxOK);
	}
	wizard->Destroy();
}
Example #3
0
Animation::Animation(const CC_show& show, NotifyStatus notifyStatus, NotifyErrorList notifyErrorList)
    : numpts(show.GetNumPoints()), pts(numpts), curr_cmds(numpts),
      curr_sheetnum(0),
      mCollisionAction(NULL)
{
    // the variables are persistant through the entire compile process.
    AnimationVariables variablesStates;

    for (auto curr_sheet = show.GetSheetBegin(); curr_sheet != show.GetSheetEnd(); ++curr_sheet)
    {
        if (!curr_sheet->IsInAnimation()) continue;

// Now parse continuity
        AnimateCompile comp(show, variablesStates);
        std::vector<std::vector<std::shared_ptr<AnimateCommand> > > theCommands(numpts);
        for (auto& current_symbol : k_symbols)
        {
            if (curr_sheet->ContinuityInUse(current_symbol))
            {
                auto& current_continuity = curr_sheet->GetContinuityBySymbol(current_symbol);
                std::string tmpBuffer(current_continuity.GetText());
                yyinputbuffer = tmpBuffer.c_str();
                if (notifyStatus)
                {
                    std::string message("Compiling \"");
                    message += curr_sheet->GetName().substr(0,32);
                    message += ("\" ");
                    message += GetNameForSymbol(current_symbol).substr(0,32);
                    message += ("...");
                    notifyStatus(message);
                }
                // parse out the error
                if (parsecontinuity() != 0)
                {
                    // Supply a generic parse error
                    ContToken dummy;
                    comp.RegisterError(ANIMERR_SYNTAX, &dummy);
                }
                for (unsigned j = 0; j < numpts; j++)
                {
                    if (curr_sheet->GetPoint(j).GetSymbol() == current_symbol)
                    {
                        theCommands[j] = comp.Compile(curr_sheet, j, current_symbol, ParsedContinuity);
                    }
                }
                while (ParsedContinuity)
                {
                    ContProcedure* curr_proc = ParsedContinuity->next;
                    delete ParsedContinuity;
                    ParsedContinuity = curr_proc;
                }
            }
        }
// Handle points that don't have continuity (shouldn't happen)
        if (notifyStatus)
        {
            std::string message("Compiling \"");
            message += curr_sheet->GetName().substr(0,32);
            message += ("\"...");
            notifyStatus(message);
        }
        for (unsigned j = 0; j < numpts; j++)
        {
            if (theCommands[j].empty())
            {
                theCommands[j] = comp.Compile(curr_sheet, j, MAX_NUM_SYMBOLS, NULL);
            }
        }
        if (!comp.Okay() && notifyErrorList)
        {
            std::string message("Errors for \"");
            message += curr_sheet->GetName().substr(0,32);
            message += ("\"");
            if (notifyErrorList(comp.GetErrorMarkers(), std::distance(show.GetSheetBegin(), curr_sheet), message))
            {
                break;
            }
        }
        std::vector<AnimatePoint> thePoints(numpts);
        for (unsigned i = 0; i < numpts; i++)
        {
            thePoints.at(i) = curr_sheet->GetPosition(i);
        }
        AnimateSheet new_sheet(thePoints, theCommands, curr_sheet->GetName(), curr_sheet->GetBeats());
        sheets.push_back(new_sheet);
    }
}