int QtMenuBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QDeclarativeItem::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 1) qt_static_metacall(this, _c, _id, _a); _id -= 1; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QDeclarativeListProperty<QtMenu>*>(_v) = menus(); break; } _id -= 1; } else if (_c == QMetaObject::WriteProperty) { _id -= 1; } else if (_c == QMetaObject::ResetProperty) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 1; } #endif // QT_NO_PROPERTIES return _id; }
std::vector<IMenu*> LayoutManager::findAllMenus(IWindow& window, const char* path) { // create a collection of all menus associated with this window. auto& windowMenus = window.menus(); std::vector<IMenu*> menus(windowMenus.size() + dynamicMenus_.size()); // copy all the menus owned by the window auto it = std::transform(windowMenus.begin(), windowMenus.end(), menus.begin(), [](const std::unique_ptr<IMenu>& menu) { return menu.get(); }); // copy all the menus dynamically registered for this window auto windowId = safe_str(window.id()); it = std::copy_if(dynamicMenus_.begin(), dynamicMenus_.end(), it, [&](IMenu* menu) { auto menuWindowId = safe_str(menu->windowId()); return strcmp(windowId, menuWindowId) == 0; }); // resize the collection to the actual number of menus that were collected menus.erase(it, menus.end()); for (auto it = menus.begin(); it != menus.end();) { if (matchMenu(**it, path)) { ++it; continue; } it = menus.erase(it); } return menus; }
MenusPtr Database::GetMenus() const { MenusPtr menus(new Menus); XmlParser::MenuRange meals = m_parser.GetMeals(); BOOST_FOREACH(const XmlParser::MenuItem& item, meals) { menus->AddMeal(item.name); }
void bprintf(soul_t *ptr) { while(buf->u == 0) ; tools("clear", NULL); XY(15, 0); // printf(" THIS IS A STOP FOR THE MENU \n"); // Shows where buffer will end. XY(0, 0); menus(ptr, 1); menus(ptr->o, 1); printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"); for(int n = 0; n < STRINGS; n++) { if(buf->s[n] != NULL) printf(" %s \n", buf->s[n]); } printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"); buf->u = 0; menus(ptr, 2); menus(ptr->o, 2); }
/* PPROMPT -- Print prompt as first two chars of prompt string plus "> ", i.e., * "pk> ". If null prompt string (NOCLOSURE), print the continuation prompt * ">>> ". Also print, before the prompt, all ltasks in current package * if menus() are enabled and a new package has been invoked. */ void pprompt ( register char *string ) { static struct package *lastpack = NULL; if (menus() && curpack != lastpack) { listhelp (curpack, NO); lastpack = curpack; } printf ("%2.2s", string); printf ("> "); fflush (stdout); }
void WindowManager::addCommandToMenu( const QString& _menuPath, const QString& _commandName ) { QStringList menus( _menuPath.split( Resources::MenuItemsSeparator ) ); assert( menus.size() > 1 ); QString menuPath = menus[ 0 ]; QMenu* currentMenu = getMenuByPath( m_mainWindow->menuBar(), menuPath ); for ( int i = 1; i < menus.size() - 1; ++i ) { menuPath = menuPath + Resources::MenuItemsSeparator + menus[ i ]; currentMenu = getMenuByPath( currentMenu, menuPath ); } MenuItem* menuItem = new MenuItem( _commandName, menus[ menus.size() - 1 ], m_environment, currentMenu ); currentMenu->addAction( menuItem ); } // WindowManager::addCommandToMenu
/* GET_PROMPT -- Get prompt as first two chars of prompt string plus "> ", i.e., * "pk> ". If null prompt string (NOCLOSURE), print the continuation prompt * ">>> ". Also print, before the prompt, all ltasks in current package * if menus() are enabled and a new package has been invoked. */ void get_prompt (register char *string) { static struct package *lastpack = NULL; extern long int run_level; if (menus() && curpack != lastpack) { listhelp (curpack, NO); lastpack = curpack; printf ("\n"); fflush (stdout); } if (strncmp ("clpackage", string, 9) == 0) strcpy (prompt, "ecl> "); else sprintf (prompt, (eh_longprompt == YES) ? "%s> " : "%2.2s> ", string); run_level = 0; }
FILE * chooseFile(char* dir) { int files, length; getMaxsizeofDIR(dir,&files,&length); bool *isDIR = (bool *) malloc(files*sizeof(bool*)); char **choices = (char**)malloc((files+3)*sizeof(char*)); int i; for(i = 0; i < files; i++) { choices[i] = (char *)malloc(length*sizeof(char)); } DIR *dp; struct dirent *ep; dp = opendir (dir); if(dp != NULL) { isDIR[0] = true; strcpy(choices[0],"\\.."); i = 1; clearScreen(); while(!quit) { if ((ep = readdir (dp))!=NULL) { if(ep->d_name[0]!='.') { isDIR[i] = ep->d_type==DT_DIR; if(isDIR[i]) { strcpy(choices[i],"\\"); strcat(choices[i],ep->d_name); } else strcpy(choices[i],ep->d_name); i++; } } else { break; } } int result = menus("Select file to be plotted",choices,NULL,files,length+3); if(result==-1) return NULL; char fileName[1024]; strcpy(fileName,dir); if(result==1) { char ch = 'a'; int last = 0; int count; char fileName2[1024]; for(count = 0;ch !='\0';count++) { ch = fileName[count]; if(ch=='/'&&fileName[count+1]!='\0') last = count; } last++; for(count = 0;count < last;count++) { fileName2[count] = fileName[count]; } fileName2[last] = '\0'; return chooseFile(fileName2); } int loop; char c = 'a'; strcat(fileName,"\0"); for(loop = 0;c !='\0';loop++) { c = fileName[loop]; } if(loop>2&&fileName[loop-2]!='/') strcat(fileName,"/"); if(isDIR[result-1]) { strcat(fileName,&(choices[result-1][1])); return chooseFile(fileName); } strcat(fileName,choices[result-1]); } else { printw("\ngot an error could not open the directory!\n"); getch(); perror("Could't open the directory"); } return fopen("makefile","r"); }
int main(int argc, char **argv) { int ADCvalue01 = 0; int StepSpeed = 100; //Stepping speed (smaler value = faster) int i = 0; int KeyHit = 0; int KeyCode[5]; int SingleKey=0; char TextLine[300]; char FileName[100] = ""; char FileNameOld[100] = ""; char FullFileName[300]; char a; char IsDigit[]="-1234567890"; int ReadState = 0; int MenueLevel = 0; int FileSelected = 0; int FileStartRow = 0; int stopPlot = 0; long xMin = 1000000, xMax = -1000000; long yMin = 1000000, yMax = -1000000; long coordinateCount = 0; long coordinatePlot = 0; long currentPlotX = 0, currentPlotY = 0, currentPlotDown = 1; long xNow = 0, yNow = 0, zNow = 0; char *pEnd; FILE *PlotFile; double Scale = 1.0; double OldScale = 1.0; double PicWidth = 0.0; double PicHeight = 0.0; long MoveLength = 100; long OldMoveLength = 200; long PlotStartTime = 0; int MoveFinished = 0; long stepPause = 5000; long stepPauseNormal = 5000; long stepPauseMaterial = 20000; long zHub = 200; int plotterMode = 1; char FileInfo[3]; long FileSize; long LongTemp; long DataOffset; long HeaderSize; long PictureWidth; long PictureHeight; int IntTemp; int ColorDepth; long CompressionType; long PictureSize; long XPixelPerMeter; long YPixelPerMeter; long ColorNumber; long ColorUsed; int PixelRed, PixelGreen, PixelBlue; int PixOK = 0; long StepsPerPixelX = 50, StepsPerPixelY = 50; long JetOffset1 = 40, JetOffset2 = 40; //Mapping between wiringPi and pin order of my I/O board. //This was necessary, because I used a wrong description of the GPIOs //You have to change the order according to your board! //@@@THESE ARE ALL OUTPUS!! strcpy(FileName, "noFiLE"); if (wiringPiSetup () == -1){ printf("Could not run wiringPiSetup!"); exit(1); } getmaxyx(stdscr, MaxRows, MaxCols); MessageY = MaxRows-3; clrscr(1, MaxRows); PrintRow('-', MessageY - 1); initscr(); noecho(); cbreak(); start_color(); while(!quit) { clearScreen(); char * choices[] = {"Plot File","Manual Control","Servo Control","Opto Sensor Control","X&Y Control","initalize","Exit"}; char *description[] = { "You select a file to plot and will plot the file on the plotter", "Will give you full control over the plotter for debuging or demenstration", "Lets you enter and test different duration of pulses sent to the servo for fine tuning and debugging", "Will read in the togleing of the opto sensor for debuging", "Will let you have control how much to move in x and y by ticks more precisly", "Test initalization procedure", "Will exit the prgram"}; int result = menus("Hello and Welcome to my creation please sleect a mode", choices,description,7,20); switch (result) { case 1: ; /* FILE * fp; char * line = NULL; size_t len = 0; ssize_t read; fp = fopen ("sampleGcode.txt","r");*/ //Plot file char dir[1024]; getcwd(dir,sizeof(dir)); MessageText("3 seconds until plotting starts !!!!!!!!!!!!!!!!!", 1, 2, 0); delay(3000); if((PlotFile=chooseFile(dir))==NULL){ sprintf(TextLine, "Can't open file '%s'!\n", FullFileName); strcpy(FileName, "NoFiLE"); ErrorText(TextLine); } else{ currentPlotX = 0; currentPlotY = 0; PlotStartTime = time(0); PrintMenue_03(FullFileName, coordinateCount, 0, 0, 0, PlotStartTime,Scale); coordinatePlot = 0; stopPlot = 0; if(currentPlotDown == 1){ penMove(1); currentPlotDown = 0; } while(!(feof(PlotFile)) && stopPlot == 0){ fread(&a, 1, 1, PlotFile); if(a == '>'){ ReadState = 0; } if(ReadState == 0 || ReadState == 1){ TextLine[i] = a; TextLine[i+1] = '\0'; i++; } if(ReadState == 2 || ReadState == 3){ if(strchr(IsDigit, a) != NULL){ TextLine[i] = a; TextLine[i+1] = '\0'; i++; } } if(ReadState == 2){ if(strchr(IsDigit, a) == NULL){ if(strlen(TextLine) > 0){ xNow = (strtol(TextLine, &pEnd, 10) - xMin) * 0.33333 * Scale; ReadState = 3; i=0; TextLine[0]='\0'; } } } if(ReadState == 3){ if(strchr(IsDigit, a) == NULL){ if(strlen(TextLine) > 0){ yNow = ((yMax - strtol(TextLine, &pEnd, 10)) - yMin) * 0.33333 * Scale;//Flip around y-axis coordinatePlot++; PrintMenue_03(FullFileName, coordinateCount, coordinatePlot, xNow, yNow, PlotStartTime, Scale); if(stopPlot == 0){ stopPlot =0; moveXY(xNow - currentPlotX, yNow - currentPlotY); currentPlotX = xNow; currentPlotY = yNow; // sprintf(TextLine, "xNow=%ld, yNow=%ld", xNow, yNow); // MessageText(TextLine, MessageX+1, MessageY+1, 0); // getch(); } else{ if(currentPlotDown == 1){ if(plotterMode == 1){ penMove(1); } currentPlotDown = 0; } } if(currentPlotDown == 0){ if(stopPlot == 0){ penMove(0); currentPlotDown = 1; } } ReadState = 2; i=0; TextLine[0]='\0'; } } } if(strcmp(TextLine, "<path") == 0){ if(currentPlotDown == 1){ penMove(1); currentPlotDown = 0; } ReadState = 2; i = 0; TextLine[0]='\0'; } if(a == '<'){ i = 1; TextLine[0] = a; TextLine[1] = '\0'; ReadState = 1; } } fclose(PlotFile); if(currentPlotDown == 1){ penMove(1); currentPlotDown = 0; } PrintMenue_03(FullFileName, coordinateCount, coordinatePlot, 0, 0, PlotStartTime,Scale); moveXY(-currentPlotX, -currentPlotY); currentPlotX = 0; currentPlotY = 0; while(kbhit()){ getch(); } MessageText("Finished! Press any key to return to main menu.", MessageX, MessageY, 0); getch(); break; } break; case 2: manualControl(); break; case 3: servoControl(); break; case 4: optoControl(); break; case 5: xyControl(); break; case 6: initalize(); break; case -1: default: system("reset"); quit=true; break; } } allSTOP(); endwin(); return 0; }