void PanelKMenu::slotLock() { QCString appname( "kdesktop" ); if ( kicker_screen_number ) appname.sprintf("kdesktop-screen-%d", kicker_screen_number); kapp->dcopClient()->send(appname, "KScreensaverIface", "lock()", ""); }
void PanelKMenu::slotRunCommand() { QByteArray data; QCString appname( "kdesktop" ); if ( kicker_screen_number ) appname.sprintf("kdesktop-screen-%d", kicker_screen_number); kapp->updateRemoteUserTimestamp( appname ); kapp->dcopClient()->send( appname, "KDesktopIface", "popupExecuteCommand()", data ); }
void LogChannelSyslog::init() { AutoWString appname( m_identity ); m_sysdata = (void*) OpenEventLogW( NULL, appname.w_str() ); if ( m_sysdata == 0 ) { throw new IoError( ErrorParam( FALCON_LOGGING_ERROR_OPEN, __LINE__ ) .origin( e_orig_runtime ) .sysError( GetLastError() ) ); } }
//------------------------------------- // helper methods //------------------------------------- static void ExpandVariables(wxString &content, const NewWxProjectInfo &info) { content.Replace(wxT("$(ProjectName)"), info.GetName()); wxString projname = info.GetName(); projname.MakeLower(); wxString appfilename = projname + wxT("_app"); wxString framefilename = projname + wxT("_frame"); content.Replace(wxT("$(MainFile)"), projname); content.Replace(wxT("$(AppFile)"), appfilename); content.Replace(wxT("$(MainFrameFile)"), framefilename); content.Replace(wxT("$(Unicode)"), info.GetFlags() & wxWidgetsUnicode ? wxT("yes") : wxT("no")); content.Replace(wxT("$(Static)"), info.GetFlags() & wxWidgetsStatic ? wxT("yes") : wxT("no")); content.Replace(wxT("$(Universal)"), info.GetFlags() & wxWidgetsUniversal ? wxT("yes") : wxT("no")); content.Replace(wxT("$(WinResFlag)"), info.GetFlags() & wxWidgetsWinRes ? wxT("yes") : wxT("no")); content.Replace(wxT("$(MWindowsFlag)"), info.GetFlags() & wxWidgetsSetMWindows ? wxT("-mwindows") : wxEmptyString); content.Replace(wxT("$(PCHFlag)"), info.GetFlags() & wxWidgetsPCH ? wxT("WX_PRECOMP") : wxEmptyString); content.Replace(wxT("$(PCHCmpOptions)"), info.GetFlags() & wxWidgetsPCH ? wxT("-Winvalid-pch;-include wx_pch.h") : wxEmptyString); content.Replace(wxT("$(PCHFileName)"), info.GetFlags() & wxWidgetsPCH ? wxT("wx_pch.h") : wxEmptyString); if( info.GetFlags() & wxWidgetsWinRes ) content.Replace(wxT("$(WinResFile)"), wxT("<File Name=\"resources.rc\" />") ); if( info.GetFlags() & wxWidgetsPCH )content.Replace(wxT("$(PCHFile)"), wxT("<File Name=\"wx_pch.h\" />") ); wxString othersettings; if( info.GetVersion() != wxT("Default") ) othersettings << wxT("--version=") << info.GetVersion(); if( !info.GetPrefix().IsEmpty() ) othersettings << wxT(" --prefix=") << info.GetPrefix(); content.Replace(wxT("$(Other)"), othersettings); //create the application class name wxString initial = appfilename.Mid(0, 1); initial.MakeUpper(); appfilename.SetChar(0, initial.GetChar(0)); //create the main frame class name wxString framename(projname); wxString appname(projname); framename << wxT("Frame"); appname << wxT("App"); initial = framename.Mid(0, 1); initial.MakeUpper(); framename.SetChar(0, initial.GetChar(0)); initial = appname.Mid(0, 1); initial.MakeUpper(); appname.SetChar(0, initial.GetChar(0)); content.Replace(wxT("$(AppName)"), appname); content.Replace(wxT("$(MainFrameName)"), framename); }
void parseApp(const char *func, const char *var, SV *arg, Autoref<App> &res) { if ( sv_isobject(arg) && (SvTYPE(SvRV(arg)) == SVt_PVMG) ) { WrapApp *wa = (WrapApp *)SvIV((SV*)SvRV( arg )); if (wa == 0 || wa->badMagic()) { throw Exception::f("%s: %s has an incorrect magic for App", func, var); } res = wa->get(); } else if (SvPOK(arg)) { STRLEN len; char *s = SvPV(arg, len); string appname(s, len); res = App::find(appname); // will throw if can't find } else { throw Exception::f("%s: %s is not an App reference nor a string", func, var); } }
void KRootPixmap::enableExports() { #ifdef Q_WS_X11 kdDebug(270) << k_lineinfo << "activating background exports.\n"; DCOPClient *client = kapp->dcopClient(); if(!client->isAttached()) client->attach(); QByteArray data; QDataStream args(data, IO_WriteOnly); args << 1; QCString appname("kdesktop"); int screen_number = DefaultScreen(qt_xdisplay()); if(screen_number) appname.sprintf("kdesktop-screen-%d", screen_number); client->send(appname, "KBackgroundIface", "setExport(int)", data); #endif }
/* Initialise a Preferences object from the given pspec. This might be an * SCPreferences AppID or it might be the path to a plist file. */ Preferences::Preferences(const char * pspec) : m_pspec(pspec), m_plist(NULL), m_scpref(NULL) { /* Try to load this as a plist file first. The SCPreferences API does a * bunch of work if it can't find the file, and we should avoid that unless * we have a good idea that it's necessary. */ this->m_plist = load_plist_from_path(this->m_pspec.c_str()); if (this->m_plist) { /* Loading a plist should always give you back a dictionary. */ ASSERT(CFDictionaryGetTypeID() == CFGetTypeID(this->m_plist)); VERBOSE("loaded plist %s\n", pspec); return; } cf_typeref<CFStringRef> appname(cfstring_wrap(getprogname())); cf_typeref<CFStringRef> appid(cfstring_wrap(this->m_pspec.c_str())); this->m_scpref = SCPreferencesCreate(kCFAllocatorDefault, appname, appid); if (this->m_scpref == NULL) { return; } /* If there was no existing preferences file, SCError() should return * kSCStatusNoConfigFile. We are only interested in reading preferences, so * we want to fail if there's no existing config. */ if (SCError() != kSCStatusOK) { safe_release(this->m_scpref); } if (this->m_scpref) { VERBOSE("loaded SC preferences %s\n", pspec); } }
int main(int argc, char *argv[]) { try { if (argc <= 1) { const std::string path(argv[0]); std::cout << "usage: " << path.substr(path.find_last_of("/\\") + 1) << R"_help_( <parameters> input_dir <parameters> include: --device=<name> name of dynamic library (without suffix) with computational device to be used for demo --batch=<value> size of group of images that are classified together; large batch sizes have better performance --model=<name> name of network model that is used for classification can be caffenet_float or caffenet_int16 --input=<directory> path to directory that contains images to be classified --config=<name> file name of config file containing additional parameters command line parameters take priority over config ones If last parameters do not fit --key=value format it is assumed to be a --input. Instead of "--" "-" or "/" can be used. )_help_"; return 0; } // convert argc/argv to vector of arguments std::vector<std::string> arg; for(int n=1; n<argc; ++n) arg.push_back(argv[n]); // parse configuration (command line and from file) using config_t = std::map<std::string, std::string>; config_t config; parse_parameters(config, arg); { // find if config file name was given from command line config_t::iterator it; if((it = config.find("config"))!=std::end(config)){ std::ifstream config_file(it->second); std::vector<std::string> config_lines; using istream_it = std::istream_iterator<std::string>; std::copy(istream_it(config_file), istream_it(), std::back_inserter(config_lines)); parse_parameters(config, config_lines); } } { // validate & add default value for missing arguments auto not_found = std::end(config); if(config.find("device")==not_found) config["device"]="device_cpu"; if(config.find("batch") ==not_found) config["batch"]="48"; if(config.find("model") ==not_found) config["model"]="caffenet_float"; if(config.find("input") ==not_found) throw std::runtime_error("missing input directory; run without arguments to get help"); if(config.find("loops") ==not_found) config["loops"]="1"; } // load images from input directory auto images_list = get_directory_contents(config["input"]); if(images_list.empty()) throw std::runtime_error(std::string("directory ")+config["input"]+" does not contain any images that can be processed"); // RAII for loading library and device initialization scoped_library library(config["device"]+dynamic_library_extension); scoped_device_0 device(library); auto workload = primitives_workload::instance().get(config["model"]); const int config_batch = std::stoi(config["batch"]); if(config_batch<=0) throw std::runtime_error("batch_size is 0 or negative"); workload->init(device.primitives, device.device, config_batch); C_time_control timer; timer.tock(); std::cout << "Workload initialized at " << timer.time_diff_string() <<" [" <<timer.clocks_diff_string() <<"]" << std::endl << "--------------------------------------------------------" << std::endl; auto absolute_output_cmpl = new nn::data<float, 2>(1000, config_batch); std::vector<std::string> batch_images; uint16_t image_counter = 0; //numbering images within single batch bool start_batch = false; const std::string path(argv[0]); std::string appname(path.substr(path.find_last_of("/\\") + 1)); C_report_maker report(appname,library.name, config["model"], config_batch); std::cout << "Now, please wait. I try to recognize " << images_list.size() << " images" << std::endl; auto images_list_iterator = images_list.begin(); auto images_list_end = images_list.end(); while(images_list_iterator!=images_list_end) { auto diff_itr = images_list_end - images_list_iterator < config_batch ? images_list_end - images_list_iterator : config_batch; std::vector<std::string> batch_images(images_list_iterator,images_list_iterator+diff_itr); images_list_iterator+=diff_itr; nn::data<float,4> *images = nullptr; images = nn_data_load_from_image_list(&batch_images, workload->get_img_size(), workload->image_process, config_batch, workload->RGB_order); if(images) { images_recognition_batch_t temp_report_recognition_batch; { NN_API_STATUS status; C_time_control timer; auto loops = std::stoi(config["loops"]); for(size_t i=0; i <loops; ++i) { workload->execute(*images,*absolute_output_cmpl); } timer.tock(); temp_report_recognition_batch.time_of_recognizing = timer.get_time_diff()/loops; temp_report_recognition_batch.clocks_of_recognizing = timer.get_clocks_diff()/loops; } delete images; float* value_cmpl = reinterpret_cast<float*>(absolute_output_cmpl->buffer); auto batch_images_iterator = batch_images.begin(); for(auto b = 0u; (b < config_batch) && (b < batch_images.size()); ++b) { image_recognition_item_t temp_report_recognition_item; recognition_state_t temp_recognition_state; std::map <float,int> output_values; temp_report_recognition_item.recognitions.clear(); temp_report_recognition_item.recognized_image = *batch_images_iterator++; for(int index = 0; index < 1000; ++index) { output_values.insert(std::make_pair(value_cmpl[index],index)); temp_report_recognition_item.nnet_output.push_back(value_cmpl[index]); } temp_report_recognition_item.wwid = temp_report_recognition_item.recognized_image.find('[') != std::string::npos ? temp_report_recognition_item.recognized_image.substr(temp_report_recognition_item.recognized_image.find('[') + 1,9) : "n000000000"; auto iterator = --output_values.end(); for(int i = 1; i < 6 && iterator != output_values.end(); i++) { temp_recognition_state.label = workload->labels[iterator->second]; temp_recognition_state.wwid = workload->wwids[iterator->second]; temp_recognition_state.accuracy = iterator->first; temp_report_recognition_item.recognitions.push_back(temp_recognition_state); --iterator; } temp_report_recognition_batch.recognized_images.push_back(temp_report_recognition_item); output_values.clear(); value_cmpl += 1000; } batch_images.clear(); report.recognized_batches.push_back(temp_report_recognition_batch); temp_report_recognition_batch.recognized_images.clear(); } } std::string html_filename="result_"+get_timestamp()+".html"; report.print_to_html_file(html_filename, "Results of recognition"); system((show_HTML_command+html_filename).c_str()); return 0; }
void MenuActions::slotLock() { QCString appname("kdesktop"); kapp->dcopClient()->send(appname, "KScreensaverIface", "lock()", ""); }
int main( int argc, char **argv ) { QApplication::setColorSpec( QApplication::CustomColor ); QApplication * a = new QApplication( argc, argv ); QString appname( "xpracman" ); QString applabel( "XpracMan" ); ::XpracManDir = getenv("PRAC_DIR"); if ( !XpracManDir.length() ) XpracManDir = QMVAPPLICATIONDIR; QString dbname = getenv( "PGDATABASE" ); QString dbaccessname = getenv( "MARVINACCESS" ); QString dbhost = getenv( "PGHOST" ); QString dbport = getenv( "PGPORT" ); int debug = 0; int wapp = 800; int happ = 600; bool maximize = false; for ( int i = 1; i < a->argc(); i++ ) { if ( QString( a->argv()[i] ) == "--debug" ) { debug = 1; continue; } if ( QString( a->argv()[i] ) == "--maximize" ) { maximize = true; continue; } qDebug( "main: argument # %d <%s>", i, a->argv()[i] ); if ( QString( a->argv()[i] ) == "--pracdir" ) { ++i; XpracManDir = QString( a->argv()[i] ); continue; } if ( QString( a->argv()[i] ) == "--database" ) { ++i; dbname = QString( a->argv()[i] ); continue; } if ( QString( a->argv()[i] ) == "--database-host" ) { ++i; dbhost = QString( a->argv()[i] ); continue; } if ( QString( a->argv()[i] ) == "--database-port" ) { ++i; dbport = QString( a->argv()[i] ); continue; } if ( QString( a->argv()[i] ) == "--accessdb" ) { ++i; dbaccessname = QString( a->argv()[i] ); continue; } if ( QString( a->argv()[i] ) == "--applabel" ) { ++i; applabel = QString( a->argv()[i] ); continue; } QMessageBox::critical( 0, QString( "%1: Illegal argument:fatal" ).arg( appname ), QString( "An unknown argument was detected.\n\n %1\n\n" "This application will now exit." ) .arg( QString( a->argv()[i] ) ) ); exit(1); } // Start a splash screen asap QProgressDialog splash( QString("Starting %1...").arg(applabel), "Abort", 100, 0, "progress", TRUE ); splash.setProgress( 10 ); qApp->processEvents(); if ( splash.wasCancelled() ) exit(1); if ( !debug ) qInstallMsgHandler( messageHandler ); // ------------------------------------------------------------ // Settle on an access database name // ------------------------------------------------------------ if ( dbaccessname.isNull() || dbaccessname.length() < 1 ) if ( dbname.isNull() || dbname.length() < 1 ) dbaccessname = QString("marvin_access"); else dbaccessname = dbname; // ------------------------------------------------------------ // Create a QmvAccess object // ------------------------------------------------------------ splash.setProgress( 20 ); splash.setLabelText("Checking access rights..."); qApp->processEvents(); if ( splash.wasCancelled() ) exit(1); QmvAccess * dbaccess; try { dbaccess = new QmvAccess( QString("%1:%2:%3").arg(dbaccessname).arg(dbhost).arg(dbport), 0, "db-access" ); } catch ( QmvException * exception ) { splash.cancel(); QMessageBox::Icon icon; switch ( exception->eStatus() ) { case QmvException::Critical: icon = QMessageBox::Critical; break; case QmvException::Warning: icon = QMessageBox::Warning; break; case QmvException::Information: default: icon = QMessageBox::Information; break; } QMessageBox mbox( QString( "%1: Fatal Error - No Access Service available" ).arg( appname ), exception->eMessage(), icon, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); mbox.exec(); delete exception; exit(1); } // ------------------------------------------------------------ // Create a QmvApplication object // ------------------------------------------------------------ splash.setProgress( 40 ); splash.setLabelText("Connecting to database..."); qApp->processEvents(); if ( splash.wasCancelled() ) exit(1); QString dbtitle; if ( dbname.isNull() || dbname.length() < 1 ) if ( dbaccess->dbTitleList().count() > 0 ) // take the first database in list dbtitle = *(dbaccess->dbTitleList().begin()); else { splash.cancel(); QMessageBox mbox( QString( "%1: Fatal Error - Database not found" ).arg( appname ), QString( "Unable to determine the name of the database.\n\n" " You need to either set PGDATABASE,\\" " or use the command-line argument < --database NAME >"), QMessageBox::Critical, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); mbox.exec(); exit(1); } else { dbtitle = dbaccess->dbTitleByName( dbname ); if ( dbtitle.isNull() || dbtitle.length() < 1 ) { splash.cancel(); QMessageBox mbox( QString( "%1: Fatal Error - Database not accessible (title)" ).arg( appname ), QString( "Unable to determine details of the database <b>\"%1\"</b>.<BR><BR>" " It may be that you do not have access to this database." " Check with your administrator.").arg( dbname), QMessageBox::Critical, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); mbox.exec(); exit(1); } } // ------------------------------------------------------------ // manage a pid file // ------------------------------------------------------------ QString homeappdir = QString( "%1/.%2" ).arg( getenv("HOME")).arg(appname); QDir dir_homeappdir( homeappdir ); if ( !dir_homeappdir.exists() ) { if ( !dir_homeappdir.mkdir( homeappdir ) ) { splash.cancel(); QMessageBox mbox( QString( "%1: Fatal Error - configuration" ).arg( appname ), QString( "Could not create the directory:<br>%1").arg(homeappdir), QMessageBox::Critical, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); mbox.exec(); exit(1); } } // look for existing pid file. QString pidfile = QString("%1/%2-%3.pid") .arg(homeappdir).arg(dbname).arg( getenv("DISPLAY")); QFile f_pidfile( pidfile); if ( f_pidfile.open(IO_ReadOnly) ) { QTextStream t_pidfile( &f_pidfile); int pid = -1; t_pidfile >> pid; int k = kill(pid, 0); qDebug("pid=%d, kill=%d, errno = %d", pid, k, errno); if ( pid > 0 && !(kill(pid, 0) == -1 && errno == ESRCH) ) { splash.cancel(); QMessageBox mbox( QString( "%1: Fatal Error - startup" ).arg( appname ), QString( "%1 is already running(pid=%2).").arg( appname ).arg(pid), QMessageBox::Critical, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); mbox.exec(); exit(1); } f_pidfile.close(); }
bool InitCREngine( const char * exename, lString16Collection & fontDirs ) { CRLog::trace("InitCREngine(%s)", exename); #ifdef _WIN32 lString16 appname( exename ); int lastSlash=-1; lChar16 slashChar = '/'; for ( int p=0; p<(int)appname.length(); p++ ) { if ( appname[p]=='\\' ) { slashChar = '\\'; lastSlash = p; } else if ( appname[p]=='/' ) { slashChar = '/'; lastSlash=p; } } lString16 appPath; if ( lastSlash>=0 ) appPath = appname.substr( 0, lastSlash+1 ); InitCREngineLog(UnicodeToUtf8(appPath).c_str()); lString16 datadir = appPath; #else lString16 datadir = lString16(CR3_DATA_DIR); #endif lString16 fontDir = datadir + L"fonts"; lString8 fontDir8_ = UnicodeToUtf8(fontDir); fontDirs.add( fontDir ); LVAppendPathDelimiter( fontDir ); lString8 fontDir8 = UnicodeToLocal(fontDir); //const char * fontDir8s = fontDir8.c_str(); //InitFontManager( fontDir8 ); InitFontManager( lString8() ); #ifdef _WIN32 lChar16 sysdir[MAX_PATH+1]; GetWindowsDirectoryW(sysdir, MAX_PATH); lString16 fontdir( sysdir ); fontdir << L"\\Fonts\\"; lString8 fontdir8( UnicodeToUtf8(fontdir) ); const char * fontnames[] = { "arial.ttf", "ariali.ttf", "arialb.ttf", "arialbi.ttf", "arialn.ttf", "arialni.ttf", "arialnb.ttf", "arialnbi.ttf", "cour.ttf", "couri.ttf", "courbd.ttf", "courbi.ttf", "times.ttf", "timesi.ttf", "timesb.ttf", "timesbi.ttf", "comic.ttf", "comicbd.ttf", "verdana.ttf", "verdanai.ttf", "verdanab.ttf", "verdanaz.ttf", "bookos.ttf", "bookosi.ttf", "bookosb.ttf", "bookosbi.ttf", "calibri.ttf", "calibrii.ttf", "calibrib.ttf", "calibriz.ttf", "cambria.ttf", "cambriai.ttf", "cambriab.ttf", "cambriaz.ttf", "georgia.ttf", "georgiai.ttf", "georgiab.ttf", "georgiaz.ttf", NULL }; for ( int fi = 0; fontnames[fi]; fi++ ) { fontMan->RegisterFont( fontdir8 + fontnames[fi] ); } #endif // Load font definitions into font manager // fonts are in files font1.lbf, font2.lbf, ... font32.lbf // use fontconfig lString16Collection fontExt; fontExt.add(lString16(L".ttf")); fontExt.add(lString16(L".otf")); fontExt.add(lString16(L".pfa")); fontExt.add(lString16(L".pfb")); lString16Collection fonts; getDirectoryFonts( fontDirs, fontExt, fonts, true ); // load fonts from file CRLog::debug("%d font files found", fonts.length()); //if (!fontMan->GetFontCount()) { for ( unsigned fi=0; fi<fonts.length(); fi++ ) { lString8 fn = UnicodeToLocal(fonts[fi]); CRLog::trace("loading font: %s", fn.c_str()); if ( !fontMan->RegisterFont(fn) ) { CRLog::trace(" failed\n"); } } //} // init hyphenation manager //char hyphfn[1024]; //sprintf(hyphfn, "Russian_EnUS_hyphen_(Alan).pdb" ); //if ( !initHyph( (UnicodeToLocal(appPath) + hyphfn).c_str() ) ) { #ifdef _LINUX // initHyph( "/usr/share/crengine/hyph/Russian_EnUS_hyphen_(Alan).pdb" ); #endif //} if (!fontMan->GetFontCount()) { //error #if (USE_FREETYPE==1) printf("Fatal Error: Cannot open font file(s) .ttf \nCannot work without font\n" ); #else printf("Fatal Error: Cannot open font file(s) font#.lbf \nCannot work without font\nUse FontConv utility to generate .lbf fonts from TTF\n" ); #endif return false; } printf("%d fonts loaded.\n", fontMan->GetFontCount()); return true; }
int main (int argc, char * argv []) { Gtk::Main kit(argc, argv); /* strip GTK+ parameters */ int c; g_rc_settings.set_defaults(); /* start out with normal values */ g_user_settings.set_defaults(); /* start out with normal values */ /* * Set up objects that are specific to the Gtk-2 GUI. Pass them to * the perform constructor. Create a font-render object. * * ISSUE: We really need to create the perform object after reading * the configuration, but we also need to fill it in from the * configuration, I believe. */ seq64::gui_assistant_gtk2 gui; /* GUI-specific objects */ seq64::perform p(gui); /* main performance object */ seq64::p_font_renderer = new seq64::font(); /* set the font renderer */ /* * Instead of the Seq24 names, use the new configuration file-names, * located in ~/.config/sequencer64. However, if they aren't found, * we no longer fall back to the legacy configuration file-names. If * the --legacy option is in force, use only the legacy configuration * file-name. The code also ensures the directory exists. CURRENTLY * LINUX-SPECIFIC. See the rc_settings class for how this works. */ std::string cfg_dir = g_rc_settings.home_config_directory(); if (cfg_dir.empty()) return EXIT_FAILURE; std::string rcname = g_rc_settings.user_filespec(); if (Glib::file_test(rcname, Glib::FILE_TEST_EXISTS)) { printf("[Reading user configuration %s]\n", rcname.c_str()); seq64::userfile user(rcname); if (user.parse(p)) { // Nothing to do, and no exit needed here if it fails } } rcname = g_rc_settings.config_filespec(); if (Glib::file_test(rcname, Glib::FILE_TEST_EXISTS)) { printf("[Reading rc configuration %s]\n", rcname.c_str()); seq64::optionsfile options(rcname); if (options.parse(p)) { /* * Not necessary, and it resets the last-used-directory * obtained from the "rc" configuration file. * * g_rc_settings.last_used_dir(cfg_dir); */ } else return EXIT_FAILURE; } for (;;) /* parse all command parameters */ { int option_index = 0; /* getopt_long index storage */ c = getopt_long ( argc, argv, "ChlLi:jJmM:pPsSU:Vx:", /* wrong: "C:hi:jJmM:pPsSU:Vx:" */ long_options, &option_index ); if (c == -1) /* detect the end of options */ break; switch (c) { case '?': case 'h': printf(g_help_1a); printf(g_help_1b); printf(g_help_2); return EXIT_SUCCESS; break; case 'l': g_rc_settings.legacy_format(true); printf("Setting legacy seq24 file format.\n"); break; case 'L': g_rc_settings.lash_support(true); printf("Activating LASH support.\n"); break; case 'S': g_rc_settings.stats(true); break; case 's': g_rc_settings.show_midi(true); break; case 'p': g_rc_settings.priority(true); break; case 'P': g_rc_settings.pass_sysex(true); break; case 'k': g_rc_settings.print_keys(true); break; case 'j': g_rc_settings.with_jack_transport(true); break; case 'J': g_rc_settings.with_jack_master(true); break; case 'C': g_rc_settings.with_jack_master_cond(true); break; case 'M': if (atoi(optarg) > 0) { g_rc_settings.jack_start_mode(true); } else { g_rc_settings.jack_start_mode(false); } break; case 'm': g_rc_settings.manual_alsa_ports(true); break; case 'i': /* ignore ALSA device */ g_rc_settings.device_ignore(true); g_rc_settings.device_ignore_num(atoi(optarg)); break; case 'V': printf("%s", versiontext.c_str()); return EXIT_SUCCESS; break; case 'U': g_rc_settings.jack_session_uuid(std::string(optarg)); break; case 'x': g_rc_settings.interaction_method ( interaction_method_t(atoi(optarg)) ); break; default: break; } } std::size_t applen = strlen("seq24"); std::string appname(argv[0]); /* "seq24", "./seq24", etc. */ appname = appname.substr(appname.size()-applen, applen); if (appname == "seq24") { g_rc_settings.legacy_format(true); printf("Setting legacy seq24 file format.\n"); } g_rc_settings.set_globals(); /* copy to legacy globals */ g_user_settings.set_globals(); /* copy to legacy globals */ #ifdef USE_THIS_INSTANCE_OF_CODE /* * Set up objects that are specific to the Gtk-2 GUI. Pass them to * the perform constructor. Create a font-render object. */ seq64::gui_assistant_gtk2 gui; /* GUI-specific objects */ seq64::perform p(gui); /* main performance object */ seq64::p_font_renderer = new seq64::font(); /* set the font renderer */ #endif // USE_THIS_INSTANCE_OF_CODE p.init(); p.launch_input_thread(); p.launch_output_thread(); p.init_jack(); seq64::mainwnd seq24_window(p); /* push mainwnd onto stack */ if (optind < argc) { if (Glib::file_test(argv[optind], Glib::FILE_TEST_EXISTS)) seq24_window.open_file(argv[optind]); else printf("? file not found: %s\n", argv[optind]); } #ifdef SEQ64_LASH_SUPPORT if (global_lash_support) { /* * Initialize the lash driver (strips lash-specific command line * arguments), then connect to LASH daemon and poll events. */ seq64::global_lash_driver = new seq64::lash(p, argc, argv); // seq64::global_lash_driver->init(); seq64::global_lash_driver->start(); } else seq64::global_lash_driver = nullptr; #endif kit.run(seq24_window); p.deinit_jack(); /* * Write the configuration file to the new name, unless the * --legacy option is in force. */ g_rc_settings.get_globals(); /* copy from legacy globals */ rcname = g_rc_settings.config_filespec(); printf("[Writing rc configuration %s]\n", rcname.c_str()); seq64::optionsfile options(rcname); if (options.write(p)) { // Anything to do? } g_user_settings.dump_summary(); g_user_settings.get_globals(); /* copy from legacy globals */ g_user_settings.dump_summary(); rcname = g_rc_settings.user_filespec(); printf("[Writing user configuration %s]\n", rcname.c_str()); seq64::userfile userstuff(rcname); if (userstuff.write(p)) { // Anything to do? } #ifdef SEQ64_LASH_SUPPORT if (not_nullptr(seq64::global_lash_driver)) delete seq64::global_lash_driver; #endif return EXIT_SUCCESS; }