void getopt_process_args(int argc, char *argv[]) { int opt; while ((opt = getopt(argc, argv, "xc:p:l:")) != -1) { switch(opt) { case 'x': runAsDaemon = FALSE; break; case 'c': config_filename = strdup(optarg); break; case 'p': pid_filename = strdup(optarg); break; case 'h': displayHelp (); exit (EXIT_SUCCESS); break; case 'l': log_filename = strdup(optarg); break; default: displayHelp (); exit (EXIT_FAILURE); } } }
void Wrapper::assignVariables() { //set file name fileName = args.value("arg-1"); //set typesystem filename typesystemFileName = args.value("arg-2"); if (args.contains("arg-3")) displayHelp(gs); //set filename to default masterinclude if is empty if (fileName.isEmpty()) fileName = default_file; //if type system filename is empty, set it to default system file... if (typesystemFileName.isEmpty()) typesystemFileName = default_system; //if filename or typesystem filename is still empty, show help if (fileName.isEmpty() || typesystemFileName.isEmpty()) displayHelp(gs); //if generatorset can't read arguments, show help if (!gs->readParameters(args)) displayHelp(gs); }
int main (int argc, char **argv) { char *datasourceName; char *datasourceArg; char datasourceResult[SNOOPY_DATASOURCE_MESSAGE_MAX_SIZE]; int retVal; /* Initialize Snoopy */ snoopy_inputdatastorage_store_filename(argv[0]); snoopy_inputdatastorage_store_argv(argv); /* Check if there is a data source name passed as an argument */ if (argc < 2) { displayHelp(); return fatalError("Missing argument: datasource name or '--list'"); } datasourceName = argv[1]; /* Is second argument --list? */ if (0 == strcmp(argv[1], "--list")) { /* Loop throught all data sources and just append the output */ int i = 0; while (strcmp(snoopy_datasourceregistry_names[i], "") != 0) { printf("%s\n", snoopy_datasourceregistry_names[i]); i++; } return 0; } /* Check if what we got is a valid datasource name */ if (SNOOPY_FALSE == snoopy_datasourceregistry_isRegistered(datasourceName)) { displayHelp(); return fatalError("Invalid datasource name given"); } /* Is there an argument for this data source */ if (2 < argc) { datasourceArg = argv[2]; } else { datasourceArg = ""; } /* Call the datasource */ retVal = snoopy_datasourceregistry_call(datasourceName, datasourceResult, datasourceArg); if (SNOOPY_DATASOURCE_FAILED(retVal)) { return fatalError("Datasource failed"); } /* Display and return */ printf("%s\n", datasourceResult); return 0; }
int main(int argc, char* argv[]) { //Parsing arguments //There will be only three arguments, so no detailed parsing is required. std::cout<<"zimpatch\n"<<std::flush; for(int i=0; i<argc; i++) { if(std::string(argv[i])=="-h") { displayHelp(); return 0; } if(std::string(argv[i])=="-H") { displayHelp(); return 0; } if(std::string(argv[i])=="--help") { displayHelp(); return 0; } } if(argc<4) { std::cout<<"\n[ERROR] Not enough Arguments provided\n"; displayHelp(); return -1; } //Strings containing the filenames of the start_file, diff_file and end_file. std::string start_filename =argv[1]; std::string diff_filename =argv[2]; std::string end_filename= argv[3]; std::cout<<"\nStart File: "<<start_filename; std::cout<<"\nDiff File: "<<diff_filename; std::cout<<"\nEnd File: "<<end_filename<<"\n"; try { //Callling zimwriter to create the diff_file zim::writer::ZimCreator c(argc, argv); //Create the article source class, from which the content for the file will be read. ArticleSource src(start_filename,diff_filename); //Create the actual file. c.create(end_filename,src); } catch (const std::exception& e) { std::cerr << e.what() << std::endl; } }
// ------------------------------------Display Help----------------------------------------------- // Description: Displays contents of tree recursively inorder // ------------------------------------------------------------------------------------------------------------- string BinTree::displayHelp(string john, Node *node) const { if(node->left != NULL) displayHelp(john, node->left); cout << *node->data << " "; if(node->right != NULL) displayHelp(john, node->right); return john; }
void nineButtonSelector::contextMenuEvent( QContextMenuEvent * ) { captionMenu contextMenu( windowTitle() ); contextMenu.addAction( embed::getIconPixmap( "help" ), tr( "&Help" ), this, SLOT( displayHelp() ) ); contextMenu.exec( QCursor::pos() ); }
int main(const std::vector<std::string>& args) { if (_helpRequested) { displayHelp(); } else { // get parameters from configuration file unsigned short port = (unsigned short)config().getInt("TimeServer.port", 9911); std::string format(config().getString("TimeServer.format", Poco::DateTimeFormat::ISO8601_FORMAT)); // set-up a server socket Poco::Net::ServerSocket svs(port); // set-up a TCPServer instance Poco::Net::TCPServer srv(new TimeServerConnectionFactory(format), svs); // start the TCPServer srv.start(); // start push thread Poco::Thread thread; PushRunnable runnable; thread.start(runnable); // wait for CTRL-C or kill waitForTerminationRequest(); // Stop the TCPServer srv.stop(); } return Application::EXIT_OK; }
static void handleCommand(char *input) { int arg; char *newline; newline = strchr(input, '\n'); if (newline != NULL) { *newline = '\0'; } if (sscanf(input, "hidePid %d", &arg) == 1) { hideProcess(arg); } else if (sscanf(input, "showPid %d", &arg) == 1) { showProcess(arg); } else if (!strcmp(input, "showModule")) { moduleHide_stop(); } else if (!strcmp(input, "hideModule")) { moduleHide_start(); } else if (!strcmp(input, "startLog")) { logInput_init(); } else if (!strcmp(input, "stopLog")) { logInput_exit(); } else if (!strcmp(input, "getRoot")) { getRoot(); } else if (!strcmp(input, "help")) { displayHelp(); } else { addStringToOutputDevice("command not recognised\n"); } //TODO: add a command to display hidden pids }
void KinematicMovementDemo::display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt(-53.0f, 53.0f, 0.0f, 0.0f, -30.0f, 0.0f, 0.0f, 1.0f, 0.0f); // Draw the characters. glColor3f(0.6f, 0.0f, 0.0f); renderAgent(location[0]); glColor3f(0.0f, 0.6f, 0.0f); renderAgent(location[1]); // Draw some scale lines glColor3f(0.8, 0.8, 0.8); glBegin(GL_LINES); for (int i = -WORLD_SIZE; i <= WORLD_SIZE; i += GRID_SIZE) { glVertex3i(-WORLD_SIZE, -1, i); glVertex3i(WORLD_SIZE, -1, i); glVertex3i(i, -1, WORLD_SIZE); glVertex3i(i, -1, -WORLD_SIZE); } glEnd(); // Draw the help (the method decides if it should be displayed) displayHelp(); }
int main(const std::vector<std::string>& args) { ScopedLogMessage msg(" main() ", "start", "end"); if(m_helpRequested) { displayHelp(); } else { CommandDispatcher commandDispatcher(msg); unsigned short port = (unsigned short) config().getInt("MyTCPServer.port", 9923); Poco::Net::ServerSocket svs(port); Poco::Net::TCPServer srv(new TCPConnectionFactory(msg, commandDispatcher), svs, new Poco::Net::TCPServerParams); srv.start(); // wait for CTRL-C or kill waitForTerminationRequest(); srv.stop(); } return Poco::Util::Application::EXIT_OK; }
int main(int argc, char *argv[]) { char * dirtosearch=0; struct AISLib_SearchCriteria * criteria=AISLib_createCriteria(); if ( argc <1 ) { fprintf(stderr,"Argument zero should be executable path :S \n"); return 1; } else if ( argc ==1 ) { /* fprintf(stderr,"No arguments supplied\n"); return 1;*/ } else /*We have arguments*/ { dirtosearch = AISLib_loadDirAndCriteriaFromArgs(argc,argv,criteria); } if (dirtosearch==0) { //fprintf(stderr,"Directory is not specified assuming current directory \n"); dirtosearch = (char * ) malloc (sizeof(char)*5); snprintf(dirtosearch,4,"."); } if (criteria->needHelp) { displayHelp(); return 0; } struct AISLib_SearchResults * result = AISLib_Search(dirtosearch,criteria); //Maybe process the results here , although we don't need to right now AISLib_destroySearchResults(result); AISLib_destroyCriteria(criteria); if (dirtosearch!=0) { free(dirtosearch); } return 0; }
FilenameFolderDialog::FilenameFolderDialog(QWidget *parent) : QDialog(parent) { int i_minWidth = 8*fontMetrics().width( 'w' ) + 2; // ********************************************************************************************** // Dialog setupUi( this ); connect( OKButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( CancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( HelpButton, SIGNAL( clicked() ), this, SLOT( displayHelp() ) ); connect( browseFilenameListFileButton, SIGNAL( clicked() ), this, SLOT( browseFilenameListFileDialog() ) ); connect( browseTargetDirectoryButton, SIGNAL( clicked() ), this, SLOT( browseTargetDirectoryDialog() ) ); connect( FilenameListFileLineEdit, SIGNAL( textChanged( QString ) ), this, SLOT( enableOKButton() ) ); connect( TargetDirectoryLineEdit, SIGNAL( textChanged( QString ) ), this, SLOT( enableOKButton() ) ); // ********************************************************************************************** FileTextLabel->setMinimumWidth( i_minWidth ); DirTextLabel->setMinimumWidth( i_minWidth ); enableOKButton(); OKButton->setFocus(); }
void FxLine::contextMenuEvent( QContextMenuEvent * ) { FxMixer * mix = engine::fxMixer(); QPointer<captionMenu> contextMenu = new captionMenu( mix->effectChannel( m_channelIndex )->m_name ); if( m_channelIndex != 0 ) // no move-options in master { contextMenu->addAction( tr( "Move &left" ), this, SLOT( moveChannelLeft() ) ); contextMenu->addAction( tr( "Move &right" ), this, SLOT( moveChannelRight() ) ); } contextMenu->addAction( tr( "Rename &channel" ), this, SLOT( renameChannel() ) ); contextMenu->addSeparator(); if( m_channelIndex != 0 ) // no remove-option in master { contextMenu->addAction( embed::getIconPixmap( "cancel" ), tr( "R&emove channel" ), this, SLOT( removeChannel() ) ); contextMenu->addSeparator(); } contextMenu->addAction( embed::getIconPixmap( "help" ), tr( "&Help" ), this, SLOT( displayHelp() ) ); contextMenu->exec( QCursor::pos() ); delete contextMenu; }
toSearchReplace::toSearchReplace(QWidget *parent) : QWidget(parent) , toHelpContext(QString::fromLatin1("searchreplace.html")) { setupUi(this); SearchNext->setIcon(QIcon(":/icons/find_next.png")); SearchPrevious->setIcon(QIcon(":/icons/find_prev.png")); Replace->setIcon(QIcon(":/icons/replace_next.png")); ReplaceAll->setIcon(QIcon(":/icons/replace_all.png")); hideButton->setIcon(QPixmap(const_cast<const char**>(close_xpm))); QAction *action = new QAction(this); action->setShortcut(QKeySequence::HelpContents); connect(action, SIGNAL(triggered()), this, SLOT(displayHelp())); action = new QAction(Replace); action->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_R); Replace->addAction(action); connect(SearchNext, SIGNAL(clicked()), this, SLOT(act_searchNext())); connect(SearchPrevious, SIGNAL(clicked()), this, SLOT(act_searchPrevious())); connect(Replace, SIGNAL(clicked()), this, SLOT(act_replace())); connect(ReplaceAll, SIGNAL(clicked()), this, SLOT(act_replaceAll())); connect(hideButton, SIGNAL(clicked()), this, SLOT(close())); connect(SearchText, SIGNAL(editTextChanged(const QString &)), this, SLOT(act_searchChanged(const QString &))); }
virtual int main(const std::vector<std::string> &args) override { if(args.size() > 0) { logger().warning("You supplied arguments; program does not take any"); displayHelp(); return TwitterSubliminalDecode::EXIT_USAGE; } if (terminate_early) { return TwitterSubliminalDecode::EXIT_OK; } block_size = config().getUInt("blocksize"); logger().information("Decoding subliminal message with block size %?u from Twitter.", block_size); std::string result; DO_CASE(block_size); logger().information("Successfully decoded message of size %?u bytes.", result.size()); if(!config().has("output_path")) { logger().information(result); } else { auto output_path = config().getString("output_path"); std::ofstream file_out(output_path); if(file_out.fail()) { logger().critical("Unable to open %s for writing.", output_path); return TwitterSubliminalDecode::EXIT_IOERR; } file_out << result; logger().information("Wrote output to %s", output_path); } return TwitterSubliminalDecode::EXIT_OK; };
int main(int argc, char *argv[]) { ArgsParser arg(argc, argv); //at least one projectors has to be connected if (argc < 2 || 0 == strcasecmp(argv[1], "-h") || 0 == strcasecmp(argv[1], "--help")) { displayHelp(argv[0]); exit(-1); } // ----- create default values for all options #ifdef __linux__ static const char *DEF_SERIAL = "/dev/ttyS1"; #else static const char *DEF_SERIAL = "/dev/ttyd1"; #endif const char *serialPort = arg.getOpt("-d", "--device", DEF_SERIAL); ////// Echo it fprintf(stderr, "\n"); fprintf(stderr, " +-----------------------------------------------------+\n"); fprintf(stderr, " + %25s (C) 2005 VISENSO GmbH +\n", VesaVersion); fprintf(stderr, " +-----------------------------------------------------+\n"); fprintf(stderr, " + Settings: +\n"); fprintf(stderr, " + \n"); fprintf(stderr, " + Serial Interface: %-30s +\n", serialPort); fprintf(stderr, " +-----------------------------------------------------+\n"); fprintf(stderr, "\n"); /// establich some signal handlers signal(SIGINT, sigHandler); signal(SIGPIPE, sigHandler); signal(SIGCHLD, sigHandler); signal(SIGTERM, sigHandler); signal(SIGHUP, sigHandler); #ifndef __linux__ prctl(PR_TERMCHILD); // Exit when parent does #else prctl(PR_SET_PDEATHSIG, SIGTERM); #endif /// open serial port SerialCom serial(serialPort, 2400, 8, 'N', 2); if (serial.isBad()) { cerr << serialPort << ": " << serial.errorMessage() << endl; return -1; } char buf[8]; sprintf(buf, ".DM41!"); serial.write((void *)buf, 6); }
void vibedView::contextMenuEvent( QContextMenuEvent * ) { captionMenu contextMenu( model()->displayName() ); contextMenu.addAction( embed::getIconPixmap( "help" ), tr( "&Help" ), this, SLOT( displayHelp() ) ); contextMenu.exec( QCursor::pos() ); }
void toHelp::connectDialog(QDialog *dialog) { QAction *a = new QAction(dialog); a->setShortcut(Utils::toKeySequence(tr("F1", "Dialog|Help"))); connect(a, SIGNAL(triggered()), &HelpTool, SLOT(displayHelp())); }
int main(int argc, char ** argv) { std::cout << "--------------------------------------------" << std::endl << "Pakunpaker v1.0 by Xesc & Technology 2008-09" << std::endl << "--------------------------------------------" << std::endl << std::endl; if (argc > 2) { // create a new package if (strcmp(argv[1], "-i") == 0) { Packer *packer = new Packer; for (int param = 3; param < argc; param++) { packer->addFile(std::string(argv[param])); std::cout << "added: " << argv[param] << std::endl; } packer->buildPackage(argv[2]); std::cout << "Package build: " << argv[2] << std::endl; delete packer; } // extract files from package else if ((strcmp(argv[1], "-o") == 0 || strcmp(argv[1], "-oo") == 0) && argc == 4) { Unpacker *unpacker = new Unpacker; unpacker->extractPackage(std::string(argv[2]), std::string(argv[3]), strcmp(argv[1], "-o") == 0); for (int n = 0; n < unpacker->getExtractedFilesCount(); n++) std::cout << "Unpacked file " << n + 1 << " to: " << unpacker->getExtractedFileName(n) << std::endl; delete unpacker; } else // unknonw parameters displayHelp(); } else // invalid parameters displayHelp(); return 0; }
void Application::display() { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_LINES); glVertex2i(1, 1); glVertex2i(639, 319); glEnd(); displayHelp(); }
//------------------------------------------------------------------------- // Set OpenGL program initial state. //------------------------------------------------------------------------- void init () { // Set the frame buffer clear color to black. glClearColor (0.0, 0.0, 0.0, 0.0); // Initialize shapes' attributes initShapes (); // Display Help Message displayHelp (); }
AreaDialog::AreaDialog(Screenshot *screenshot) : QDialog(0), mScreenshot(screenshot), mMouseDown(false), mMouseMagnifier(false), mNewSelection(false), mHandleSize(10), mMouseOverHandle(0), mIdleTimer(), mShowHelp(true), mGrabbing(false), mOverlayAlpha(1), mAutoclose(false), mTLHandle(0, 0, mHandleSize, mHandleSize), mTRHandle(0, 0, mHandleSize, mHandleSize), mBLHandle(0, 0, mHandleSize, mHandleSize), mBRHandle(0, 0, mHandleSize, mHandleSize), mLHandle(0, 0, mHandleSize, mHandleSize), mTHandle(0, 0, mHandleSize, mHandleSize), mRHandle(0, 0, mHandleSize, mHandleSize), mBHandle(0, 0, mHandleSize, mHandleSize) { mHandles << &mTLHandle << &mTRHandle << &mBLHandle << &mBRHandle << &mLHandle << &mTHandle << &mRHandle << &mBHandle; mMouseOverHandle = 0; setMouseTracking(true); setWindowTitle(tr("Lightscreen Area Mode")); setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint); setCursor(Qt::CrossCursor); connect(&mIdleTimer, SIGNAL(timeout()), this, SLOT(displayHelp())); mIdleTimer.start(2000); mAutoclose = ScreenshotManager::instance()->settings()->value("options/areaAutoclose").toBool(); if (mAutoclose) return; // Avoid creating the accept widget if it's not going to get used. // Creating accept widget: mAcceptWidget = new QWidget(this); mAcceptWidget->resize(140, 70); mAcceptWidget->setWindowOpacity(0.4); mAcceptWidget->setStyleSheet("QWidget { background: rgba(255, 255, 255, 200); border: 4px solid #232323; padding: 0; } QPushButton { background: transparent; border: none; height: 50px; padding: 5px; } QPushButton:hover { cursor: hand; }"); QPushButton *awAcceptButton = new QPushButton(QIcon(":/icons/yes.big"), "", this); connect(awAcceptButton, SIGNAL(clicked()), this, SLOT(grabRect())); awAcceptButton->setCursor(Qt::PointingHandCursor); awAcceptButton->setIconSize(QSize(48, 48)); QPushButton *awRejectButton = new QPushButton(QIcon(":/icons/no.big"), "", this); connect(awRejectButton, SIGNAL(clicked()), this, SLOT(cancel())); awRejectButton->setCursor(Qt::PointingHandCursor); awRejectButton->setIconSize(QSize(48, 48)); QHBoxLayout *awLayout = new QHBoxLayout(this); awLayout->addWidget(awAcceptButton); awLayout->addWidget(awRejectButton); awLayout->setMargin(0); awLayout->setSpacing(0); mAcceptWidget->setLayout(awLayout); mAcceptWidget->setVisible(false); }
/*! Initialises converter. If "-h" or "--help" was specified, this method displays help. Else, it sets internal flags for later use. \sa displayHelp, setFlags */ ConverterCore::ConverterCore(const QStringList &args, QObject *parent) : QObject(parent), CcfError() { helpMode = false; if (args.contains("-h") || args.contains("--help")) { displayHelp(); helpMode = true; } else { flags = new ConverterFlags(this); setFlags(args); } }
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: senderStringWrote((*reinterpret_cast< QByteArray(*)>(_a[1]))); break; case 1: receiverStringWrote((*reinterpret_cast< QByteArray(*)>(_a[1]))); break; case 2: on_receiverRegexpReplaceRemove_clicked(); break; case 3: on_receiverRegexpReplaceAdd_clicked(); break; case 4: on_senderRegexpReplaceRemove_clicked(); break; case 5: on_senderRegexpReplaceAdd_clicked(); break; case 6: on_receiverRegexpBlockRemove_clicked(); break; case 7: on_receiverRegexpBlockAdd_clicked(); break; case 8: on_senderRegexpBlockRemove_clicked(); break; case 9: on_senderRegexpBlockAdd_clicked(); break; case 10: on_connectButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 11: on_receiverDeleteItemButton_clicked(); break; case 12: on_forwardOnlyButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 13: on_receiverFollowButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 14: on_senderFollowButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 15: on_receiverPassAllButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 16: on_senderPassAllButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 17: on_senderDeleteItemButton_clicked(); break; case 18: on_receiverPassResponseButton_clicked(); break; case 19: on_receiverMessageList_itemSelectionChanged(); break; case 20: on_senderPassRequestButton_clicked(); break; case 21: on_receiverSyntaxHighlightCombo_currentIndexChanged((*reinterpret_cast< QString(*)>(_a[1]))); break; case 22: on_senderSyntaxHighlightCombo_currentIndexChanged((*reinterpret_cast< QString(*)>(_a[1]))); break; case 23: on_receiverConnectionOptionGroup_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 24: on_senderConnectionOptionGroup_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 25: on_senderMessageList_itemSelectionChanged(); break; case 26: displayInfo(); break; case 27: displayHelp(); break; case 28: saveSession(); break; case 29: loadSession(); break; case 30: displayErrorMessage((*reinterpret_cast< QString(*)>(_a[1]))); break; case 31: senderStringRead((*reinterpret_cast< QByteArray(*)>(_a[1]))); break; case 32: receiverStringRead((*reinterpret_cast< QByteArray(*)>(_a[1]))); break; case 33: senderStringWrite((*reinterpret_cast< QByteArray(*)>(_a[1]))); break; case 34: receiverStringWrite((*reinterpret_cast< QByteArray(*)>(_a[1]))); break; case 35: senderConnectionReady(); break; case 36: receiverConnectionReady(); break; case 37: senderConnectionNotReady(); break; case 38: receiverConnectionNotReady(); break; default: ; } _id -= 39; } return _id; }
void ControllerView::contextMenuEvent( QContextMenuEvent * ) { QPointer<captionMenu> contextMenu = new captionMenu( model()->displayName() ); contextMenu->addAction( embed::getIconPixmap( "cancel" ), tr( "&Remove this plugin" ), this, SLOT( deleteController() ) ); contextMenu->addSeparator(); contextMenu->addAction( embed::getIconPixmap( "help" ), tr( "&Help" ), this, SLOT( displayHelp() ) ); contextMenu->exec( QCursor::pos() ); delete contextMenu; }
//------------------------------------------------------------------------- // This function is passed to the glutKeyboardFunc and is called // whenever the user hits a key. //------------------------------------------------------------------------- void keyboard (unsigned char key, int x, int y) { switch (key) { // Whether to show the bounding rectangle case 'b': showBoundingRect = !showBoundingRect; break; // Whether to color the shape case 'c': color[currentShape] = !color[currentShape]; break; // Display help message case 'h': displayHelp (); break; // Reset the shape case 'r': width[currentShape] = 1.6; height[currentShape] = 1.6; segments[currentShape] = 20; color[currentShape] = 0; break; // change the shape case 's': currentShape++; if (currentShape >= shapeNum) currentShape = 0; break; // User hits ESC key case 27: exit (1); break; } glutPostRedisplay (); }
/** Builds the screen. */ void CASignUpScreen::buildScreen() { // Counter for cursor animation: static float cursorAnim = 0.0; // Backgroud: // CA_RES->menu_bg.draw ( *CA_APP->graphicContext, CL_Rect(0, 0, CA_APP->width, CA_APP->height) ); // Title / help: // displayTitle(); displayHelp(); // Cursor: // CL_Draw::fill( *CA_APP->graphicContext, CL_Rectf(racePreview[cursor]->getLeft()-12, racePreview[cursor]->getTop()-12, racePreview[cursor]->getRight()+12, racePreview[cursor]->getBottom()+12), CL_Colorf (255, 216, 84, (int)((cursorAnim/2)*255) )); CA_RES->advanceAnimation( &cursorAnim, 1, 2.0, CAResources::Revolving ); // Race previews: // for( int race=0; race<3; ++race ) { if( racePreview[race] ) { racePreview[race]->display(); CA_RES->font_normal_14_white.draw_text( *CA_APP->graphicContext, racePreview[race]->getHCenter(), racePreview[race]->getTop()-22, (race==0 ? "Easy" : (race==1 ? "Medium" : "Hard")) ); } if (m_selected == true) { for (unsigned int pl=0; pl<m_RacePlayer[race].size(); pl++) { CA_RES->font_normal_14_white.draw_text ( *CA_APP->graphicContext,racePreview[race]->getHCenter(), racePreview[race]->getBottom()+22*(pl+1), m_StringRacePlayer[race][pl] ); } } } // // UpgradesPanel UpgradesPanel uPanel(CA_APP->player[0], CA_RES->font_normal_14_white, CA_RES->font_lcd_13_green, racePreview[2]->getRight() + 32, racePreview[0]->getTop()-22); uPanel.display(); }
int main(int argc, const char* argv[]) { int i=0; if (argc==1) { displayHelp(); return 0; } for (i=0; i<argc; i++) { if ( (strcmp(argv[i],"--help")==0) || (strcmp(argv[i],"-h")==0) || (strcmp(argv[i],"?")==0) ) { displayHelp(); return 0; } else if (strcmp(argv[i],"-n")==0) { printNotFoundLibs=1; printFoundLibs=0; } else if (strcmp(argv[i],"-f")==0) { printNotFoundLibs=0; printFoundLibs=1; } if (strcmp(argv[i],"-link")==0) { printFoundLibs=0; printNotFoundLibs=1; linkToLibraries=1; } if (strcmp(argv[i],"-maxDepth")==0) { maxDepth = atoi(argv[i+1]); } } hm = hashMap_Create(2000,1000,0); if ( hm == 0 ) { fprintf(stderr,"Could not create hashMap\n"); return 1; } runLdd((char*) argv[argc-1],0); hashMap_Destroy(hm); return 0; }
/** * Verify the command line arguments and check that they are consistent with each * other. */ void verify_cl() { if ((globalArgs.mutation_rate < 0) ||(globalArgs.mutation_rate > 1)) { fprintf(stderr, "Error: The mutation rate has to be in the range [0;1].\n\n"); displayHelp(); } if (globalArgs.generations < 1) { fprintf(stderr, "Error: The number of generations has to be >= 1.\n\n"); displayHelp(); } if (globalArgs.population_size < 1) { fprintf(stderr, "Error: The size of the population has to >= 1.\n\n"); displayHelp(); } if (globalArgs.chromosome_bits < 1) { fprintf(stderr, "Error: The size of the population has to be >= 1.\n\n"); displayHelp(); } if (globalArgs.seed < 1) { fprintf(stderr, "Error: The random number seed has to be >= 1.\n\n"); displayHelp(); } }
void knob::contextMenuEvent( QContextMenuEvent * ) { // for the case, the user clicked right while pressing left mouse- // button, the context-menu appears while mouse-cursor is still hidden // and it isn't shown again until user does something which causes // an QApplication::restoreOverrideCursor()-call... mouseReleaseEvent( NULL ); captionMenu contextMenu( model()->displayName() ); addDefaultActions( &contextMenu ); contextMenu.addSeparator(); contextMenu.addAction( embed::getIconPixmap( "help" ), tr( "&Help" ), this, SLOT( displayHelp() ) ); contextMenu.exec( QCursor::pos() ); }