int main(int argc, char **argv) { Iup::Open(argc, argv); Iup::Frame frame(Iup::List().SetAttributes("DROPDOWN=YES, 1=Test, 2=XXX, VALUE=1")); frame.SetAttribute("TITLE", "List"); Iup::Text text; text.SetAttributes("EXPAND = YES, VALUE = \"Enter your text here\""); /* Creates a label */ Iup::Label lbl("This element is a label"); /* Creatas a button */ Iup::Button btn("This button does nothing"); /* Creates handles for manipulating the zbox VALUE */ Iup::SetHandle("frame", frame); Iup::SetHandle("text", text); Iup::SetHandle("lbl", lbl); Iup::SetHandle("btn", btn); /* Creates zbox with four elements */ Iup::Zbox zbox(frame, text, lbl, btn); /* Sets zbox alignment */ zbox.SetAttribute("ALIGNMENT", "ACENTER"); zbox.SetAttribute("VALUE", "text"); zbox.SetAttribute("NAME", "ZBOX"); Iup::List list; Iup::Hbox hbox(list); /* Creates frame */ Iup::Frame frm(hbox); /* Creates dialog */ Iup::Dialog dlg ( Iup::Vbox ( frm, zbox ) ); list.SetAttributes("1 = frame, 2 = text, 3 = lbl, 4 = btn, VALUE=2"); frm.SetAttribute("TITLE", "Select an element"); dlg.SetAttributes("MARGIN=10x10, GAP=10, TITLE = \"IupZbox Example\""); list.SetCallback("ACTION", (Icallback)list_cb); dlg.ShowXY(IUP_CENTER, IUP_CENTER); Iup::MainLoop(); Iup::Close(); return 0; }
JSBool facFrame(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { uint32_t test,test2; diaElemReadOnlyText align("*****","Value:"); diaElemReadOnlyText txt("blah blah","Value:"); diaElemUInteger bt(&test,"Entry1",0,10); diaElemUInteger bt2(&test2,"Entry2",0,10); diaElemFrame frm("Frame1"); frm.swallow(&txt); frm.swallow(&bt); frm.swallow(&bt2); diaElem *elems[]={&align,&frm }; if(diaFactoryRun("Test frame",2,elems)) { *rval = BOOLEAN_TO_JSVAL(1); }else *rval = BOOLEAN_TO_JSVAL(0); return JS_TRUE; }
void av_log_wx_callback(void* ptr, int level, const char* fmt, va_list vl) { int av_log_level = AV_LOG_WARNING; AVClass* avc = ptr ? *(AVClass**)ptr : NULL; if (level > av_log_level) return; wxString printstring(wxT("")); if (avc) { printstring.Append(wxString::Format(wxT("[%s @ %p] "), wxString::FromUTF8(avc->item_name(ptr)).c_str(), avc)); } wxString frm(fmt,wxConvLibc); printstring.Append(wxString::FormatV(frm,vl)); wxString cpt; switch (level) { case 0: cpt = wxT("Error"); break; case 1: cpt = wxT("Info"); break; case 2: cpt = wxT("Debug"); break; default: cpt = wxT("Log"); break; } wxLogMessage(wxT("%s: %s"),cpt.c_str(),printstring.c_str()); }
void MenuFrm::clickedCamera(PD::Button*) { printf("MenuFrm::clickedCamera\n"); CameraFrm frm(0); frm.center(800, 600); frm.exec(); }
main () { char line [100]; while (gets (line)) frm (line); return (0); }
Exec::RetType Exec_CrdAction::DoCrdAction(CpptrajState& State, ArgList& actionargs, DataSet_Coords* CRD, Action* act, TrajFrameCounter const& frameCount) const { Timer total_time; total_time.Start(); # ifdef MPI ActionInit state(State.DSL(), State.DFL(), trajComm_); # else ActionInit state(State.DSL(), State.DFL()); # endif if ( act->Init( actionargs, state, State.Debug() ) != Action::OK ) return CpptrajState::ERR; actionargs.CheckForMoreArgs(); // Set up frame and parm for COORDS. ActionSetup originalSetup( CRD->TopPtr(), CRD->CoordsInfo(), CRD->Size() ); Frame originalFrame = CRD->AllocateFrame(); ActionFrame frm( &originalFrame, 0 ); // Set up for this topology Action::RetType setup_ret = act->Setup( originalSetup ); if ( setup_ret == Action::ERR || setup_ret == Action::SKIP ) return CpptrajState::ERR; // Loop over all frames in COORDS. ProgressBar progress( frameCount.TotalReadFrames() ); int set = 0; for (int frame = frameCount.Start(); frame < frameCount.Stop(); frame += frameCount.Offset(), ++set) { progress.Update( set ); CRD->GetFrame( frame, originalFrame ); frm.SetTrajoutNum( set ); Action::RetType ret = act->DoAction( set, frm ); if (ret == Action::ERR) { mprinterr("Error: crdaction: Frame %i, set %i\n", frame + 1, set + 1); break; } // Check if frame was modified. If so, update COORDS. if ( ret == Action::MODIFY_COORDS ) CRD->SetCRD( frame, frm.Frm() ); } # ifdef MPI act->SyncAction(); # endif // Check if parm was modified. If so, update COORDS. if ( setup_ret == Action::MODIFY_TOPOLOGY ) { mprintf("Info: crdaction: Parm for %s was modified by action %s\n", CRD->legend(), actionargs.Command()); CRD->CoordsSetup( originalSetup.Top(), originalSetup.CoordInfo() ); } act->Print(); State.MasterDataFileWrite(); total_time.Stop(); mprintf("TIME: Total action execution time: %.4f seconds.\n", total_time.Total()); return CpptrajState::OK; }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { graphin::app::init(hInstance, lpCmdLine); frame frm(WINDOW_TYPE_FRAME); frm.set_state( WINDOW_SHOWN ); return graphin::app::run(); }
void av_log_wx_callback(void* ptr, int level, const char* fmt, va_list vl) { //Most of this stuff is taken from FFmpeg tutorials and FFmpeg itself int av_log_level = AV_LOG_INFO; AVClass* avc = ptr ? *(AVClass**)ptr : NULL; if (level > av_log_level) return; wxString printstring(wxT("")); if (avc) { printstring.Append(wxString::Format(wxT("[%s @ %p] "), wxString::FromUTF8(avc->item_name(ptr)).c_str(), avc)); } wxString frm(fmt,wxConvLibc); #if defined(__WXMSW__) frm.Replace(wxT("%t"),wxT("%i"),true); //TODO: on Windows vprintf won't handle %t, and probably some others. Investigate. #endif #if defined(wxUSE_UNICODE) // String comes with %s format field and a value in value list is ascii char*. Thus in Unicode configurations // we have to convert %s to %S. frm.Replace(wxT("%s"),wxT("%S"),true); #endif printstring.Append(wxString::FormatV(frm,vl)); wxString cpt; switch (level) { case 0: cpt = wxT("Error"); break; case 1: cpt = wxT("Info"); break; case 2: cpt = wxT("Debug"); break; default: cpt = wxT("Log"); break; } #ifdef EXPERIMENTAL_OD_FFMPEG //if the decoding happens thru OD then this gets called from a non main thread, which means wxLogDebug //will crash. //TODO:find some workaround for the log. perhaps use ODManager as a bridge. for now just print if(!wxThread::IsMain()) printf("%s: %s\n",(char*)cpt.char_str(),(char*)printstring.char_str()); else #endif wxLogDebug(wxT("%s: %s"),cpt.c_str(),printstring.c_str()); }
void QReportes::mostrarDetalles() { QDialog frm(this);// = new QDialog(this); QHBoxLayout layout;// = new QHBoxLayout; QSqlQueryModel qmodel;// = new QSqlQueryModel; QTableView mitable; // = new QTableView; QDate fechaini = ui->dateFechaIni->date(); QDate fechafin = ui->dateFechaFin->date(); int autoid = this->autoSelected(); qreal filtro = ui->dsbFiltro->value(); empresa->recaudoAuto(fechaini,fechafin,autoid,filtro,&qmodel); mitable.setModel(&qmodel); layout.addWidget(&mitable); frm.setWindowTitle("Detalles"); frm.setLayout(&layout); frm.setMinimumWidth(500); frm.exec(); }
Exec::RetType Exec_CrdAction::DoCrdAction(CpptrajState& State, ArgList& actionargs, DataSet_Coords* CRD, Action* act, TrajFrameCounter const& frameCount) const { Timer total_time; total_time.Start(); # ifdef MPI ActionInit state(State.DSL(), State.DFL(), trajComm_); # else ActionInit state(State.DSL(), State.DFL()); # endif if ( act->Init( actionargs, state, State.Debug() ) != Action::OK ) return CpptrajState::ERR; actionargs.CheckForMoreArgs(); // Set up frame and parm for COORDS. ActionSetup originalSetup( CRD->TopPtr(), CRD->CoordsInfo(), CRD->Size() ); Frame originalFrame = CRD->AllocateFrame(); // Set up for this topology Action::RetType setup_ret = act->Setup( originalSetup ); if ( setup_ret == Action::ERR || setup_ret == Action::SKIP ) return CpptrajState::ERR; // If the topology was modified, we will need a new COORDS set. DataSet_Coords* crdOut = 0; if ( setup_ret == Action::MODIFY_TOPOLOGY ) { // This will not work for a TRJ set. switch ( CRD->Type() ) { case DataSet::TRAJ : mprinterr("Error: Cannot modify TRAJ data sets.\n"); break; case DataSet::COORDS : crdOut = (DataSet_Coords*)new DataSet_Coords_CRD(); break; case DataSet::REF_FRAME : crdOut = (DataSet_Coords*)new DataSet_Coords_REF(); break; default: crdOut = 0; // SANITY } if (crdOut == 0) return CpptrajState::ERR; mprintf("Info: crdaction: COORDS set '%s' will be modified by action '%s'\n", CRD->legend(), actionargs.Command()); if (frameCount.TotalReadFrames() != (int)CRD->Size()) mprintf("Info: crdaction: Previous size= %zu, new size is %i\n", CRD->Size(), frameCount.TotalReadFrames()); // Set up set, copy original metadata crdOut->SetMeta( CRD->Meta() ); if (crdOut->CoordsSetup( originalSetup.Top(), originalSetup.CoordInfo() )) return CpptrajState::ERR; DataSet::SizeArray mfArray(1, frameCount.TotalReadFrames()); if (crdOut->Allocate( mfArray )) return CpptrajState::ERR; } // Loop over all frames in COORDS. ProgressBar* progress = 0; if (State.ShowProgress()) progress = new ProgressBar( frameCount.TotalReadFrames() ); int set = 0; for (int frame = frameCount.Start(); frame < frameCount.Stop(); frame += frameCount.Offset(), ++set) { // Since Frame can be modified by actions, save original and use currentFrame ActionFrame frm( &originalFrame, set ); if (progress != 0) progress->Update( set ); CRD->GetFrame( frame, originalFrame ); Action::RetType ret = act->DoAction( set, frm ); if (ret == Action::ERR) { mprinterr("Error: crdaction: Frame %i, set %i\n", frame + 1, set + 1); break; } // Check if frame was modified. If so, update COORDS. if ( ret == Action::MODIFY_COORDS ) { if (crdOut != 0) crdOut->AddFrame( frm.Frm() ); else CRD->SetCRD( frame, frm.Frm() ); } } if (progress != 0) delete progress; # ifdef MPI act->SyncAction(); # endif // If topology was modified, replace old set with new. if ( setup_ret == Action::MODIFY_TOPOLOGY ) { mprintf("Info: crdaction: Topology for '%s' was modified by action '%s'\n", CRD->legend(), actionargs.Command()); State.DSL().RemoveSet( CRD ); State.DSL().AddSet( crdOut ); } act->Print(); State.MasterDataFileWrite(); total_time.Stop(); mprintf("TIME: Total action execution time: %.4f seconds.\n", total_time.Total()); return CpptrajState::OK; }
void MainWindow::registraAuto() { QRegistraAutos frm(empresa,this); frm.setModal(true); frm.exec(); }
JNIEXPORT jstring JNICALL Java_com_mapswithme_maps_bookmarks_data_Bookmark_nativeEncode2Ge0Url( JNIEnv * env, jobject thiz, jint cat, jlong bmk, jboolean addName) { return jni::ToJavaString(env, frm()->CodeGe0url(getBookmark(cat, bmk), addName)); }
void MainWindow::mostrarReportesTotal() { QTotalRecaudado frm(empresa,this); frm.exec(); frm.deleteLater(); }
void MainWindow::mantenimientoAutos(){ QMAutos frm(empresa,this); frm.exec(); }
void MainWindow::mantenimientoServicios() { qmservicio frm(empresa,this); frm.exec(); }
void MainWindow::mostrarReportes() { QReportes frm(empresa, this); frm.setModal(true); frm.exec(); }
void on_frame(rs2_frame* f, rs2_source * source) override { frame_source src(source); frame frm(f); on_frame_function(std::move(frm), src); }
std::uint8_t* AudioDecoderFfmpeg::decodeFrame(const std::uint8_t* input, std::uint32_t inputSize, std::uint32_t& outputSize) { //GNASH_REPORT_FUNCTION; assert(inputSize); size_t outSize = MAX_AUDIO_FRAME_SIZE; // TODO: make this a private member, to reuse (see NetStreamFfmpeg in 0.8.3) std::unique_ptr<std::int16_t, decltype(av_free)*> output( reinterpret_cast<std::int16_t*>(av_malloc(outSize)), av_free ); if (!output.get()) { log_error(_("failed to allocate audio buffer.")); outputSize = 0; return nullptr; } std::int16_t* outPtr = output.get(); #ifdef GNASH_DEBUG_AUDIO_DECODING log_debug("AudioDecoderFfmpeg: about to decode %d bytes; " "ctx->channels:%d, ctx->frame_size:%d", inputSize, _audioCodecCtx->channels, _audioCodecCtx->frame_size); #endif // older ffmpeg versions didn't accept a const input.. AVPacket pkt; int got_frm = 0; av_init_packet(&pkt); pkt.data = const_cast<uint8_t*>(input); pkt.size = inputSize; std::unique_ptr<AVFrame, FrameDeleter> frm(FRAMEALLOC(), FrameDeleter()); if (!frm.get()) { log_error(_("failed to allocate frame.")); return nullptr; } int tmp = avcodec_decode_audio4(_audioCodecCtx, frm.get(), &got_frm, &pkt); #ifdef GNASH_DEBUG_AUDIO_DECODING const char* fmtname = av_get_sample_fmt_name(_audioCodecCtx->sample_fmt); log_debug(" decodeFrame | frm->nb_samples: %d | &got_frm: %d | " "returned %d | inputSize: %d", frm->nb_samples, got_frm, tmp, inputSize); #endif int plane_size; if (tmp >= 0 && got_frm) { int data_size = av_samples_get_buffer_size( &plane_size, _audioCodecCtx->channels, frm->nb_samples, _audioCodecCtx->sample_fmt, 1); if (static_cast<int>(outSize) < data_size) { log_error(_("output buffer size is too small for the current frame " "(%d < %d)"), outSize, data_size); return nullptr; } memcpy(outPtr, frm->extended_data[0], plane_size); #if !(defined(HAVE_SWRESAMPLE_H) || defined(HAVE_AVRESAMPLE_H)) int planar = av_sample_fmt_is_planar(_audioCodecCtx->sample_fmt); if (planar && _audioCodecCtx->channels > 1) { uint8_t *out = ((uint8_t *)outPtr) + plane_size; for (int ch = 1; ch < _audioCodecCtx->channels; ch++) { memcpy(out, frm->extended_data[ch], plane_size); out += plane_size; } } #endif outSize = data_size; #ifdef GNASH_DEBUG_AUDIO_DECODING log_debug(" decodeFrame | fmt: %d | fmt_name: %s | planar: %d | " "plane_size: %d | outSize: %d", _audioCodecCtx->sample_fmt, fmtname, planar, plane_size, outSize); #endif } else { if (tmp < 0) log_error(_("avcodec_decode_audio returned %d."), tmp); if (outSize < 2) log_error(_("outputSize:%d after decoding %d bytes of input audio " "data."), outputSize, inputSize); log_error(_("Upgrading ffmpeg/libavcodec might fix this issue.")); outputSize = 0; return nullptr; } // Resampling is needed. if (_resampler.init(_audioCodecCtx)) { // Resampling is needed. // Compute new size based on frame_size and // resampling configuration // Find out the needed sample rate scaling double resampleFactor = 44100.0/_audioCodecCtx->sample_rate; // Compute total number of input samples int inSamples = outSize; bool stereo = _audioCodecCtx->channels > 1 ? true : false; if (stereo) inSamples = inSamples >> 1; if (_audioCodecCtx->sample_fmt == AV_SAMPLE_FMT_S16 || _audioCodecCtx->sample_fmt == AV_SAMPLE_FMT_S16P) { inSamples = inSamples >> 1; }
std::uint8_t* AudioDecoderFfmpeg::decodeFrame(const std::uint8_t* input, std::uint32_t inputSize, std::uint32_t& outputSize) { //GNASH_REPORT_FUNCTION; assert(inputSize); size_t outSize = MAX_AUDIO_FRAME_SIZE; // TODO: make this a private member, to reuse (see NetStreamFfmpeg in 0.8.3) std::unique_ptr<std::int16_t, decltype(av_free)*> output( reinterpret_cast<std::int16_t*>(av_malloc(outSize)), av_free ); if (!output.get()) { log_error(_("failed to allocate audio buffer.")); outputSize = 0; return nullptr; } std::int16_t* outPtr = output.get(); #ifdef GNASH_DEBUG_AUDIO_DECODING log_debug("AudioDecoderFfmpeg: about to decode %d bytes; " "ctx->channels:%d, ctx->frame_size:%d", inputSize, _audioCodecCtx->channels, _audioCodecCtx->frame_size); #endif // older ffmpeg versions didn't accept a const input.. AVPacket pkt; int got_frm = 0; av_init_packet(&pkt); pkt.data = const_cast<uint8_t*>(input); pkt.size = inputSize; std::unique_ptr<AVFrame, FrameDeleter> frm(FRAMEALLOC(), FrameDeleter()); if (!frm.get()) { log_error(_("failed to allocate frame.")); return nullptr; } int tmp = avcodec_decode_audio4(_audioCodecCtx, frm.get(), &got_frm, &pkt); #ifdef GNASH_DEBUG_AUDIO_DECODING const char* fmtname = av_get_sample_fmt_name(_audioCodecCtx->sample_fmt); log_debug(" decodeFrame | frm->nb_samples: %d | &got_frm: %d | " "returned %d | inputSize: %d", frm->nb_samples, got_frm, tmp, inputSize); #endif int plane_size; if (tmp >= 0 && got_frm) { int data_size = av_samples_get_buffer_size( &plane_size, _audioCodecCtx->channels, frm->nb_samples, _audioCodecCtx->sample_fmt, 1); if (static_cast<int>(outSize) < data_size) { log_error(_("output buffer size is too small for the current frame " "(%d < %d)"), outSize, data_size); return nullptr; } memcpy(outPtr, frm->extended_data[0], plane_size); #if !(defined(HAVE_SWRESAMPLE_H) || defined(HAVE_AVRESAMPLE_H)) int planar = av_sample_fmt_is_planar(_audioCodecCtx->sample_fmt); if (planar && _audioCodecCtx->channels > 1) { uint8_t *out = ((uint8_t *)outPtr) + plane_size; for (int ch = 1; ch < _audioCodecCtx->channels; ch++) { memcpy(out, frm->extended_data[ch], plane_size); out += plane_size; } } #endif outSize = data_size; #ifdef GNASH_DEBUG_AUDIO_DECODING log_debug(" decodeFrame | fmt: %d | fmt_name: %s | planar: %d | " "plane_size: %d | outSize: %d", _audioCodecCtx->sample_fmt, fmtname, planar, plane_size, outSize); #endif } else { if (tmp < 0) log_error(_("avcodec_decode_audio returned %d."), tmp); if (outSize < 2) log_error(_("outputSize:%d after decoding %d bytes of input audio " "data."), outputSize, inputSize); log_error(_("Upgrading ffmpeg/libavcodec might fix this issue.")); outputSize = 0; return nullptr; } // Resampling is needed. if (_resampler.init(_audioCodecCtx)) { // Resampling is needed. // Compute new size based on frame_size and // resampling configuration double resampleFactor = (44100.0/_audioCodecCtx->sample_rate) * (2.0/_audioCodecCtx->channels); bool stereo = _audioCodecCtx->channels > 1 ? true : false; int inSamples = stereo ? outSize >> 2 : outSize >> 1; int expectedMaxOutSamples = std::ceil(inSamples*resampleFactor); // *channels *sampleSize int resampledFrameSize = expectedMaxOutSamples*2*2; // Allocate just the required amount of bytes std::uint8_t* resampledOutput = new std::uint8_t[resampledFrameSize]; #ifdef GNASH_DEBUG_AUDIO_DECODING log_debug(" decodeFrame | Calling the resampler, resampleFactor: %d | " "in %d hz %d ch %d bytes %d samples, %s fmt", resampleFactor, _audioCodecCtx->sample_rate, _audioCodecCtx->channels, outSize, inSamples, fmtname); log_debug(" decodeFrame | out 44100 hz 2 ch %d bytes", resampledFrameSize); #endif int outSamples = _resampler.resample(frm->extended_data, // input plane_size, // input frm->nb_samples, // input &resampledOutput); // output // make sure to set outPtr *after* we use it as input to the resampler outPtr = reinterpret_cast<std::int16_t*>(resampledOutput); #ifdef GNASH_DEBUG_AUDIO_DECODING log_debug("resampler returned %d samples ", outSamples); #endif if (expectedMaxOutSamples < outSamples) { log_error(_(" --- Computation of resampled samples (%d) < then the actual returned samples (%d)"), expectedMaxOutSamples, outSamples); log_debug(" input frame size: %d", outSize); log_debug(" input sample rate: %d", _audioCodecCtx->sample_rate); log_debug(" input channels: %d", _audioCodecCtx->channels); log_debug(" input samples: %d", inSamples); log_debug(" output sample rate (assuming): %d", 44100); log_debug(" output channels (assuming): %d", 2); log_debug(" output samples: %d", outSamples); /// Memory errors... abort(); } // Use the actual number of samples returned, multiplied // to get size in bytes (not two-byte samples) and for // stereo? outSize = outSamples * 2 * 2; }
void MainWindow::registraServicio() { QService frm(empresa,this); frm.setModal(true); frm.exec(); }