Exemplo n.º 1
0
int runEvents(void)
{
    FILE * iprt = NULL;
    int i;

    i=imkmom(inP1,inP2);
//    if(veg_Ptr&&veg_Ptr->ndim!=i)clearGrid();
//    if(!veg_Ptr) veg_Ptr=vegas_init(i,50);    

    w_sess__(NULL);
/* ** open protocol and resulting files */
       
    {  char fname[50];
       sprintf(fname,"%sprt_%d",outputDir,nSess);
       iprt=fopen(fname,"a");
       if(ftell(iprt)==0) 
       { fprintf(iprt,"    CalcHEP kinematics module \n The session parameters:\n");
         w_sess__(iprt);
         fprintf(iprt,"===================================\n");   
       }
    }

/* **  initkinematics */


    { char fname[50];

      sprintf(fname,"%sevents_%d.txt",outputDir,nSess);

      hFill=0;
      generateEvents(veg_Ptr,func_2,fname, iprt);
    }
    fclose(iprt);
    return 0;
}
Exemplo n.º 2
0
void Allegro5Touch::poll(){
    if (queue == NULL){
        return;
    }
    events.clear();
    std::map<Key, bool> new_buttons;
    ALLEGRO_EVENT event;
    while (al_get_next_event(queue, &event)){
        switch (event.type){
            case ALLEGRO_EVENT_TOUCH_BEGIN: {
                // Global::debug(0) << "Touch begin id (" << event.touch.id << ") x (" << (double) event.touch.x << ") y (" << (double) event.touch.y << ")" << std::endl;
                int id = event.touch.id;
                double x = event.touch.x;
                double y = event.touch.y;

                touches[id] = Util::ReferenceCount<TouchTrack>(new TouchTrack(id, x, y));
                handleTouch(touches[id], new_buttons, true);

                break;
            }
            case ALLEGRO_EVENT_TOUCH_END: {
                int id = event.touch.id;
                double x = event.touch.x;
                double y = event.touch.y;

                handleTouch(touches[id], new_buttons, false);
                touches[id] = NULL;

                // Global::debug(0) << "Touch end id (" << event.touch.id << ") x (" << (double) event.touch.x << ") y (" << (double) event.touch.y << ")" << std::endl;
                break;
            }
            case ALLEGRO_EVENT_TOUCH_MOVE: {
                int id = event.touch.id;
                double x = event.touch.x;
                double y = event.touch.y;

                if (touches[id] != NULL){
                    touches[id]->update(x, y);
                } else {
                    touches[id] = Util::ReferenceCount<TouchTrack>(new TouchTrack(id, x, y));
                }
                
                handleTouch(touches[id], new_buttons, true);

                // Global::debug(0) << "Touch move id (" << event.touch.id << ") x (" << (double) event.touch.x << ") y (" << (double) event.touch.y << ")" << std::endl;
                break;
            }
            case ALLEGRO_EVENT_TOUCH_CANCEL: {
                // Global::debug(0) << "Touch cancel id (" << event.touch.id << ") x (" << (double) event.touch.x << ") y (" << (double) event.touch.y << ")" << std::endl;
                int id = event.touch.id;
                handleTouch(touches[id], new_buttons, false);
                touches[id] = NULL;
                break;
            }
        }
    }

    generateEvents(new_buttons);
}
Exemplo n.º 3
0
void CrCalendar::generateCalendar(QString title, bool genEvent, bool genRoom, bool genCoach) {

    _html.clear();
    _html += "<!DOCTYPE html>";
    _html += "<html>";
    _html += "<head>";

    _html += "<style type=\"text/css\">\n";
    _html += getListOfClassAndColors();
    _html += getListOfClassAndColors(CalendarData::room);
    _html += getListOfClassAndColors(CalendarData::coach);
    _html += getListOfClassAndColorsOfWorkActivity();
    _html += css();
    _html += "</style>\n";

    _html += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";

    _html += "<title>";
    _html += title;
    _html += "</title>";

    _html += "</head>";
    _html += "<body>";
    _html += "<table>";

    _html += "<thead>";

    //add title
    _html += "<tr>";
    _html += "<td colspan=\""+ QString::number(_dateFirst.daysTo(_dateLast)+5) +"\"";
    _html += "class=\""+ Cell::getCssClassAsString(Cell::calendar_title) +"\">";
    _html += title;
    _html += "</td>";
    _html += "</tr>";


    //add month names
    _html += "<tr>";
    _html += "<td></td>";
    _html += "<td></td>";
    _html += "<td></td>";
    _html += "<td></td>";
    _html += generateMonthTitle();
    _html += "</tr>";


    //add day numbers
    _html += "<tr>";
    _html += "<td></td>";
    _html += "<td></td>";
    _html += "<td></td>";
    _html += "<td></td>";
    _html += generateDayNumber();
    _html += "</tr>";
    _html += "</thead>";


    _html += "<tbody>";

    if(genEvent) {
        //add work activity
        _html += generateWorkActivity();

        //add events
        _html += generateEvents();
        _html += generateEventsAfterDeadline();
    }

    if(genRoom) {
        //add rooms
        _html += generateRooms(CalendarData::room);
    }

    if(genCoach) {
        //add coaches
        _html += generateRooms(CalendarData::coach);
    }

    _html += "</tbody>";
    _html += "</table>\n";
    _html += "</body>\n";
    _html += "</html>\n";




}