uint8_t DIA_getPartial(PARTIAL_CONFIG *param,AVDMGenericVideoStream *son,AVDMGenericVideoStream *previous) { GtkWidget *dialog; int ret=0,done=0; dialog=create_dialog1(); // Update SPIN_SET(spinbuttonStart,_start); SPIN_SET(spinbuttonSize,_end); gtk_dialog_add_action_widget (GTK_DIALOG (dialog), WID(buttonConf), F_CONF); // Run gtk_register_dialog(dialog); while(!done) { switch(gtk_dialog_run(GTK_DIALOG(dialog))) { case F_CONF: printf("Poof\n"); son->configure(previous); break; case GTK_RESPONSE_OK: { uint32_t s,e; s=SGET(spinbuttonStart); e=SGET(spinbuttonSize); if(e<s) { GUI_Error_HIG("Bad parameters","The end frame must be after the start frame !"); } else { param->_start=s; param->_end=e; done=1; ret=1; } } break; default: done=1; break; } } gtk_unregister_dialog(dialog); gtk_widget_destroy(dialog); return ret; }
static gboolean prepare_last_page(GnomeDruidPageEdge *pg, GtkWidget *ign, at_druid_info *info) { char *desc; const char *cmd = EGET(command); guint month, day, year; if (!cmd || !*cmd) { gnome_druid_page_edge_set_text(pg, "No command set. Click \"Back\" to set one."); return TRUE; } gtk_calendar_get_date(GTK_CALENDAR(info->cal), &year, &month, &day); desc = g_strdup_printf("When: %02d/%02d/%04d at %02d:%02d\nWhat: %s\n\n" "If this is correct, click \"Apply\"", month+1, day, year, SGET(hour), SGET(minute), EGET(command)); gnome_druid_page_edge_set_text(pg, desc); g_free(desc); return TRUE; }
static gboolean at_commit_job(at_druid_info *info) { const char *t; guint month, day, year; at_job_t *job = NULL; t = EGET(command); if (!t || !*t) return FALSE; job = g_new(at_job_t, 1); job->cmd = strdup(t); job->id = job->queue = job->when = NULL; gtk_calendar_get_date(GTK_CALENDAR(info->cal), &year, &month, &day); job->when = g_strdup_printf("%02d%02d %02d/%02d/%04d", SGET(hour), SGET(minute), month+1, day, year); gtk_widget_destroy(info->win); at_add_job(job); return TRUE; }
//================================================================================== void CommandParser::RemoveToken(const char *key) // JWR remove a token we don't need anymore. { StringRef rkey = SGET(key); TokenMap::iterator found; found = mTokens.find( rkey ); if ( found != mTokens.end() ) { mTokens.erase( found ); } else { assert( 0 ); printf("Attempted to remove token %s that didn't exist!\n",key); } }
//================================================================================== int CommandParser::GetTokenFromKey( const char *key ) { int ret = -1; StringRef rkey = SGET(key); TokenMap::iterator found; found = mTokens.find( rkey ); if ( found != mTokens.end() ) { TokenTag ttype = (*found).second; ret = ttype.GetLocalToken(); } return ret; }
//================================================================================== void CommandParser::AddToken(const char *key, int token, CommandParserInterface *service) { StringRef rkey = SGET(key); TokenTag ttype(token,service); TokenMap::iterator found; found = mTokens.find( rkey ); if ( found != mTokens.end() ) { printf("Attempted to add the same token (%s) twice!!\n",key); assert( 0 ); } else mTokens[ rkey ] = ttype; }
//================================================================================== int CommandParser::CommandLine(int argc,const char **argv,bool fallbackok) { int ret = 0; if ( argc ) { TokenMap::iterator found; StringRef ref = SGET(argv[0]); found = mTokens.find( ref ); if ( found == mTokens.end() ) { // do case - insenstive search for (found=mTokens.begin(); found!=mTokens.end(); ++found) { if ( stricmp( (*found).first.Get(), ref.Get() ) == 0 ) break; } } if ( found != mTokens.end() ) { TokenTag ttype = (*found).second; if ( 0 ) { for (int i=0; i<argc; i++) { gAllGlobals.gLog.ref()->Display("%s ", argv[i] ); } gAllGlobals.gLog.ref()->Display("\n"); } CommandParserInterface *cmd = ttype.GetService(); int v = cmd->CommandCallback( ttype.GetLocalToken(), argc, argv ); if ( v ) ret = v; } else { if ( mFallbacks.empty() || !fallbackok ) { #if LOG_ERROR if ( gAllGlobals.gLog.ref() ) { // gAllGlobals.gLog.ref()->Display("CPARSER(%s)???\n", argv[0] ); } #endif } else { CommandParserInterfaceVector::iterator i; for (i=mFallbacks.begin(); i!=mFallbacks.end(); ++i) { CommandParserInterface *iface = (*i); int v = iface->CommandFallback(argc,argv); if ( v ) ret = v; } } } } return ret; }
void menuSetup(void) { mEnvironmentTexture = SGET("cubemap.dds"); mStartup = true; AddToken("FractalCoordinates",MC_FRACTAL_COORDINATES); createButton("Default Mandelbrot", MC_DEFAULT_MANDELBROT, "DefaultMandelbrot"); createButton("Filter Fractal", MC_FILTER_FRACTAL, "FilterFractal"); createButton("Optimize Mesh", MC_OPTIMIZE_MESH, "OptimizeMesh"); createCheckbox("Preview Only", MC_PREVIEW_ONLY, "PreviewOnly", false ); createCheckbox("Use Rectangle Subdivision", MC_RECTANGLE_SUBDIVISION,"RectangleSubdivision",true); createCheckbox("Use Multi-Threading", MC_USE_THREADING,"UseThreading",false); createCheckbox("View3D", MC_VIEW3D,"View3d",false); createCheckbox("Wireframe Overlay", MC_WIREFRAME_OVERLAY,"WireframeOverlay",false); createCheckbox("Show Normals", MC_SHOW_NORMALS,"ShowNormals",false); createSlider("Color Scale", MC_SMOOTH_COLOR, "SmoothColor", 1, 32, 16, true ); createSlider("Iteration Count", MC_ITERATION_COUNT, "IterationCount", 40, 100000, 1024, true ); createSlider("Clock Cycles Per Frame Mhz", MC_CLOCK_CYCLES, "ClockCycles", 20, 1000, 100, true ); createSlider("Clamp Low", MC_CLAMP_LOW, "ClampLow", 0.0f, 1, 0.0f, false ); createSlider("Clamp High", MC_CLAMP_HIGH, "ClampHigh", 0.001f, 0.3f, 0.3f, false ); createSlider("Clamp Scale", MC_CLAMP_SCALE, "ClampScale", 0.1f, 8, 1.0f, false ); createSlider("Rotation Speed", MC_ROTATION_SPEED, "RotationSpeed", -10, 10, 0.0f, false ); CPARSER.Parse("TuiComboBegin ColorPalette"); CPARSER.Parse("TuiName \"Color Palette\""); { WildCard *wc = createWildCard("*.pal"); FileFind ff(wc,0); StringVector list; ff.GetFiles(list); StringVector::iterator i; for (i=list.begin(); i!=list.end(); i++) { CPARSER.Parse("TuiChoice \"%s\"", (*i).c_str() ); } releaseWildCard(wc); } CPARSER.Parse("TuiArg default.pal"); CPARSER.Parse("TuiScript ColorPalette %%1"); CPARSER.Parse("TuiEnd"); AddToken("ColorPalette", MC_COLOR_PALETTE ); CPARSER.Parse("TuiComboBegin FloatingPointResolution"); CPARSER.Parse("TuiName \"Float Resolution\""); CPARSER.Parse("TuiChoices SMALL MEDIUM BIGFLOAT FIXED32"); CPARSER.Parse("TuiArg SMALL"); CPARSER.Parse("TuiScript FloatingPointResolution %%1"); CPARSER.Parse("TuiEnd"); AddToken("FloatingPointResolution", MC_FLOATING_POINT_RESOLUTION ); CPARSER.Parse("TuiComboBegin EnvironmentTexture"); CPARSER.Parse("TuiName \"Environment Texture\""); { WildCard *wc = createWildCard("cubemap*.dds"); FileFind ff(wc,"..\\..\\media\\CodeSuppository"); StringVector list; ff.GetFiles(list); StringVector::iterator i; for (i=list.begin(); i!=list.end(); i++) { CPARSER.Parse("TuiChoice \"%s\"", (*i).c_str() ); } releaseWildCard(wc); } CPARSER.Parse("TuiArg %s", mEnvironmentTexture.Get()); CPARSER.Parse("TuiScript EnvironmentTexture %%1"); CPARSER.Parse("TuiEnd"); AddToken("EnvironmentTexture", MC_ENVIRONMENT_TEXTURE ); createButton("Memory Report", MC_MEMORY_REPORT, "MemoryReport"); CPARSER.Parse("TuiPageBegin MainMenu"); CPARSER.Parse("TuiElement DefaultMandelbrot"); CPARSER.Parse("TuiElement PreviewOnly"); CPARSER.Parse("TuiElement RectangleSubdivision"); CPARSER.Parse("TuiElement FloatingPointResolution"); CPARSER.Parse("TuiElement UseThreading"); CPARSER.Parse("TuiElement View3d"); CPARSER.Parse("TuiElement WireframeOverlay"); CPARSER.Parse("TuiElement ShowNormals"); CPARSER.Parse("TuiElement FilterFractal"); CPARSER.Parse("TuiElement OptimizeMesh"); CPARSER.Parse("TuiElement SmoothColor"); CPARSER.Parse("TuiElement IterationCount"); CPARSER.Parse("TuiElement ClockCycles"); CPARSER.Parse("TuiElement ClampLow"); CPARSER.Parse("TuiElement ClampHigh"); CPARSER.Parse("TuiElement ClampScale"); CPARSER.Parse("TuiElement RotationSpeed"); CPARSER.Parse("TuiElement ColorPalette"); CPARSER.Parse("TuiElement EnvironmentTexture"); CPARSER.Parse("TuiElement FractalCoordinates"); CPARSER.Parse("TuiElement MemoryReport"); CPARSER.Parse("TuiPageEnd"); CPARSER.Parse("TuiPage MainMenu"); // AddToken("CreateDynamics", MC_CREATE_DYNAMICS ); AddToken("PsScript", MC_PSSCRIPT); AddToken("PsLookAt", MC_PSLOOKAT); CPARSER.Parse("TuiLoad ThreadFrac.psc"); CPARSER.Parse("TuiPageExecute MainMenu"); mStartup = false; }