int cmd_font( char * in ) { // font=fontname,fontid char name[512]; char id[512]; wItem * item; CHECKDEFLIST( "font" ); CHECKWINLIST( "font" ); CHECK( "sub" ); CHECK( "menu" ); cutItem( in,name,',',0 ); cutItem( in,id,',',1 ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] font\n" ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] name: %s\n",name ); (*currSubItem)++; item=&currSubItems[ *currSubItem ]; item->type=itFont; item->fontid=fntRead( path,name ); switch ( item->fontid ) { case -1: ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; case -2: ERRORMESSAGE( MSGTR_SKIN_FONT_TooManyFontsDeclared ); return 1; case -3: ERRORMESSAGE( MSGTR_SKIN_FONT_FontFileNotFound ); return 1; case -4: ERRORMESSAGE( MSGTR_SKIN_FONT_FontImageNotFound ); return 1; } return 0; }
int cmd_menu( char * in ) { // menu = number,x,y,sx,sy,msg int x,y,sx,sy,msg; unsigned char tmp[64]; CHECKDEFLIST( "menu" ); CHECKWINLIST( "menu" ); CHECK( "main" ); CHECK( "sub" ); CHECK( "playbar" ); x=cutItemToInt( in,',',0 ); y=cutItemToInt( in,',',1 ); sx=cutItemToInt( in,',',2 ); sy=cutItemToInt( in,',',3 ); cutItem( in,tmp,',',4 ); msg=appFindMessage( tmp ); defList->NumberOfMenuItems++; defList->MenuItems[ defList->NumberOfMenuItems ].x=x; defList->MenuItems[ defList->NumberOfMenuItems ].y=y; defList->MenuItems[ defList->NumberOfMenuItems ].width=sx; defList->MenuItems[ defList->NumberOfMenuItems ].height=sy; mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] menuitem: %d\n",defList->NumberOfMenuItems ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); if ( ( defList->MenuItems[ defList->NumberOfMenuItems ].msg=msg ) == -1 ) ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,tmp ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",defList->Items[ defList->NumberOfItems ].msg ); defList->MenuItems[ defList->NumberOfMenuItems ].Bitmap.Image=NULL; return 0; }
//TODO: Unicode ? MBASEAPI BOOL MIRACLEEXPORT mirTestIsValidForFileName(LPCTSTR lpszName) { if(!AfxIsValidString(lpszName)) { ERRORMESSAGE(_MLT("Geçersiz dizi.")); return FALSE; } if(strlen(lpszName) == 0) { ERRORMESSAGE(_MLT("Sýfýr uzunlukta dizi.")); return FALSE; } char invalidchars[25] = " :\\/%%.*?+,'^|&;é@`,<>"; invalidchars[0] = 34; // Çift týrnak eklenir. CString str = lpszName; if (str.FindOneOf(invalidchars) != -1) return FALSE; return TRUE; }
int cmd_dlabel( char * in ) { // dlabel=x,y,sx,align,fontid,string ... char tmp[512]; char sid[63]; int x,y,sx,id,a; wItem * item; CHECKDEFLIST( "dlabel" ); CHECKWINLIST( "dlabel" ); CHECK( "sub" ); CHECK( "menu" ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] dlabel\n" ); x=cutItemToInt( in,',',0 ); y=cutItemToInt( in,',',1 ); sx=cutItemToInt( in,',',2 ); a=cutItemToInt( in,',',3 ); cutItem( in,sid,',',4 ); id=fntFindID( sid ); if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; } cutItem( in,tmp,',',5 ); cutItem( tmp,tmp,'"',1 ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pos: %d,%d width: %d align: %d\n",x,y,sx,a ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp ); (*currSubItem)++; item=&currSubItems[ *currSubItem ]; item->type=itDLabel; item->fontid=id; item->align=a; item->x=x; item->y=y; item->width=sx; item->height=-1; if ( ( item->label=malloc( strlen( tmp ) + 1 ) ) == NULL ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; } strcpy( item->label,tmp ); return 0; }
int cmd_window( char * in ) { CHECKDEFLIST( "window" ); strlcpy( window_name,strlower( in ),sizeof( window_name ) ); if ( !strncmp( in,"main",4 ) ) { currSection=&skinAppMPlayer->main; currSubItem=&skinAppMPlayer->NumberOfItems; currSubItems=skinAppMPlayer->Items; } else if ( !strncmp( in,"sub",3 ) ) currSection=&skinAppMPlayer->sub; else if ( !strncmp( in,"playbar",7 ) ) { currSection=&skinAppMPlayer->bar; currSubItem=&skinAppMPlayer->NumberOfBarItems; currSubItems=skinAppMPlayer->barItems; } else if ( !strncmp( in,"menu",4 ) ) { currSection=&skinAppMPlayer->menuBase; currSubItem=&skinAppMPlayer->NumberOfMenuItems; currSubItems=skinAppMPlayer->MenuItems; } else ERRORMESSAGE( MSGTR_UNKNOWNWINDOWTYPE ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window: %s\n",window_name ); return 0; }
bool InitSSL(void) { static bool s_errMsgGiven = false; if ( !s_errMsgGiven ) { s_errMsgGiven = true; ERRORMESSAGE((_("This version of the program doesn't support SSL " "authentication."))); } return false; }
static String strutil_decrypt_tf(const String &original) { if(! strutil_has_twofish) { ERRORMESSAGE((_("Strong encryption algorithm not available."))); return wxEmptyString; } if ( !setup_twofish() ) { ERRORMESSAGE((_("Impossible to use encryption without password."))); } CryptData input; input.FromHex(original.c_str()+1); // skip initial '-' CryptData output; int rc = TwoFishCrypt(0, 128, gs_GlobalPassword.utf8_str(), &input,&output); if(rc) { return output.data; } return wxEmptyString; }
int skinBPRead( char * fname, txSample * bf ) { int i=bpRead( fname,bf ); switch ( i ) { case -1: ERRORMESSAGE( MSGTR_SKIN_BITMAP_16bit,fname ); break; case -2: ERRORMESSAGE( MSGTR_SKIN_BITMAP_FileNotFound,fname ); break; case -3: ERRORMESSAGE( MSGTR_SKIN_BITMAP_BMPReadError,fname ); break; case -4: ERRORMESSAGE( MSGTR_SKIN_BITMAP_TGAReadError,fname ); break; case -5: ERRORMESSAGE( MSGTR_SKIN_BITMAP_PNGReadError,fname ); break; case -6: ERRORMESSAGE( MSGTR_SKIN_BITMAP_RLENotSupported,fname ); break; case -7: ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownFileType,fname ); break; case -8: ERRORMESSAGE( MSGTR_SKIN_BITMAP_ConversionError,fname ); break; } return i; }
int cmd_button( char * in ) { unsigned char fname[512]; unsigned char tmp[512]; int x,y,sx,sy; char msg[32]; CHECKDEFLIST( "button" ); CHECKWINLIST( "button" ); CHECK( "sub" ); CHECK( "menu" ); cutItem( in,fname,',',0 ); x=cutItemToInt( in,',',1 ); y=cutItemToInt( in,',',2 ); sx=cutItemToInt( in,',',3 ); sy=cutItemToInt( in,',',4 ); cutItem( in,msg,',',5 ); (*currSubItem)++; currSubItems[ *currSubItem ].type=itButton; currSubItems[ *currSubItem ].x=x; currSubItems[ *currSubItem ].y=y; currSubItems[ *currSubItem ].width=sx; currSubItems[ *currSubItem ].height=sy; mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] button: fname: %s\n",fname ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); if ( ( currSubItems[ *currSubItem ].msg=appFindMessage( msg ) ) == -1 ) { ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 0; } currSubItems[ *currSubItem ].pressed=btnReleased; if ( currSubItems[ *currSubItem ].msg == evPauseSwitchToPlay ) currSubItems[ *currSubItem ].pressed=btnDisabled; currSubItems[ *currSubItem ].tmp=1; mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",currSubItems[ *currSubItem ].msg ); currSubItems[ *currSubItem ].Bitmap.Image=NULL; if ( strcmp( fname,"NULL" ) ) { strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, fname, sizeof( tmp )); if ( skinBPRead( tmp,&currSubItems[ *currSubItem ].Bitmap ) ) return 1; } return 0; }
int cmd_decoration( char * in ) { char tmp[512]; CHECKDEFLIST( "decoration" ); CHECKWINLIST( "decoration" ); CHECK( "sub" ); CHECK( "menu" ); CHECK( "playbar" ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",in ); strlower( in ); cutItem( in,tmp,',',0 ); if ( strcmp( tmp,"enable" )&&strcmp( tmp,"disable" ) ) { ERRORMESSAGE( MSGTR_SKIN_UnknownParameter,tmp ); return 1; } if ( strcmp( tmp,"enable" ) ) defList->mainDecoration=0; else defList->mainDecoration=1; mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",(defList->mainDecoration?"enabled":"disabled") ); return 0; }
/* * All encrypted data is hex numbers. To distinguish between strong * and weak data, we prefix the strong encryption with a '-'. */ static String strutil_encrypt_tf(const String &original) { if ( setup_twofish() ) { CryptData input(original.utf8_str()); CryptData output; int rc = TwoFishCrypt(1, 128, gs_GlobalPassword.utf8_str(), &input ,&output); if(rc) { String tmp = output.ToHex(); String tmp2; tmp2 << '-' << tmp; return tmp2; } } else { ERRORMESSAGE((_("Impossible to use encryption without password."))); } return wxEmptyString; }
void wxMFrame::OnMenuCommand(int id) { // is it a module generated entry? if(id >= WXMENU_MODULES_BEGIN && id < WXMENU_MODULES_END) { ProcessModulesMenu(id); return; } switch(id) { case WXMENU_FILE_CLOSE: Close(); break; case WXMENU_FILE_COMPOSE_WITH_TEMPLATE: case WXMENU_FILE_COMPOSE: { wxString templ; if ( id == WXMENU_FILE_COMPOSE_WITH_TEMPLATE ) { templ = ChooseTemplateFor(MessageTemplate_NewMessage, this); if ( templ.empty() ) { // cancelled by user break; } } Profile_obj profile(GetFolderProfile()); Composer *composeView = Composer::CreateNewMessage(templ, profile); composeView->InitText(); } break; case WXMENU_FILE_SEND_OUTBOX: mApplication->SendOutbox(); break; case WXMENU_FILE_POST: { Profile_obj profile(GetFolderProfile()); Composer *composeView = Composer::CreateNewArticle(profile); composeView->InitText(); } case WXMENU_FILE_COLLECT: { FolderMonitor *mailCollector = mApplication->GetFolderMonitor(); if ( mailCollector ) { // when the user explicitly checks for the new mail, also update // the currently opened folder(s) and give the verbose messages mailCollector->CheckNewMail(FolderMonitor::Interactive | FolderMonitor::Opened); } } break; #ifdef USE_PYTHON case WXMENU_FILE_RUN_PYSCRIPT: { wxString path = mApplication->GetDataDir(); if ( !path.empty() ) path += DIR_SEPARATOR; path += _T("scripts"); wxString filename = MDialog_FileRequester ( _("Please select a Python script to run."), this, path, "", "py", "*.py", false, NULL /* profile */ ); if ( !filename.empty() ) { PythonRunScript(filename); } //else: cancelled by user } break; #endif // USE_PYTHON case WXMENU_FILE_AWAY_MODE: mApplication->SetAwayMode(GetMenuBar()->IsChecked(id)); break; case WXMENU_FILE_EXIT: // flush MEvent queues for safety MEventManager::DispatchPending(); if ( CanClose() ) { // this frame has been already asked whether it wants to exit, so // don't ask it again mApplication->AddToFramesOkToClose(this); // exit the application if other frames don't object mApplication->Exit(); } break; case WXMENU_FILE_IMPORT: ShowImportDialog(this); break; case WXMENU_EDIT_ADB: ShowAdbFrame(this); break; case WXMENU_EDIT_PREF: ShowOptionsDialog(this); break; case WXMENU_EDIT_FILTERS: (void) ConfigureAllFilters(this); break; case WXMENU_EDIT_MODULES: ShowModulesDialog(this); break; case WXMENU_EDIT_TEMPLATES: EditTemplates(this); break; case WXMENU_EDIT_RESTORE_PREF: (void)ShowRestoreDefaultsDialog(mApplication->GetProfile(), this); break; case WXMENU_EDIT_SAVE_PREF: if ( Profile::FlushAll() ) { wxLogStatus(this, _("Program preferences successfully saved.")); } else { ERRORMESSAGE((_("Couldn't save preferences."))); } break; case WXMENU_EDIT_CONFIG_SOURCES: ShowConfigSourcesDialog(this); break; case WXMENU_EDIT_EXPORT_PREF: case WXMENU_EDIT_IMPORT_PREF: { const bool doExport = id == WXMENU_EDIT_EXPORT_PREF; String path = MDialog_FileRequester ( doExport ? _("Choose file to export settings to") : _("Choose file to import settings from"), this, wxEmptyString, wxEmptyString, wxEmptyString, wxEmptyString, doExport // true => save, false => load ); if ( path.empty() ) break; ConfigSource_obj configSrc(ConfigSourceLocal::CreateDefault()), configDst(ConfigSourceLocal::CreateFile(path)); if ( !doExport ) { configSrc.Swap(configDst); } bool ok = ConfigSource::Copy(*configDst, *configSrc); if ( doExport ) { if ( ok ) { wxLogStatus(this, _("Settings successfully exported to file \"%s\""), path.c_str()); } else { wxLogError(_("Failed to export settings to the file \"%s\"."), path.c_str()); } } else // import { if ( ok ) { wxLogStatus(this, _("Settings successfully imported from \"%s\""), path.c_str()); } else { wxLogError(_("Failed to import settings from the file \"%s\"."), path.c_str()); } } } break; case WXMENU_HELP_ABOUT: MDialog_AboutDialog(this, false /* don't timeout */); break; case WXMENU_HELP_TIP: MDialog_ShowTip(this); break; case WXMENU_HELP_CONTEXT: MDialog_Message(_("Help not implemented for current context, yet."),this,_("Sorry")); break; case WXMENU_HELP_CONTENTS: mApplication->Help(MH_CONTENTS,this); break; case WXMENU_HELP_RELEASE_NOTES: mApplication->Help(MH_RELEASE_NOTES,this); break; case WXMENU_HELP_FAQ: mApplication->Help(MH_FAQ,this); break; case WXMENU_HELP_SEARCH: mApplication->Help(MH_SEARCH,this); break; case WXMENU_HELP_COPYRIGHT: mApplication->Help(MH_COPYRIGHT,this); break; // printing: case WXMENU_FILE_PRINT_SETUP: OnPrintSetup(); break; case WXMENU_FILE_PAGE_SETUP: OnPageSetup(); break; #ifdef USE_PS_PRINTING case WXMENU_FILE_PRINT_SETUP_PS: OnPrintSetup(); break; case WXMENU_FILE_PAGE_SETUP_PS: OnPageSetup(); break; #endif // USE_PS_PRINTING #ifdef USE_DIALUP case WXMENU_FILE_NET_ON: mApplication->GoOnline(); break; case WXMENU_FILE_NET_OFF: if(mApplication->CheckOutbox()) { if ( MDialog_YesNoDialog ( _("You have outgoing messages queued.\n" "Do you want to send them before going offline?"), this, MDIALOG_YESNOTITLE, M_DLG_YES_DEFAULT, M_MSGBOX_GO_OFFLINE_SEND_FIRST ) ) { mApplication->SendOutbox(); } } mApplication->GoOffline(); break; #endif // USE_DIALUP // create a new identity and edit it case WXMENU_FILE_IDENT_ADD: { wxString ident; if ( MInputBox(&ident, _("Mahogany: Create new identity"), _("Enter the identity name:"), this, "NewIdentity") ) { ShowIdentityDialog(ident, this); // update the identity combo in the toolbar of the main frame if // any (note that this will update all the other existing // identity combo boxes as they keep themselves in sync // internally) // // TODO: we really should have a virtual wxMFrame::GetIdentCombo // as we might not always create the main frame in the // future but other frames (e.g. composer) may have the // ident combo as well wxMFrame *frameTop = mApplication->TopLevelFrame(); if ( frameTop ) { wxToolBar *tbar = frameTop->GetToolBar(); if ( tbar ) { wxWindow *win = tbar->FindWindow(IDC_IDENT_COMBO); if ( win ) { wxChoice *combo = wxDynamicCast(win, wxChoice); combo->Append(ident); } } else { FAIL_MSG(_T("where is the main frames toolbar?")); } } wxLogStatus(this, _("Created new identity '%s'."), ident.c_str()); } } break; // change the current identity case WXMENU_FILE_IDENT_CHANGE: { wxArrayString identities = Profile::GetAllIdentities(); if ( identities.IsEmpty() ) { wxLogError(_("There are no existing identities to choose from.\n" "Please create an identity first.")); } else { identities.Insert(_("Default"), 0); int rc = MDialog_GetSelection ( _("Select the new identity"), MDIALOG_YESNOTITLE, identities, this ); if ( rc != -1 ) { Profile *profile = mApplication->GetProfile(); if ( rc == 0 ) { // restore the default identity profile->DeleteEntry(GetOptionName(MP_CURRENT_IDENTITY)); } else { wxString ident = identities[(size_t)rc]; profile->writeEntry(MP_CURRENT_IDENTITY, ident); } // update the identity combo in the toolbar if any wxWindow *win = GetToolBar()->FindWindow(IDC_IDENT_COMBO); if ( win ) { wxChoice *combo = wxDynamicCast(win, wxChoice); combo->SetSelection(rc); } // TODO: should update everything (all options might have // changed) } //else: dialog cancelled, nothing to do } } break; // edit an identity's parameters case WXMENU_FILE_IDENT_EDIT: { String ident; wxArrayString identities = Profile::GetAllIdentities(); if ( identities.IsEmpty() ) { wxLogError(_("There are no existing identities to edit.\n" "Please create an identity first.")); } else { if ( identities.GetCount() > 1 ) { int rc = MDialog_GetSelection ( _("Which identity would you like to edit?"), MDIALOG_YESNOTITLE, identities, this ); if ( rc != -1 ) { ident = identities[(size_t)rc]; } //else: dialog was cancelled } else // only one identity { // use the current one ident = READ_APPCONFIG_TEXT(MP_CURRENT_IDENTITY); } } if ( !ident.empty() ) { ShowIdentityDialog(ident, this); } } break; case WXMENU_FILE_IDENT_DELETE: { String ident; wxArrayString identities = Profile::GetAllIdentities(); if ( identities.IsEmpty() ) { wxLogError(_("There are no existing identities to delete.")); } else { int rc = MDialog_GetSelection ( _("Which identity would you like to delete?"), MDIALOG_YESNOTITLE, identities, this ); if ( rc != -1 ) { ident = identities[(size_t)rc]; } //else: cancelled } if ( !ident.empty() ) { Profile *profile = mApplication->GetProfile(); if ( ident == READ_APPCONFIG(MP_CURRENT_IDENTITY) ) { // can't keep this one profile->writeEntry(MP_CURRENT_IDENTITY, wxEmptyString); } // FIXME: will this really work? if there are objects which // use this identity the section will be recreated... String identSection; identSection << Profile::GetIdentityPath() << '/' << ident; profile->DeleteGroup(identSection); // update the identity combo in the toolbar if any wxWindow *win = GetToolBar()->FindWindow(IDC_IDENT_COMBO); if ( win ) { wxChoice *combo = wxDynamicCast(win, wxChoice); combo->Delete(combo->FindString(ident)); } wxLogStatus(this, _("Identity '%s' deleted."), ident.c_str()); } } break; case WXMENU_LANG_SET_DEFAULT: { static const wxFontEncoding encodingsSupported[] = { wxFONTENCODING_ISO8859_1, // West European (Latin1) wxFONTENCODING_ISO8859_2, // Central and East European (Latin2) wxFONTENCODING_ISO8859_3, // Esperanto (Latin3) wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4) wxFONTENCODING_ISO8859_5, // Cyrillic wxFONTENCODING_ISO8859_6, // Arabic wxFONTENCODING_ISO8859_7, // Greek wxFONTENCODING_ISO8859_8, // Hebrew wxFONTENCODING_ISO8859_9, // Turkish (Latin5) wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6) wxFONTENCODING_ISO8859_11, // Thai wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it // here anyhow to make all ISO8859 // consecutive numbers wxFONTENCODING_ISO8859_13, // Baltic (Latin7) wxFONTENCODING_ISO8859_14, // Latin8 wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro) wxFONTENCODING_CP1250, // WinLatin2 wxFONTENCODING_CP1251, // WinCyrillic wxFONTENCODING_CP1252, // WinLatin1 wxFONTENCODING_CP1253, // WinGreek (8859-7) wxFONTENCODING_CP1254, // WinTurkish wxFONTENCODING_CP1255, // WinHebrew wxFONTENCODING_CP1256, // WinArabic wxFONTENCODING_CP1257, // WinBaltic (almost the same as Latin 7) wxFONTENCODING_KOI8, // == KOI8-R wxFONTENCODING_UTF7, // == UTF-7 wxFONTENCODING_UTF8, // == UTF-8 }; wxArrayString encDescs; encDescs.Add(_("Default 7 bit (US ASCII)")); for ( size_t n = 0; n < WXSIZEOF(encodingsSupported); n++ ) { encDescs.Add( wxFontMapper::GetEncodingDescription( encodingsSupported[n] ) ); } int choice = MDialog_GetSelection ( _("Please choose the default encoding:\n" "it will be used by default in both\n" "message viewer and composer."), _("Choose default encoding"), encDescs, this ); wxFontEncoding enc; if ( choice == -1 ) { // cancelled, do nothing break; } else if ( choice == 0 ) { enc = wxFONTENCODING_DEFAULT; } else { enc = encodingsSupported[choice - 1]; } // remember the encoding as default mApplication->GetProfile()->writeEntry(MP_MSGVIEW_DEFAULT_ENCODING, enc); } break; case WXMENU_VIEW_TOOLBAR: if ( GetMenuBar()->IsChecked(id) ) { DoCreateToolBar(); } else // hide the toolbar { delete GetToolBar(); SetToolBar(NULL); } break; case WXMENU_VIEW_STATUSBAR: if ( GetMenuBar()->IsChecked(id) ) { DoCreateStatusBar(); } else // hide the status bar { delete GetStatusBar(); SetStatusBar(NULL); } break; case WXMENU_VIEW_FULLSCREEN: ShowFullScreen(GetMenuBar()->IsChecked(id)); break; } }
class strutil_RegEx * strutil_compileRegEx(const String &pattern, int flags) { ERRORMESSAGE((_("Regular expression matching not implemented."))); return NULL; }
bool InitSSL(void) /* FIXME: MT */ { static bool s_errMsgGiven = false; if(gs_SSL_loaded) return gs_SSL_available; String ssl_dll = READ_APPCONFIG(MP_SSL_DLL_SSL); String crypto_dll = READ_APPCONFIG(MP_SSL_DLL_CRYPTO); // it doesn't take long so nobody sees this message anyhow #if 0 STATUSMESSAGE((_("Trying to load SSL libraries '%s' and '%s'..."), crypto_dll.c_str(), ssl_dll.c_str())); #endif // 0 if ( !gs_dllCrypto.Load(crypto_dll) ) goto error; if ( !gs_dllSll.Load(ssl_dll) ) goto error; SSL_LOOKUP(SSL_new); SSL_LOOKUP(SSL_free); SSL_LOOKUP(SSL_set_rfd); SSL_LOOKUP(SSL_set_wfd); SSL_LOOKUP(SSL_set_read_ahead); SSL_LOOKUP(SSL_connect); SSL_LOOKUP(SSL_read); SSL_LOOKUP(SSL_write); SSL_LOOKUP(SSL_pending); SSL_LOOKUP(SSL_library_init); SSL_LOOKUP(SSL_load_error_strings); SSL_LOOKUP(SSL_CTX_new); SSL_LOOKUP(SSL_CTX_use_certificate); SSL_LOOKUP(SSL_CTX_use_PrivateKey); SSL_LOOKUP(SSL_CIPHER_get_name); SSL_LOOKUP(SSL_CIPHER_get_bits); SSL_LOOKUP(SSL_get_current_cipher); SSL_LOOKUP(SSL_get_fd); SSL_LOOKUP(SSL_set_fd); SSL_LOOKUP(SSL_get_error); SSL_LOOKUP(SSL_get_peer_certificate); SSL_LOOKUP(sk_num); SSL_LOOKUP(sk_value); SSL_LOOKUP(RAND_seed); SSL_LOOKUP(BIO_new_socket); SSL_LOOKUP(BIO_new_mem_buf); SSL_LOOKUP(BIO_free); SSL_LOOKUP(SSL_CTX_ctrl); SSL_LOOKUP(SSL_CTX_set_verify); SSL_LOOKUP(SSL_CTX_load_verify_locations); SSL_LOOKUP(SSL_CTX_set_default_verify_paths); SSL_LOOKUP(SSL_set_bio); SSL_LOOKUP(SSL_set_connect_state); SSL_LOOKUP(SSL_state); SSL_LOOKUP(SSL_ctrl); SSL_LOOKUP(ERR_load_crypto_strings); SSL_LOOKUP(TLSv1_server_method); SSL_LOOKUP(SSLv23_server_method); SSL_LOOKUP(SSL_CTX_set_cipher_list); SSL_LOOKUP(SSL_CTX_use_certificate_chain_file); SSL_LOOKUP(SSL_CTX_use_RSAPrivateKey_file); SSL_LOOKUP(SSL_CTX_set_tmp_rsa_callback); SSL_LOOKUP(SSL_accept); SSL_LOOKUP(X509_STORE_CTX_get_error); SSL_LOOKUP(X509_verify_cert_error_string); SSL_LOOKUP(X509_STORE_CTX_get_current_cert); SSL_LOOKUP(X509_get_subject_name); SSL_LOOKUP(X509_NAME_oneline); SSL_LOOKUP(X509_get_ext_d2i); SSL_LOOKUP(X509_free); SSL_LOOKUP(SSL_shutdown); SSL_LOOKUP(SSL_CTX_free); SSL_LOOKUP(RSA_generate_key); SSL_LOOKUP(TLSv1_client_method); SSL_LOOKUP(SSLv23_client_method); SSL_LOOKUP(EVP_PKEY_free); SSL_LOOKUP(PEM_read_bio_X509); SSL_LOOKUP(PEM_read_bio_PrivateKey); CRYPTO_LOOKUP(ERR_get_error); CRYPTO_LOOKUP(ERR_error_string); gs_SSL_available = gs_SSL_loaded = true; STATUSMESSAGE((_("Successfully loaded '%s' and '%s' - " "SSL authentication is now available."), crypto_dll.c_str(), ssl_dll.c_str())); ssl_onceonlyinit(); return true; error: if ( !s_errMsgGiven ) { ERRORMESSAGE((_("SSL authentication is not available."))); s_errMsgGiven = true; // show the log dialog first wxLog::FlushActive(); MDialog_Message ( _("You can change the locations of the SSL and crypto " "libraries in the Helpers page of the preferences dialog\n" "if you have these libraries in non default location" " or if they have some other names on your system."), NULL, "SSL tip", "SSLLibTip" ); } return false; }
bool mpeg_video_recorder::InitRecording(int width, int height){ coid::charstr mp4FileName(m_sVideoFolderPath); mp4FileName << "capture_"; mp4FileName << coid::msec_timer::get_time(); mp4FileName << ".mp4"; MP4FileHandle fileHandle = MP4Create(mp4FileName.c_str(), MP4FileMode::FILEMODE_CREATE); if (!MP4_IS_VALID_FILE_HANDLE(fileHandle)){ coid::charstr msg; msg << ERRORMESSAGE(" "); msg << "Can't create Mp4 file! Path: " << mp4FileName; log(msg); return false; } m_IsRecording = true; m_hMp4FileHandle = fileHandle; m_iVideoTrackID = MP4_INVALID_TRACK_ID; coid::bifstream cfgFile(m_sVideoFolderPath+"x264.cfg"); coid::fmtstreamcxx fmt; coid::metastream meta(fmt); if (cfgFile.is_open()){ try{ fmt.bind(cfgFile); meta.stream_in(m_oX264Cfg); } catch (coid::exception& e){ } } else{ log(WARNINGMESSAGE("x264 configuration file does not exists!")); fmt.bind(coid::nullstream); meta.xstream_in(m_oX264Cfg); } meta.stream_acknowledge(); x264_param_t param; x264_param_default_preset(¶m, m_oX264Cfg.m_sPreset.c_str(), "zerolatency"); param.i_threads = m_oX264Cfg.m_iThreadCount; param.i_width = width; param.i_height = height; param.i_fps_num = 30; param.i_fps_den = 1; // Intra refres: param.i_keyint_max = 30; param.b_intra_refresh = 1; //Rate control: param.rc.i_rc_method = X264_RC_CRF; param.rc.f_rf_constant = 25; param.rc.f_rf_constant_max = 35; //For streaming: param.b_repeat_headers = 1; param.b_annexb = 1; x264_param_apply_profile(¶m, "baseline"); m_pEncoder = x264_encoder_open(¶m); MP4TrackId videoTrackID = MP4AddH264VideoTrack(m_hMp4FileHandle, 90000, MP4_INVALID_DURATION, width, height, 0, 1, 0, 3); if (!MP4_IS_VALID_TRACK_ID(videoTrackID)){ MP4Close(m_hMp4FileHandle); return false; } m_iVideoTrackID = videoTrackID; m_iWidth = width; m_iHeight = height; m_pLastNals = NULL; m_uiLastTimestampNs = 0; m_uiFrameIndex = 0; return true; }