void MouseDialogNavigationTool::buttonCallback(int,InputDevice::ButtonCallbackData* cbData) { if(cbData->newButtonState) // Button has just been pressed { bool takeEvent=true; if(factory->interactWithWidgets) { /* Check if the GUI interactor accepts the event: */ GUIInteractor::updateRay(); if(GUIInteractor::buttonDown(false)) { /* Deactivate this tool if it is spinning: */ if(spinning) deactivate(); spinning=false; /* Disable navigation: */ takeEvent=false; } } if(takeEvent) { /* Deactivate spinning: */ spinning=false; /* Start navigating according to the current navigation mode: */ switch(navigationMode) { case ROTATING: if(activate()) startRotating(); break; case PANNING: if(activate()) startPanning(); break; case DOLLYING: if(activate()) startDollying(); break; case SCALING: if(activate()) startScaling(); break; } } } else // Button has just been released { if(GUIInteractor::isActive()) { /* Deliver the event: */ GUIInteractor::buttonUp(); } else { /* Check for spinning if currently in rotating mode: */ if(navigationMode==ROTATING) { /* Check if the input device is still moving: */ Point currentPos=calcScreenPos(); Vector delta=currentPos-lastRotationPos; if(Geometry::mag(delta)>factory->spinThreshold) { /* Calculate spinning angular velocity: */ Vector offset=(lastRotationPos-screenCenter)+rotateOffset; Vector axis=Geometry::cross(offset,delta); Scalar angularVelocity=Geometry::mag(delta)/(factory->rotateFactor*(getApplicationTime()-lastMoveTime)); spinAngularVelocity=axis*(Scalar(0.5)*angularVelocity/axis.mag()); /* Enable spinning: */ spinning=true; } else { /* Deactivate the tool: */ deactivate(); } } else { /* Deactivate the tool: */ deactivate(); } } } }
static int activate_cs (pixma_t * s, uint8_t x) { /*SIM*/ check_status (s); return activate (s, x); }
int module_start (vlc_object_t *obj, const module_t *m) { int (*activate) (vlc_object_t *) = m->pf_activate; return (activate != NULL) ? activate (obj) : VLC_SUCCESS; }
/// Read the index contained in the file f. This function always reads all /// bitvectors. int ibis::skive::read(const char* f) { std::string fnm; indexFileName(fnm, f); int fdes = UnixOpen(fnm.c_str(), OPEN_READONLY); if (fdes < 0) { LOGGER(ibis::gVerbose > 0) << "Warning -- skive[" << col->partition()->name() << '.' << col->name() << "]::read failed to open " << fnm; return -1; // can not do anything else } char header[8]; IBIS_BLOCK_GUARD(UnixClose, fdes); #if defined(_WIN32) && defined(_MSC_VER) (void)_setmode(fdes, _O_BINARY); #endif int ierr = UnixRead(fdes, static_cast<void*>(header), 8); if (ierr != 8) { LOGGER(ibis::gVerbose > 0) << "Warning -- skive[" << col->partition()->name() << '.' << col->name() << "]::read failed to read 8 bytes from " << fnm; return -2; } if (!(header[0] == '#' && header[1] == 'I' && header[2] == 'B' && header[3] == 'I' && header[4] == 'S' && (header[5] == static_cast<char>(ibis::index::SKIVE) || header[5] == static_cast<char>(ibis::index::SLICE)) && (header[6] == 8 || header[6] == 4) && header[7] == static_cast<char>(0))) { if (ibis::gVerbose > 0) { ibis::util::logger lg; lg() << "Warning -- skive[" << col->partition()->name() << '.' << col->name() << "]::read the header from " << fnm << " ("; printHeader(lg(), header); lg() << ") does not contain the expected values"; } return -3; } uint32_t dim[3]; // nrows, nobs, card size_t begin, end; clear(); // clear the current content ierr = UnixRead(fdes, static_cast<void*>(dim), 3*sizeof(uint32_t)); nrows = dim[0]; // read vals begin = 8*((3*sizeof(uint32_t) + 15) / 8); end = begin + dim[2] * sizeof(double); { array_t<double> dbl(fnm.c_str(), fdes, begin, end); vals.swap(dbl); } // read the offsets begin = end; end += header[6] * (dim[1] + 1); ierr = initOffsets(fdes, header[6], begin, dim[1]); if (ierr < 0) return ierr; // cnts begin = end; end += sizeof(uint32_t) * dim[2]; { array_t<uint32_t> szt(fnm.c_str(), fdes, begin, end); cnts.swap(szt); } ibis::fileManager::instance().recordPages(0, end); initBitmaps(fdes); activate(); return 0; } // ibis::skive::read
void ComeHitherNavigationTool::buttonCallback(int,int,InputDevice::ButtonCallbackData* cbData) { if(cbData->newButtonState) // Button has just been pressed { if(isActive()) // Tool is already active { /* Snap to the target transformation immediately: */ setNavigationTransformation(targetNav); /* Deactivate this tool: */ deactivate(); } else // Tool is not yet active { /* Try activating this tool: */ if(activate()) { /* Get the start navigation transformation: */ startNav=getNavigationTransformation(); startTime=getApplicationTime(); /* Get the target transformation: */ NavTransform device=getDeviceTransformation(0); device.leftMultiply(getInverseNavigationTransformation()); Point center=device.getOrigin(); Vector forward=device.getDirection(1); Vector up=device.getDirection(2); /* Compute the navigation transformation for the target transformation: */ targetNav=NavTransform::identity; targetNav*=NavTransform::translateFromOriginTo(getDisplayCenter()); targetNav*=NavTransform::rotate(Rotation::fromBaseVectors(Geometry::cross(getForwardDirection(),getUpDirection()),getForwardDirection())); targetNav*=NavTransform::scale(startNav.getScaling()); targetNav*=NavTransform::rotate(Geometry::invert(Rotation::fromBaseVectors(Geometry::cross(forward,up),forward))); targetNav*=NavTransform::translateToOriginFrom(center); /* Compute the linear and angular velocities for the movement: */ NavTransform delta=startNav; delta.doInvert(); delta.leftMultiply(targetNav); Vector linearDist=delta.getTranslation(); double linearMag=Geometry::mag(linearDist); Vector angularDist=delta.getRotation().getScaledAxis(); double angularMag=Geometry::mag(angularDist); if(linearMag<=factory->linearSnapThreshold&&angularMag<=factory->angularSnapThreshold) { /* Snap to the target transformation immediately: */ setNavigationTransformation(targetNav); /* Deactivate this tool: */ deactivate(); } else { /* Compute the total transition time: */ double transitionTime=linearMag/factory->maxLinearVelocity; if(transitionTime<angularMag/factory->maxAngularVelocity) transitionTime=angularMag/factory->maxAngularVelocity; endTime=startTime+transitionTime; /* Compute the effective linear and angular velocities: */ linearVelocity=linearDist/Scalar(transitionTime); angularVelocity=angularDist/Scalar(transitionTime); } } } } }
void GoalTraverseEdge::resume() { activate(); }
qb_class::qb_class(){ // Variables to get param vector<int> ID_cube, ID_hand; int unit; int br; string port; string aux; // Initialize ROS Node node_ = new ros::NodeHandle("qb_interface_node_"); // Get param from roslaunch or yaml file node_->param("/eq_preset", flagCMD_type_, true); node_->param("/hand_perc", flag_HCMD_type_, false); node_->param("/current", flag_curr_type_, false); node_->param<double>("/step_time", step_time_, 0.002); node_->param<string>("/port", port, "/dev/ttyUSB0"); node_->param<int>("/baudrate", br, 2000000); node_->searchParam("/IDcubes", aux); node_->getParam(aux, ID_cube); node_->searchParam("/IDhands", aux); node_->getParam(aux, ID_hand); node_->param<string>("/unit", aux, "DEG"); // Choose Right unit of measurement if(!strcmp(aux.c_str(), "DEG") || !strcmp(aux.c_str(), "deg") || !strcmp(aux.c_str(), "Deg")) meas_unit_ = DEG; else{ if(!strcmp(aux.c_str(), "RAD") || !strcmp(aux.c_str(), "rad") || !strcmp(aux.c_str(), "Rad")) meas_unit_ = RAD; else{ if(!strcmp(aux.c_str(), "TICK") || !strcmp(aux.c_str(), "tick") || !strcmp(aux.c_str(), "Tick")) meas_unit_ = TICK; else{ cerr << "[WARNING] Unit of measurement is not correctly set, degree default enable." << endl; meas_unit_ = DEG; } } } qb_comm_ = NULL; // Open port if (!open(port.c_str(), br)){ qb_comm_ = NULL; cout << "[ERROR] USB " << port << " was not open correctly." << endl; return; } // Create cubes and hands chain from ID read // Add Cubes qbCube* tmp_cube; // Allocate object qbCube, one for each cube in cubeBuf for (int i = ID_cube.size(); i--;) { tmp_cube = new qbCube(qb_comm_, ID_cube[i]); // IF an error is find if (tmp_cube == NULL){ cout << "[ERORR] Unable to allocate space for cube structure." << endl; return; } cube_chain_.push_back(tmp_cube); } // Add Hands qbHand* tmp_hand; // Allocate object qbCube, one for each cube in cubeBuf for (int i = ID_hand.size(); i--;) { tmp_hand = new qbHand(qb_comm_, ID_hand[i]); // IF an error is find if (tmp_hand == NULL){ cout << "[ERORR] Unable to allocate space for cube structure." << endl; return; } hand_chain_.push_back(tmp_hand); } // Activate if (!activate()) cout << "[ERROR] Some qbDevice are not correctly activated." << endl; // Initialize publisher and subscriber if (!hand_chain_.empty()){ // Subscriber initialize hand_sub = node_->subscribe("/qb_class/hand_ref", 1, &qb_class::handRefCallback, this); // Publisher initialize // Outside command publisher, self-open but not internally used topic handRef_pub = node_->advertise<qb_interface::handRef>("/qb_class/hand_ref", 1); // Publisher to publish new read positions hand_pub = node_->advertise<qb_interface::handPos>("/qb_class/hand_measurement", 1); // Current TOPIC if (flag_curr_type_) hand_curr_pub = node_->advertise<qb_interface::handCurrent>("/qb_class/hand_current", 1); } if (!cube_chain_.empty()){ // Subscriber initialize cube_sub = node_->subscribe("/qb_class/cube_ref", 1000, &qb_class::cubeRefCallback, this); // Publisher initialize // Outside command publisher, self-open but not internally used topic cubeRef_pub = node_->advertise<qb_interface::cubeRef>("/qb_class/cube_ref", 1); // Publisher to publish new read positions if (flagCMD_type_ == EQ_PRESET) cube_pub = node_->advertise<qb_interface::cubeEq_Preset>("/qb_class/cube_measurement", 1); else cube_pub = node_->advertise<qb_interface::cubePos>("/qb_class/cube_measurement", 1); // Current TOPIC if (flag_curr_type_) cube_curr_pub = node_->advertise<qb_interface::cubeCurrent>("/qb_class/cube_current", 1); } }
/* Constructor with known variable */ QELineEdit::QELineEdit( const QString& variableNameIn, QWidget *parent ) : QEGenericEdit( variableNameIn, parent ) { setup(); setVariableName( variableNameIn, 0 ); activate(); }
void STATE5::handleActivation() { if (running && finished ) { activate(); } }
int GLUI_EditText::key_handler( unsigned char key,int modifiers ) { int i, regular_key; /* int has_selection; */ if ( NOT glui ) return false; if ( debug ) dump( stdout, "-> KEY HANDLER" ); regular_key = false; bool ctrl_down = (modifiers & GLUT_ACTIVE_CTRL)!=0; /* has_selection = (sel_start != sel_end); */ if ( key == CTRL('m') ) { /* RETURN */ /* glui->deactivate_current_control(); */ deactivate(); /** Force callbacks, etc **/ activate(GLUI_ACTIVATE_TAB); /** Reselect all text **/ redraw(); return true; } else if ( key == CTRL('[')) { /* ESCAPE */ glui->deactivate_current_control(); return true; } else if ( (key == 127 AND !ctrl_down) OR /* FORWARD DELETE */ ( key == CTRL('d') AND modifiers == GLUT_ACTIVE_CTRL) ) { if ( sel_start == sel_end ) { /* no selection */ if ( insertion_pt < (int)text.length() ) { /*** See if we're deleting a period in a float data-type box ***/ if ( data_type == GLUI_EDITTEXT_FLOAT AND text[insertion_pt]=='.' ) num_periods--; /*** Shift over string first ***/ text.erase(insertion_pt,1); } } else { /* There is a selection */ clear_substring( std::min(sel_start,sel_end), std::max(sel_start,sel_end )); insertion_pt = std::min(sel_start,sel_end); sel_start = sel_end = insertion_pt; } } else if ( ((key == 127) AND ctrl_down) OR // Delete word forward ((key == 'd') AND (modifiers == GLUT_ACTIVE_ALT)) ) { if ( sel_start == sel_end ) { /* no selection */ sel_start = insertion_pt; sel_end = find_word_break( insertion_pt, +1 ); } clear_substring( std::min(sel_start,sel_end), std::max(sel_start,sel_end )); insertion_pt = std::min(sel_start,sel_end); sel_start = sel_end = insertion_pt; } else if ( key == CTRL('h') ) { /* BACKSPACE */ if ( sel_start == sel_end ) { /* no selection */ if ( insertion_pt > 0 ) { /*** See if we're deleting a period in a float data-type box ***/ if ( data_type == GLUI_EDITTEXT_FLOAT AND text[insertion_pt-1]=='.' ) num_periods--; /*** Shift over string first ***/ insertion_pt--; text.erase(insertion_pt,1); } } else { /* There is a selection */ clear_substring( std::min(sel_start,sel_end), std::max(sel_start,sel_end )); insertion_pt = std::min(sel_start,sel_end); sel_start = sel_end = insertion_pt; } } else if ( modifiers == GLUT_ACTIVE_CTRL ) /* CTRL ONLY */ { /* Ctrl-key bindings */ if ( key == CTRL('a') ) { return special_handler( GLUT_KEY_HOME, 0 ); } else if ( key == CTRL('e') ) { return special_handler( GLUT_KEY_END, 0 ); } else if ( key == CTRL('b') ) { return special_handler( GLUT_KEY_LEFT, 0 ); } else if ( key == CTRL('f') ) { return special_handler( GLUT_KEY_RIGHT, 0 ); } else if ( key == CTRL('p') ) { return special_handler( GLUT_KEY_UP, 0 ); } else if ( key == CTRL('n') ) { return special_handler( GLUT_KEY_DOWN, 0 ); } else if ( key == CTRL('u') ) { /* ERASE LINE */ insertion_pt = 0; text.erase(0,text.length()); sel_start = sel_end = 0; } else if ( key == CTRL('k') ) { /* KILL TO END OF LINE */ sel_start = sel_end = insertion_pt; text.erase(insertion_pt,GLUI_String::npos); } } else if ( modifiers == GLUT_ACTIVE_ALT ) /* ALT ONLY */ { if ( key == 'b' ) { // Backward word return special_handler ( GLUT_KEY_LEFT, GLUT_ACTIVE_CTRL ); } if ( key == 'f' ) { // Forward word return special_handler ( GLUT_KEY_RIGHT, GLUT_ACTIVE_CTRL ); } } else if ( (modifiers & GLUT_ACTIVE_CTRL) OR (modifiers & GLUT_ACTIVE_ALT) ) { /** ignore other keys with modifiers */ return true; } else { /* Regular key */ regular_key = true; /** Check if we only accept numbers **/ if (data_type == GLUI_EDITTEXT_FLOAT ) { if ( (key < '0' OR key > '9') AND key != '.' AND key != '-' ) return true; if ( key == '-' ) { /* User typed a '-' */ /* If user has first character selected, then '-' is allowed */ if ( NOT ( std::min(sel_start,sel_end) == 0 AND std::max(sel_start,sel_end) > 0 ) ) { /* User does not have 1st char selected */ if (insertion_pt != 0 OR text[0] == '-' ) { return true; /* Can only place negative at beginning of text, and only one of them */ } } } if ( key == '.' ) { /*printf( "PERIOD: %d\n", num_periods ); */ if ( num_periods > 0 ) { /** We're trying to type a period, but the text already contains a period. Check whether the period is contained within is current selection (thus it will be safely replaced) **/ int period_found = false; if ( sel_start != sel_end ) { for( i=std::min(sel_end,sel_start); i<std::max(sel_start,sel_end); i++ ) { /* printf( "%c ", text[i] ); */ if ( text[i] == '.' ) { period_found = true; break; } } } /* printf( "found: %d num: %d\n", period_found, num_periods ); */ if ( NOT period_found ) return true; } } } else if (data_type == GLUI_EDITTEXT_INT) { if ( (key < '0' OR key > '9') AND key != '-' ) return true; if ( key == '-' ) { /* User typed a '-' */ /* If user has first character selected, then '-' is allowed */ if ( NOT ( std::min(sel_start,sel_end) == 0 AND std::max(sel_start,sel_end) > 0 ) ) { /* User does not have 1st char selected */ if (insertion_pt != 0 OR text[0] == '-' ) { return true; /* Can only place negative at beginning of text, and only one of them */ } } } } /** This is just to get rid of warnings - the flag regular_key is set if the key was not a backspace, return, whatever. But I believe if we're here, we know it was a regular key anyway */ if ( regular_key ) { } /**** If there's a current selection, erase it ******/ if ( sel_start != sel_end ) { clear_substring( std::min(sel_start,sel_end), std::max(sel_start,sel_end )); insertion_pt = std::min(sel_start,sel_end); sel_start = sel_end = insertion_pt; } /******** We insert the character into the string ***/ text.insert(insertion_pt,1,key); /******** Move the insertion point and substring_end one over ******/ insertion_pt++; substring_end++; sel_start = sel_end = insertion_pt; } /******** Now redraw text ***********/ /* Hack to prevent text box from being cleared first **/ /** int substring_change = update_substring_bounds(); draw_text_only = (NOT substring_change AND NOT has_selection AND regular_key ); */ draw_text_only = false; /** Well, hack is not yet working **/ update_and_draw_text(); draw_text_only = false; if ( debug ) dump( stdout, "<- KEY HANDLER" ); /*** Now look to see if this string has a period ***/ num_periods = 0; for( i=0; i<(int)text.length(); i++ ) if ( text[i] == '.' ) num_periods++; return true; }
void CustomElementRegistry::didCreateElement(Element* element) { activate(CustomElementInvocation(element)); }
void WifiAPItem::mouseReleaseEvent(QMouseEvent *e) { activateItem(); activate(0); }
virtual int open (void *) { return activate (); }
virtual int open (void *) { ACE_DEBUG ((LM_DEBUG, "Logrec_Writer. \n")); return activate (); }
/** * Activates the given block. * Listeners are notified. */ void RS_BlockList::activate(const QString& name) { RS_DEBUG->print("RS_BlockList::activateBlock"); activate(find(name)); }
int main(int argc, char *argv[]) { char inkey=0, *prgdir, *curdir, *program_name; bool ext, validcfg, quit = false, bkgply = false, batchply = false; unsigned int opt, prgdrive, i; CWindow *focus; #ifdef DEBUG f_log = fopen(DEBUG_FILE,"wt"); #endif std::cout << ADPLAYVERS << ", Copyright (c) 2000 - 2006 Simon Peter <*****@*****.**>" << std::endl << std::endl; // check that no other instance is running { char *adplayenv = getenv("ADPLAY"); if(adplayenv && !strcmp(adplayenv,"S")) { std::cout << "AdPlay already running!" << std::endl; exit(EXIT_FAILURE); } else setenv("ADPLAY","S",1); // flag our instance } // Build program executable name program_name = strrchr(argv[0], '\\') ? strrchr(argv[0], '\\') + 1 : argv[0]; CAdPlug::debug_output("debug.log"); // Redirect AdPlug's debug to file // Build path to default configuration file (in program's directory) SPLITPATH(argv[0],configfile,configfile+2,NULL,NULL); strcat(configfile,CONFIGFILE); loadconfig(configfile,DEFCONFIG); // load default configuration // parse commandline for general options while((opt = getopt(argc,argv))) switch(opt) { case 1: // display help case 2: std::cout << "Usage: " << program_name << " [options]" << std::endl << std::endl; std::cout << "Options can be set with '-' or '/' respectively." << std::endl << std::endl; std::cout << " -?, -h Display commandline help" << std::endl << " -p port Set OPL2 port" << std::endl << " -o Force OPL2 port" << std::endl << " -f file Use alternate configuration file" << std::endl << " -c section Load another configuration section" << std::endl << " -b file Immediate background playback using " << "specified file" << std::endl << " -q files Immediate (batch mode) playback using " << "specified files" << std::endl; showcursor(); exit(EXIT_SUCCESS); case 3: // set OPL2 port opl.setport(atoi(argv[myoptind++])); break; case 4: // force OPL2 port oplforce = true; break; case 7: // background playback bkgply = true; break; case 8: // batch mode playback batchply = true; break; } // Bail out if OPL2 not detected and not force if(!opl.detect() && !oplforce) { std::cout << "No OPL2 detected!" << std::endl; showcursor(); exit(EXIT_FAILURE); } // Hand our database to AdPlug CAdPlug::set_database(&mydb); /*** Background playback mode ***/ if(bkgply) if(!(p = CAdPlug::factory(argv[myoptind],&opl))) { std::cout << "[" << argv[myoptind] << "]: unsupported file type!" << std::endl; exit(EXIT_FAILURE); } else { std::cout << "Background playback... (type EXIT to stop)" << std::endl; #ifdef HAVE_WCC_TIMER_H tmInit(poll_player,0xffff,DEFSTACK); #elif defined HAVE_GCC_TIMER_H timer_init(poll_player); #endif dopoll = true; #ifdef __WATCOMC__ _heapshrink(); #endif system(getenv("COMSPEC")); #ifdef HAVE_WCC_TIMER_H tmClose(); #elif defined HAVE_GCC_TIMER_H timer_deinit(); #endif stop(); exit(EXIT_SUCCESS); } /*** Batch playback mode ***/ if(batchply) { #ifdef HAVE_WCC_TIMER_H tmInit(poll_player,0xffff,DEFSTACK); #elif defined HAVE_GCC_TIMER_H timer_init(poll_player); #endif for(i = myoptind; i < argc; i++) if(!(p = CAdPlug::factory(argv[i],&opl))) { std::cout << "[" << argv[i] << "]: unsupported file type!" << std::endl; #ifdef HAVE_WCC_TIMER_H tmClose(); #elif defined HAVE_GCC_TIMER_H timer_deinit(); #endif exit(EXIT_FAILURE); } else { dopoll = firsttime = true; std::cout << "Playing [" << argv[i] << "] ..." << std::endl; while(firsttime) ; // busy waiting stop(); dopoll = false; } #ifdef HAVE_WCC_TIMER_H tmClose(); #elif defined HAVE_GCC_TIMER_H timer_deinit(); #endif exit(EXIT_SUCCESS); } /*** interactive (GUI) mode ***/ getvideoinfo(&dosvideo); // Save previous video state // register our windows with the window manager wnds.reg(titlebar); wnds.reg(filesel); wnds.reg(songwnd); wnds.reg(instwnd); wnds.reg(volbars); wnds.reg(mastervol); wnds.reg(infownd); // load default GUI layout validcfg = loadcolors(configfile,DEFCONFIG); // reparse commandline for GUI options myoptind = 1; // reset option parser while((opt = getopt(argc,argv))) switch(opt) { case 5: // set config file strcpy(configfile,argv[myoptind++]); if(loadcolors(configfile,DEFCONFIG)) validcfg = true; break; case 6: // load config section loadcolors(configfile,argv[myoptind++]); break; } // bail out if no configfile could be loaded if(!validcfg) { std::cout << "No valid default GUI layout could be loaded!" << std::endl; exit(EXIT_FAILURE); } // init GUI if((tmpfn = TEMPNAM(getenv("TEMP"),"_AP"))) #ifdef __WATCOMC__ mkdir(tmpfn); #else mkdir(tmpfn, S_IWUSR); #endif prgdir = getcwd(NULL, PATH_MAX); _dos_getdrive(&prgdrive); setadplugvideo(); #ifdef HAVE_WCC_TIMER_H tmInit(poll_player,0xffff,DEFSTACK); #elif defined HAVE_GCC_TIMER_H timer_init(poll_player); #endif songwnd.setcaption("Song Info"); volbars.setcaption("VBars"); titlebar.setcaption(ADPLAYVERS); filesel.setcaption("Directory"); mastervol.setcaption("Vol"); filesel.refresh(); mastervol.set(63); display_help(infownd); filesel.setfocus(); reset_windows(); // main loop do { if(p) { // auto-update windows // wait_retrace(); idle_ms(1000/70); refresh_songinfo(songwnd); refresh_volbars(volbars,opl); if(onsongend && !firsttime) { // song ended switch(onsongend) { case 1: // auto-rewind dopoll = false; while(inpoll) ; // critical section... p->rewind(subsong); last_ms = time_ms = 0.0f; dopoll = true; // ...End critical section break; case 2: // stop playback stop(); reset_windows(); break; } } } // Check for keypress and read in, if any if(kbhit()) { if(!(inkey = toupper(getch()))) { ext = true; inkey = toupper(getch()); } else ext = false; focus = CWindow::getfocus(); // cache focused window dbg_printf("main(): Key pressed: %d %s\n", inkey, ext ? "(Ext)" : "(Norm)"); } else inkey = 0; if(ext) // handle all extended keys switch(inkey) { case 15: // [Shift]+[TAB] - Back cycle windows window_cycle(true); break; case 59: // [F1] - display help display_help(infownd); infownd.setfocus(); wnds.update(); break; case 60: // [F2] - change screen layout curdir = getcwd(NULL, PATH_MAX); chdir(prgdir); select_colors(); chdir(curdir); free(curdir); clearscreen(backcol); filesel.refresh(); wnds.update(); break; case 72: // [Up Arrow] - scroll up if(focus == &filesel) { filesel.select_prev(); filesel.update(); } else if(focus == &infownd) { infownd.scroll_up(); infownd.update(); } else if(focus == &instwnd) { instwnd.scroll_up(); instwnd.update(); } break; case 80: // [Down Arrow] - scroll down if(focus == &filesel) { filesel.select_next(); filesel.update(); } else if(focus == &infownd) { infownd.scroll_down(); infownd.update(); } else if(focus == &instwnd) { instwnd.scroll_down(); instwnd.update(); } break; case 75: // [Left Arrow] - previous subsong if(p && subsong) { subsong--; dopoll = false; while(inpoll) ; // critical section... totaltime = p->songlength(subsong); p->rewind(subsong); last_ms = time_ms = 0.0f; dopoll = true; // ...End critical section } break; case 77: // [Right Arrow] - next subsong if(p && subsong < p->getsubsongs()-1) { subsong++; dopoll = false; while(inpoll) ; // critical section... totaltime = p->songlength(subsong); p->rewind(subsong); last_ms = time_ms = 0.0f; dopoll = true; // ...End critical section } break; case 73: // [Page Up] - scroll up half window if(focus == &filesel) { filesel.select_prev(filesel.getsizey() / 2); filesel.update(); } else if(focus == &infownd) { infownd.scroll_up(infownd.getsizey() / 2); infownd.update(); } else if(focus == &instwnd) { instwnd.scroll_up(instwnd.getsizey() / 2); instwnd.update(); } break; case 81: // [Page Down] - scroll down half window if(focus == &filesel) { filesel.select_next(filesel.getsizey() / 2); filesel.update(); } else if(focus == &infownd) { infownd.scroll_down(infownd.getsizey() / 2); infownd.update(); } else if(focus == &instwnd) { instwnd.scroll_down(instwnd.getsizey() / 2); instwnd.update(); } break; case 71: // [Home] - scroll to start if(focus == &filesel) { filesel.setselection(0); filesel.update(); } else if(focus == &infownd) { infownd.scroll_set(0); infownd.update(); } else if(focus == &instwnd) { instwnd.scroll_set(0); instwnd.update(); } break; case 79: // [End] - scroll to end if(focus == &filesel) { filesel.setselection(0xffff); filesel.update(); } else if(focus == &infownd) { infownd.scroll_set(0xffff); infownd.update(); } else if(focus == &instwnd) { instwnd.scroll_set(0xffff); instwnd.update(); } break; } else // handle all normal keys switch(inkey) { case 9: // [TAB] - Cycle through windows window_cycle(); break; case 13: // [Return] - Activate if(focus == &filesel) activate(); break; case 27: // [ESC] - Stop music / Exit to DOS if(p) { stop(); reset_windows(); } else quit = true; break; case ' ': // [Space] - fast forward fast_forward(FF_MSEC); break; case 'M': // refresh song info refresh_songdesc(infownd); break; case 'D': // shell to DOS dosshell(getenv("COMSPEC")); filesel.refresh(); wnds.update(); break; case '+': // [+] - Increase volume adjust_volume(-1); break; case '-': // [-] - Decrease volume adjust_volume(+1); break; } } while(!quit); // deinit #ifdef HAVE_WCC_TIMER_H tmClose(); #elif defined HAVE_GCC_TIMER_H timer_deinit(); #endif stop(); setvideoinfo(&dosvideo); { unsigned int dummy; _dos_setdrive(prgdrive, &dummy); } chdir(prgdir); free(prgdir); if(tmpfn) { rmdir(tmpfn); free(tmpfn); } #ifdef DEBUG dbg_printf("main(): clean shutdown.\n"); fclose(f_log); #endif return EXIT_SUCCESS; }
void WidgetListItem::select() { if (isDisabled()) return; activate(); }
/* deal with a new player command in dungeon or city mode*/ void p_process(void) { static int searchval=0; if (Player.status[BERSERK]) if (goberserk()) { setgamestatus(SKIP_PLAYER); drawvision(Player.x,Player.y); } if (! gamestatusp(SKIP_PLAYER)) { if (searchval > 0) { searchval--; if (searchval == 0) resetgamestatus(FAST_MOVE); } drawvision(Player.x,Player.y); if (! gamestatusp(FAST_MOVE)) { searchval = 0; Cmd = mgetc(); clear_if_necessary(); } Command_Duration = 0; switch (Cmd) { case ' ': case 13: setgamestatus(SKIP_MONSTERS); break; /*no op on space or return*/ case 6: abortshadowform(); break; /* ^f */ case 7: wizard(); break; /* ^g */ case 4: player_dump(); break; /* ^d */ case 9: display_pack(); morewait(); xredraw(); break; /* ^i */ case 11: if (gamestatusp(CHEATED)) frobgamestatus(); case 12: xredraw(); setgamestatus(SKIP_MONSTERS); break; /* ^l */ #ifndef MSDOS_SUPPORTED_ANTIQUE case 16: bufferprint(); setgamestatus(SKIP_MONSTERS); break; /* ^p */ #else case 15: bufferprint(); setgamestatus(SKIP_MONSTERS); break; /* ^o */ #endif case 18: redraw(); setgamestatus(SKIP_MONSTERS); break; /* ^r */ case 23: if (gamestatusp(CHEATED)) drawscreen(); break; /* ^w */ case 24: /* ^x */ if (gamestatusp(CHEATED) || Player.rank[ADEPT]) wish(1); Command_Duration = 5; break; case 'a': zapwand(); Command_Duration = Player.speed*8/5; break; case 'c': closedoor(); Command_Duration = Player.speed*2/5; break; case 'd': drop(); Command_Duration = Player.speed*5/5; break; case 'e': eat(); Command_Duration = 30; break; case 'f': fire(); Command_Duration = Player.speed*5/5; break; case 'g': pickup(); Command_Duration = Player.speed*10/5; break; case 'i': do_inventory_control(); break; case 'm': magic(); Command_Duration = 12; break; case 'o': opendoor(); Command_Duration = Player.speed*5/5; break; case 'p': pickpocket(); Command_Duration = Player.speed*20/5; break; case 'q': quaff(); Command_Duration = 10; break; case 'r': peruse(); Command_Duration = 20; break; case 's': search(&searchval); Command_Duration = 20; break; case 't': talk(); Command_Duration = 10; break; case 'v': vault(); Command_Duration = Player.speed*10/5; break; case 'x': examine(); Command_Duration = 1; break; case 'z': bash_location(); Command_Duration = Player.speed*10/5; break; case 'A': activate(); Command_Duration = 10; break; case 'C': callitem(); break; case 'D': disarm(); Command_Duration = 30; break; case 'E': dismount_steed(); Command_Duration = Player.speed*10/5; break; case 'F': tacoptions(); break; case 'G': give(); Command_Duration = 10; break; case 'I': if (! optionp(TOPINV)) top_inventory_control(); else { display_possessions(); inventory_control(); } break; case 'M': city_move(); Command_Duration = 10; break; case 'O': setoptions(); #if defined(AMIGA) || defined(MSDOS_SUPPORTED_ANTIQUE) show_screen(); xredraw(); #endif break; case 'P': show_license(); break; /* actually show_license is in file.c */ case 'Q': quit(); break; case 'R': rename_player(); break; case 'S': save(optionp(COMPRESS_OPTION), FALSE); break; case 'T': tunnel(); Command_Duration = Player.speed*30/5; break; case 'V': version(); break; #ifdef MSDOS_SUPPORTED_ANTIQUE case 'X': check_memory(); break; #endif case 'Z': bash_item(); Command_Duration = Player.speed*10/5; break; case '.': rest(); Command_Duration = 10; break; case ',': Command_Duration = 10; nap(); break; case '>': downstairs(); break; case '<': upstairs(); break; case '@': p_movefunction(Level->site[Player.x][Player.y].p_locf); Command_Duration = 5; break; case '#': if (gamestatusp(CHEATED)) editstats(); break; /* RAC - char editor */ case '/': charid(); setgamestatus(SKIP_MONSTERS); break; case '?': help(); setgamestatus(SKIP_MONSTERS); break; case '4': case 'h': moveplayer(-1,0); Command_Duration = Player.speed*5/5; break; case '2': case 'j': moveplayer(0,1); Command_Duration = Player.speed*5/5; break; case '8': case 'k': moveplayer(0,-1); Command_Duration = Player.speed*5/5; break; case '6': case 'l': moveplayer(1,0); Command_Duration = Player.speed*5/5; break; case '1': case 'b': moveplayer(-1,1); Command_Duration = Player.speed*5/5; break; case '3': case 'n': moveplayer(1,1); Command_Duration = Player.speed*5/5; break; case '7': case 'y': moveplayer(-1,-1); Command_Duration = Player.speed*5/5; break; case '9': case 'u': moveplayer(1,-1); Command_Duration = Player.speed*5/5; break; case '5': setgamestatus(SKIP_MONSTERS); /* don't do anything; a dummy turn */ Cmd = mgetc(); while ((Cmd != ESCAPE) && ((Cmd < '1') || (Cmd > '9') || (Cmd=='5'))) { print3("Run in keypad direction [ESCAPE to abort]: "); Cmd = mgetc(); } if (Cmd != ESCAPE) setgamestatus(FAST_MOVE); break; case 'H': setgamestatus(FAST_MOVE); Cmd = 'h'; moveplayer(-1,0); Command_Duration = Player.speed*4/5; break; case 'J': setgamestatus(FAST_MOVE); Cmd = 'j'; moveplayer(0,1); Command_Duration = Player.speed*4/5; break; case 'K': setgamestatus(FAST_MOVE); Cmd = 'k'; moveplayer(0,-1); Command_Duration = Player.speed*4/5; break; case 'L': setgamestatus(FAST_MOVE); Cmd = 'l'; moveplayer(1,0); Command_Duration = Player.speed*4/5; break; case 'B': setgamestatus(FAST_MOVE); Cmd = 'b'; moveplayer(-1,1); Command_Duration = Player.speed*4/5; break; case 'N': setgamestatus(FAST_MOVE); Cmd = 'n'; moveplayer(1,1); Command_Duration = Player.speed*4/5; break; case 'Y': setgamestatus(FAST_MOVE); Cmd = 'y'; moveplayer(-1,-1); Command_Duration = Player.speed*4/5; break; case 'U': setgamestatus(FAST_MOVE); Cmd = 'u'; moveplayer(1,-1); Command_Duration = Player.speed*4/5; break; default: commanderror(); setgamestatus(SKIP_MONSTERS); break; } } if (Current_Environment != E_COUNTRYSIDE) roomcheck(); screencheck(Player.x,Player.y); }
bool NativeEditBox::pointerReleased(MAPoint2d p, int id) { activate(); return false; }
QgsComposer::QgsComposer( QgisApp *qgis, const QString& title ): QMainWindow(), mTitle( title ), mUndoView( 0 ) { setupUi( this ); setWindowTitle( mTitle ); setupTheme(); QObject::connect( mButtonBox, SIGNAL( rejected() ), this, SLOT( close() ) ); QSettings settings; int size = settings.value( "/IconSize", 24 ).toInt(); setIconSize( QSize( size, size ) ); QToolButton* orderingToolButton = new QToolButton( this ); orderingToolButton->setPopupMode( QToolButton::InstantPopup ); orderingToolButton->setAutoRaise( true ); orderingToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly ); orderingToolButton->addAction( mActionRaiseItems ); orderingToolButton->addAction( mActionLowerItems ); orderingToolButton->addAction( mActionMoveItemsToTop ); orderingToolButton->addAction( mActionMoveItemsToBottom ); orderingToolButton->setDefaultAction( mActionRaiseItems ); toolBar->addWidget( orderingToolButton ); QToolButton* alignToolButton = new QToolButton( this ); alignToolButton->setPopupMode( QToolButton::InstantPopup ); alignToolButton->setAutoRaise( true ); alignToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly ); alignToolButton->addAction( mActionAlignLeft ); alignToolButton->addAction( mActionAlignHCenter ); alignToolButton->addAction( mActionAlignRight ); alignToolButton->addAction( mActionAlignTop ); alignToolButton->addAction( mActionAlignVCenter ); alignToolButton->addAction( mActionAlignBottom ); alignToolButton->setDefaultAction( mActionAlignLeft ); toolBar->addWidget( alignToolButton ); QActionGroup* toggleActionGroup = new QActionGroup( this ); toggleActionGroup->addAction( mActionMoveItemContent ); toggleActionGroup->addAction( mActionAddNewMap ); toggleActionGroup->addAction( mActionAddNewLabel ); toggleActionGroup->addAction( mActionAddNewLegend ); toggleActionGroup->addAction( mActionAddNewScalebar ); toggleActionGroup->addAction( mActionAddImage ); toggleActionGroup->addAction( mActionSelectMoveItem ); toggleActionGroup->addAction( mActionAddBasicShape ); toggleActionGroup->addAction( mActionAddArrow ); toggleActionGroup->addAction( mActionAddTable ); toggleActionGroup->setExclusive( true ); mActionAddNewMap->setCheckable( true ); mActionAddNewLabel->setCheckable( true ); mActionAddNewLegend->setCheckable( true ); mActionSelectMoveItem->setCheckable( true ); mActionAddNewScalebar->setCheckable( true ); mActionAddImage->setCheckable( true ); mActionMoveItemContent->setCheckable( true ); mActionAddBasicShape->setCheckable( true ); mActionAddArrow->setCheckable( true ); #ifdef Q_WS_MAC QMenu *appMenu = menuBar()->addMenu( tr( "QGIS" ) ); appMenu->addAction( QgisApp::instance()->actionAbout() ); appMenu->addAction( QgisApp::instance()->actionOptions() ); #endif QMenu *fileMenu = menuBar()->addMenu( tr( "File" ) ); fileMenu->addAction( mActionLoadFromTemplate ); fileMenu->addAction( mActionSaveAsTemplate ); fileMenu->addSeparator(); fileMenu->addAction( mActionExportAsImage ); fileMenu->addAction( mActionExportAsPDF ); fileMenu->addAction( mActionExportAsSVG ); fileMenu->addSeparator(); fileMenu->addAction( mActionPageSetup ); fileMenu->addAction( mActionPrint ); fileMenu->addSeparator(); fileMenu->addAction( mActionQuit ); QObject::connect( mActionQuit, SIGNAL( triggered() ), this, SLOT( close() ) ); QMenu *viewMenu = menuBar()->addMenu( tr( "View" ) ); viewMenu->addAction( mActionZoomIn ); viewMenu->addAction( mActionZoomOut ); viewMenu->addAction( mActionZoomAll ); viewMenu->addSeparator(); viewMenu->addAction( mActionRefreshView ); QMenu *layoutMenu = menuBar()->addMenu( tr( "Layout" ) ); layoutMenu->addAction( mActionUndo ); layoutMenu->addAction( mActionRedo ); layoutMenu->addSeparator(); layoutMenu->addAction( mActionAddNewMap ); layoutMenu->addAction( mActionAddNewLabel ); layoutMenu->addAction( mActionAddNewScalebar ); layoutMenu->addAction( mActionAddNewLegend ); layoutMenu->addAction( mActionAddImage ); layoutMenu->addAction( mActionSelectMoveItem ); layoutMenu->addAction( mActionMoveItemContent ); layoutMenu->addAction( mActionAddBasicShape ); layoutMenu->addAction( mActionAddArrow ); layoutMenu->addAction( mActionAddTable ); layoutMenu->addSeparator(); layoutMenu->addAction( mActionGroupItems ); layoutMenu->addAction( mActionUngroupItems ); layoutMenu->addAction( mActionRaiseItems ); layoutMenu->addAction( mActionLowerItems ); layoutMenu->addAction( mActionMoveItemsToTop ); layoutMenu->addAction( mActionMoveItemsToBottom ); #ifdef Q_WS_MAC #ifndef Q_WS_MAC64 /* assertion failure in NSMenuItem setSubmenu (Qt 4.5.0-snapshot-20080830) */ menuBar()->addMenu( QgisApp::instance()->windowMenu() ); menuBar()->addMenu( QgisApp::instance()->helpMenu() ); #endif #endif mQgis = qgis; mFirstTime = true; // Create action to select this window mWindowAction = new QAction( windowTitle(), this ); connect( mWindowAction, SIGNAL( triggered() ), this, SLOT( activate() ) ); QgsDebugMsg( "entered." ); setMouseTracking( true ); //mSplitter->setMouseTracking(true); mViewFrame->setMouseTracking( true ); //create composer view mView = new QgsComposerView( mViewFrame ); connectSlots(); //init undo/redo buttons mComposition = new QgsComposition( mQgis->mapCanvas()->mapRenderer() ); mActionUndo->setEnabled( false ); mActionRedo->setEnabled( false ); if ( mComposition->undoStack() ) { connect( mComposition->undoStack(), SIGNAL( canUndoChanged( bool ) ), mActionUndo, SLOT( setEnabled( bool ) ) ); connect( mComposition->undoStack(), SIGNAL( canRedoChanged( bool ) ), mActionRedo, SLOT( setEnabled( bool ) ) ); }
// the argument is the name of the directory or the file name int ibis::skive::write(const char* dt) const { if (vals.empty()) return -1; std::string fnm; indexFileName(fnm, dt); if (fnm.empty()) { return 0; } else if (0 != str && 0 != str->filename() && 0 == fnm.compare(str->filename())) { LOGGER(ibis::gVerbose > 0) << "Warning -- skive::write can not overwrite the index file \"" << fnm << "\" while it is used as a read-only file map"; return 0; } else if (fname != 0 && *fname != 0 && 0 == fnm.compare(fname)) { activate(); // read everything into memory fname = 0; // break the link with the named file } ibis::fileManager::instance().flushFile(fnm.c_str()); int fdes = UnixOpen(fnm.c_str(), OPEN_WRITENEW, OPEN_FILEMODE); if (fdes < 0) { ibis::fileManager::instance().flushFile(fnm.c_str()); fdes = UnixOpen(fnm.c_str(), OPEN_WRITENEW, OPEN_FILEMODE); if (fdes < 0) { LOGGER(ibis::gVerbose > 0) << "Warning -- skive[" << col->partition()->name() << '.' << col->name() << "]::write failed to open \"" << fnm << "\" for writing"; return -2; } } IBIS_BLOCK_GUARD(UnixClose, fdes); #if defined(_WIN32) && defined(_MSC_VER) (void)_setmode(fdes, _O_BINARY); #endif #ifdef FASTBIT_USE_LONG_OFFSETS const bool useoffset64 = true; #else const bool useoffset64 = (getSerialSize()+8 > 0x80000000UL); #endif char header[] = "#IBIS\11\0\0"; header[5] = (char)ibis::index::SKIVE; header[6] = (char)(useoffset64 ? 8 : 4); int ierr = UnixWrite(fdes, header, 8); if (ierr < 8) { LOGGER(ibis::gVerbose > 0) << "Warning -- skive[" << col->partition()->name() << "." << col->name() << "]::write(" << fnm << ") failed to write the 8-byte header, ierr = " << ierr; return -3; } if (useoffset64) ierr = write64(fdes); else ierr = write32(fdes); if (ierr >= 0) { #if defined(FASTBIT_SYNC_WRITE) #if _POSIX_FSYNC+0 > 0 (void) UnixFlush(fdes); // write to disk #elif defined(_WIN32) && defined(_MSC_VER) (void) _commit(fdes); #endif #endif LOGGER(ibis::gVerbose > 3) << "skive[" << col->partition()->name() << "." << col->name() << "]::write wrote " << bits.size() << " bitmap" << (bits.size()>1?"s":"") << " to file " << fnm; } return ierr; } // ibis::skive::write
bool QWidgetResizeHandler::eventFilter(QObject *o, QEvent *ee) { if (!isActive() || (ee->type() != QEvent::MouseButtonPress && ee->type() != QEvent::MouseButtonRelease && ee->type() != QEvent::MouseMove && ee->type() != QEvent::KeyPress && ee->type() != QEvent::ShortcutOverride) ) return false; Q_ASSERT(o == widget); QWidget *w = widget; if (QApplication::activePopupWidget()) { if (buttonDown && ee->type() == QEvent::MouseButtonRelease) buttonDown = false; return false; } QMouseEvent *e = (QMouseEvent*)ee; switch (e->type()) { case QEvent::MouseButtonPress: { if (w->isMaximized()) break; if (!widget->rect().contains(widget->mapFromGlobal(e->globalPos()))) return false; if (e->button() == Qt::LeftButton) { #if defined(Q_WS_X11) /* Implicit grabs do not stop the X server from changing the cursor in children, which looks *really* bad when doing resizingk, so we grab the cursor. Note that we do not do this on Windows since double clicks are lost due to the grab (see change 198463). */ if (e->spontaneous()) # if !defined(QT_NO_CURSOR) widget->grabMouse(widget->cursor()); # else widget->grabMouse(); # endif // QT_NO_CURSOR #endif // Q_WS_X11 buttonDown = false; emit activate(); bool me = movingEnabled; movingEnabled = (me && o == widget); mouseMoveEvent(e); movingEnabled = me; buttonDown = true; moveOffset = widget->mapFromGlobal(e->globalPos()); invertedMoveOffset = widget->rect().bottomRight() - moveOffset; if (mode == Center) { if (movingEnabled) return true; } else { return true; } } } break; case QEvent::MouseButtonRelease: if (w->isMaximized()) break; if (e->button() == Qt::LeftButton) { moveResizeMode = false; buttonDown = false; widget->releaseMouse(); widget->releaseKeyboard(); if (mode == Center) { if (movingEnabled) return true; } else { return true; } } break; case QEvent::MouseMove: { if (w->isMaximized()) break; buttonDown = buttonDown && (e->buttons() & Qt::LeftButton); // safety, state machine broken! bool me = movingEnabled; movingEnabled = (me && o == widget && (buttonDown || moveResizeMode)); mouseMoveEvent(e); movingEnabled = me; if (mode == Center) { if (movingEnabled) return true; } else { return true; } } break; case QEvent::KeyPress: keyPressEvent((QKeyEvent*)e); break; case QEvent::ShortcutOverride: if (buttonDown) { ((QKeyEvent*)ee)->accept(); return true; } break; default: break; } return false; }
void BookView::deactivate(){ activate(-1); }
InstrumentTrackView::InstrumentTrackView( InstrumentTrack * _it, TrackContainerView* tcv ) : TrackView( _it, tcv ), m_window( NULL ), m_lastPos( -1, -1 ) { setAcceptDrops( true ); setFixedHeight( 32 ); m_tlb = new TrackLabelButton( this, getTrackSettingsWidget() ); m_tlb->setCheckable( true ); m_tlb->setIcon( embed::getIconPixmap( "instrument_track" ) ); m_tlb->move( 3, 1 ); m_tlb->show(); connect( m_tlb, SIGNAL( toggled( bool ) ), this, SLOT( toggleInstrumentWindow( bool ) ) ); connect( _it, SIGNAL( nameChanged() ), m_tlb, SLOT( update() ) ); // creation of widgets for track-settings-widget int widgetWidth; if( ConfigManager::inst()->value( "ui", "compacttrackbuttons" ).toInt() ) { widgetWidth = DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT; } else { widgetWidth = DEFAULT_SETTINGS_WIDGET_WIDTH; } m_volumeKnob = new Knob( knobSmall_17, getTrackSettingsWidget(), tr( "Volume" ) ); m_volumeKnob->setVolumeKnob( true ); m_volumeKnob->setModel( &_it->m_volumeModel ); m_volumeKnob->setHintText( tr( "Volume:" ), "%" ); m_volumeKnob->move( widgetWidth-2*24, 2 ); m_volumeKnob->setLabel( tr( "VOL" ) ); m_volumeKnob->show(); m_volumeKnob->setWhatsThis( tr( volume_help ) ); m_panningKnob = new Knob( knobSmall_17, getTrackSettingsWidget(), tr( "Panning" ) ); m_panningKnob->setModel( &_it->m_panningModel ); m_panningKnob->setHintText( tr( "Panning:" ), "%" ); m_panningKnob->move( widgetWidth-24, 2 ); m_panningKnob->setLabel( tr( "PAN" ) ); m_panningKnob->show(); m_midiMenu = new QMenu( tr( "MIDI" ), this ); // sequenced MIDI? if( !Engine::mixer()->midiClient()->isRaw() ) { _it->m_midiPort.m_readablePortsMenu = new MidiPortMenu( MidiPort::Input ); _it->m_midiPort.m_writablePortsMenu = new MidiPortMenu( MidiPort::Output ); _it->m_midiPort.m_readablePortsMenu->setModel( &_it->m_midiPort ); _it->m_midiPort.m_writablePortsMenu->setModel( &_it->m_midiPort ); m_midiInputAction = m_midiMenu->addMenu( _it->m_midiPort.m_readablePortsMenu ); m_midiOutputAction = m_midiMenu->addMenu( _it->m_midiPort.m_writablePortsMenu ); } else { m_midiInputAction = m_midiMenu->addAction( "" ); m_midiOutputAction = m_midiMenu->addAction( "" ); m_midiInputAction->setCheckable( true ); m_midiOutputAction->setCheckable( true ); connect( m_midiInputAction, SIGNAL( changed() ), this, SLOT( midiInSelected() ) ); connect( m_midiOutputAction, SIGNAL( changed() ), this, SLOT( midiOutSelected() ) ); connect( &_it->m_midiPort, SIGNAL( modeChanged() ), this, SLOT( midiConfigChanged() ) ); } m_midiInputAction->setText( tr( "Input" ) ); m_midiOutputAction->setText( tr( "Output" ) ); m_activityIndicator = new FadeButton( QApplication::palette().color( QPalette::Active, QPalette::Background), QApplication::palette().color( QPalette::Active, QPalette::BrightText ), getTrackSettingsWidget() ); m_activityIndicator->setGeometry( widgetWidth-2*24-11, 2, 8, 28 ); m_activityIndicator->show(); connect( m_activityIndicator, SIGNAL( pressed() ), this, SLOT( activityIndicatorPressed() ) ); connect( m_activityIndicator, SIGNAL( released() ), this, SLOT( activityIndicatorReleased() ) ); connect( _it, SIGNAL( newNote() ), m_activityIndicator, SLOT( activate() ) ); setModel( _it ); }
void QDeclarativeOpenMetaObject::setValue(int id, const QVariant &value) { d->writeData(id, value); activate(d->object, id + d->type->d->signalOffset, 0); }
void CoorImpl::emitActivate() { emit activate(); }
/* Only needed to test the program as .exe */ int main() { activate(); main_loop(); deactivate(); }
void CPHObject::EnableObject(CPHObject* obj) { activate(); }
/*! @function initAll Initializes the AsyncStream Recieve command object @result true if successfull. */ bool IOFWAsyncStreamReceiver::initAll( IOFireWireController *control, UInt32 channel ) { IOReturn status = kIOReturnSuccess; fControl = control; fFWIM = fControl->getLink(); fControl->closeGate(); #ifdef DCL_MODE // Create a DCL program fdclProgram = CreateAsyncStreamRxDCLProgram(receiveAsyncStream, this); if(fdclProgram == NULL){ DebugLog("IOFWAsyncStreamReceiver::initAll -> CreateAsyncStreamRxDCLProgram failed %x\n", status); return false; } fChannel = channel; fSpeed = kFWSpeedMaximum; fActive = false; fInitialized = true; fAsyncStreamClients = OSSet::withCapacity(2); if( fAsyncStreamClients ) fAsyncStreamClientIterator = OSCollectionIterator::withCollection( fAsyncStreamClients ); status = activate(control->getBroadcastSpeed()); if ( status == kIOReturnSuccess ) { fIODclProgram->setForceStopProc( forceStopNotification, this, fAsyncStreamChan ); } #else UInt64 mask = fControl->getFireWirePhysicalBufferMask(); // get controller mask mask &= ~((UInt64)(PAGE_SIZE-1)); // page align fBufDesc = IOBufferMemoryDescriptor::inTaskWithPhysicalMask( kernel_task, // kernel task 0, // options kMaxAsyncStreamReceiveBufferSize*2, // size = 4096 * 2 mask ); // mask for physically addressable memory if( fBufDesc ) { fListener = control->createMultiIsochReceiveListener(channel,receiveAsyncStream,this); if ( fListener ) { fChannel = channel; fSpeed = kFWSpeedMaximum; fActive = false; fInitialized = true; fAsyncStreamClients = OSSet::withCapacity(1); if( fAsyncStreamClients ) { fAsyncStreamClientIterator = OSCollectionIterator::withCollection( fAsyncStreamClients ); } else { status = kIOReturnError; } status = fListener->Activate(); } else { status = kIOReturnError; } } else { status = kIOReturnError; } #endif fControl->openGate(); return ( status == kIOReturnSuccess ); }
void GameObject::activate(float gravity) { //setAccelY(gravity); activate(); }