예제 #1
0
파일: mysql.c 프로젝트: bsmr-haxe/neko
/**
	select_db : 'connection -> string -> void
	<doc>Select the database</doc>
**/
static value select_db( value o, value db ) {
	val_check_kind(o,k_connection);
	val_check(db,string);
	if( mysql_select_db(CNX(o)->m,val_string(db)) != 0 )
		error(CNX(o)->m,"Failed to select database :");
	return val_true;
}
예제 #2
0
파일: mysql.c 프로젝트: bsmr-haxe/neko
/**
	set_conv_funs : 'connection -> function:1 -> function:1 -> function:1 -> void
	<doc>Set three wrapper methods to be be called when creating a string, a date, and binary data in results</doc>
**/
static value set_conv_funs( value o, value fstring, value fdate, value fbytes ) {
	val_check_kind(o,k_connection);
	val_check_function(fstring,1);
	val_check_function(fdate,1);
	val_check_function(fbytes,1);
	CNX(o)->conv_string = fstring;
	CNX(o)->conv_date = fdate;
	CNX(o)->conv_bytes = fbytes;
	return val_null;
}
예제 #3
0
파일: mysql.c 프로젝트: bsmr-haxe/neko
/**
	escape : 'connection -> string -> string
	<doc>Escape the string for inserting into a SQL request</doc>
**/
static value escape( value o, value s ) {
	int len;
	value sout;
	val_check_kind(o,k_connection);
	val_check(s,string);
	len = val_strlen(s) * 2;
	sout = alloc_empty_string(len);
	len = mysql_real_escape_string(CNX(o)->m,val_string(sout),val_string(s),val_strlen(s));
	if( len < 0 ) {
		buffer b = alloc_buffer("Unsupported charset : ");
		buffer_append(b,mysql_character_set_name(CNX(o)->m));
		bfailure(b);
	}
	val_set_length(sout,len);
	val_string(sout)[len] = 0;
	return sout;
}
예제 #4
0
파일: mysql.c 프로젝트: bsmr-haxe/neko
/**
	close : 'connection -> void
	<doc>Close the connection. Any subsequent operation will fail on it</doc>
**/
static value close( value o ) {
	val_check_kind(o,k_connection);
	mysql_close(CNX(o)->m);
	val_data(o) = NULL;
	val_kind(o) = NULL;
	val_gc(o,NULL);
	return val_true;
}
uint8_t DIA_contrast(AVDMGenericVideoStream *in,CONTRAST_PARAM *param)
{
  
   uint32_t width,height;
      uint8_t ret=0;
        // Allocate space for green-ised video
        width=in->getInfo()->width;
        height=in->getInfo()->height;

        dialog=create_dialog1();
		gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog),
									GTK_RESPONSE_OK,
									GTK_RESPONSE_CANCEL,
									-1);
        gtk_register_dialog(dialog);
        gtk_window_set_title (GTK_WINDOW (dialog), QT_TR_NOOP("Contrast"));
        gtk_widget_show(dialog);	
        
          // and value changed
#define CNX(x,y) gtk_signal_connect(GTK_OBJECT(WID(x)), y, GTK_SIGNAL_FUNC(gui_update), (void *) (1));

        CNX (checkLuma, "toggled");
        CNX (checkbuttonU, "toggled");
        CNX (checkbuttonV, "toggled");
        
        
        CNX (hscaleContrast, "value_changed");
        CNX (hscaleContrast, "drag_data_received");
      
        CNX (hscaleBright, "value_changed");
        CNX (hscaleBright, "drag_data_received");
        gtk_signal_connect(GTK_OBJECT(WID(hscale1)), "value_changed",GTK_SIGNAL_FUNC(frame_changed),   NULL);
        gtk_signal_connect(GTK_OBJECT(WID(drawingarea1)), "expose_event",
            GTK_SIGNAL_FUNC(gui_draw),
            NULL);


          
        myCrop=new flyContrast( width, height,in,WID(drawingarea1),WID(hscale1));
        memcpy(&(myCrop->param),param,sizeof(CONTRAST_PARAM));
        myCrop->upload();
        myCrop->sliderChanged();
        ret=0;
        int response;
        response=gtk_dialog_run(GTK_DIALOG(dialog));

        if(response==GTK_RESPONSE_OK)
        {
            myCrop->download();
            memcpy(param,&(myCrop->param),sizeof(CONTRAST_PARAM));
            ret=1;
        }
        gtk_unregister_dialog(dialog);
        gtk_widget_destroy(dialog);
        delete myCrop;
        return ret;
}
예제 #6
0
/**
	escape : 'connection -> string -> string
	<doc>Escape the string for inserting into a SQL request</doc>
**/
static value escape( value o, value s ) {
	int len;
	value sout;
	val_check_kind(o,k_connection);
	val_check(s,string);
	len = val_strlen(s) * 2;
	sout = alloc_empty_string(len);
	len = mysql_real_escape_string(CNX(o)->m,val_string(sout),val_string(s),val_strlen(s));
	val_set_length(sout,len);
	return sout;
}
예제 #7
0
 /**
          \fn jobsWindow
 */
jobsWindow::jobsWindow(QWidget *parent, uint32_t n,char **j)     : QDialog(parent)
 {
     ui.setupUi(this);
     _nbJobs=n;
     _jobsName=j;
     desc=new ADM_Job_Descriptor[n];
     // Setup display
	 ui.tableWidget->setRowCount(_nbJobs);
     ui.tableWidget->setColumnCount(4);

     // Set headers
      QStringList headers;
     headers << QT_TR_NOOP("Job Name") << QT_TR_NOOP("Status") << QT_TR_NOOP("Start Time") << QT_TR_NOOP("End Time"); 
     
     ui.tableWidget->setVerticalHeaderLabels(headers);
     updateRows();
    
#define CNX(x) connect( ui.pushButton##x,SIGNAL(clicked(bool)),this,SLOT(x(bool)))
           //connect( ui.pushButtonRunOne,SIGNAL(buttonPressed(const char *)),this,SLOT(runOne(const char *)));
      CNX(RunOne);
      CNX(RunAll);
      CNX(DeleteAll);
      CNX(DeleteOne);
 }
예제 #8
0
파일: mysql.c 프로젝트: bsmr-haxe/neko
/**
	request : 'connection -> string -> 'result
	<doc>Execute an SQL request. Exception on error</doc>
**/
static value request( value o, value r )  {
	MYSQL_RES *res;
	connection *c;
	val_check_kind(o,k_connection);
	val_check(r,string);
	c = CNX(o);
	if( mysql_real_query(c->m,val_string(r),val_strlen(r)) != 0 )
		error(c->m,val_string(r));
	res = mysql_store_result(c->m);
	if( res == NULL ) {
		if( mysql_field_count(c->m) == 0 )
			return alloc_int( (int)mysql_affected_rows(c->m) );
		else
			error(c->m,val_string(r));
	}
	return alloc_result(c,res);
}
예제 #9
0
void GUI_PreviewInit(uint32_t w , uint32_t h,uint32_t modal)
{
        if(rgb_render)
        {
                printf("\n Warning rgb render not null...\n");
                delete [] rgb_render;
                delete [] rgb_alternate;
                rgb_alternate=NULL;
                rgb_render=NULL;
        }
        stacked=0;
       ADM_assert(rgb_render=new uint8_t [w*h*4]);
       ADM_assert(rgb_alternate=new uint8_t [w*h*4]);
       uw=w;
       uh=h;
       rgbConv.reset(w,h); 

       // add callback for destroy
        lock=0;
        needDestroy=1;

#define CNX(x,y,z)  gtk_signal_connect(GTK_OBJECT(x), #y, \
                       GTK_SIGNAL_FUNC(z),                   (void *) NULL);

        dialog=create_dialog1();
/*
        CNX(WID(buttonNext),clicked     ,cb_next);
        CNX(WID(buttonPrev),clicked     ,cb_prev);
*/
        CNX(WID(drawingarea1),expose_event,previewRender);

 //       CNX(dialog    ,delete_event,preview_exit_short);

        gtk_widget_set_usize (lookup_widget(dialog,"drawingarea1"),w,h);
        gtk_widget_show(  dialog);
}
예제 #10
0
uint8_t DIA_threshold (AVDMGenericVideoStream *in,
                       ADMVideoThreshold * thresholdp,
                       THRESHOLD_PARAM * param)
{
    // Allocate space for preview video
    uint32_t width = in->getInfo()->width;
    uint32_t height = in->getInfo()->height;

    dialog = create_threshold_dialog();

	gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog),
										GTK_RESPONSE_OK,
										GTK_RESPONSE_CANCEL,
										-1);

    gtk_register_dialog(dialog);
    gtk_window_set_title (GTK_WINDOW (dialog),
                          QT_TR_NOOP("Threshold Configuration"));
    gtk_widget_show(dialog);

    myDialog = new flyThreshold (width, height, in,
                                 WID(previewVideo), WID(previewSlider),
                                 thresholdp, param);

    g_signal_connect (GTK_OBJECT (WID(previewVideo)), "configure-event",
                      GTK_SIGNAL_FUNC (preview_video_configured),
                      gpointer (myDialog));

    myDialog->upload();
    myDialog->sliderChanged();

    // update things when settings are changed
#define CNX(_widg,_signame) \
    g_signal_connect(GTK_OBJECT(WID(_widg)), _signame,                \
                     GTK_SIGNAL_FUNC(gui_update), (void *) (1));

//    CNX (minValueSlider, "drag_data_received");
    CNX (minValueSpinner, "value_changed");

//    CNX (maxValueSlider, "drag_data_received");
    CNX (maxValueSpinner, "value_changed");
      
    CNX (outputValuesMenu, "changed");

    g_signal_connect(GTK_OBJECT(WID(previewSlider)), "value_changed",
                     GTK_SIGNAL_FUNC(frame_changed), 0);
    g_signal_connect(GTK_OBJECT(WID(previewVideo)), "expose_event",
                     GTK_SIGNAL_FUNC(gui_draw), 0);

    g_signal_connect(GTK_OBJECT(WID(previewVideo)), "button_press_event",
                     GTK_SIGNAL_FUNC(previewButtonEvent),
                     gpointer(myDialog));
#if 0
    g_signal_connect(GTK_OBJECT(WID(previewVideo)), "motion_notify_event",
                     GTK_SIGNAL_FUNC(previewMotionEvent),
                     gpointer(myDialog));
#endif

    GtkWidget * previewOutputMenu = WID(previewOutputMenu);
    uint32_t filter_count;
    FILTER * filters = getCurrentVideoFilterList (&filter_count);
    int32_t active = -1;

    // The " + (active < 0)" below is a bit of a hack.  We know that in
    // on_action() in gui_filtermanager.cpp, case A_ADD, the new filter-to-be
    // is added to the filter list without incrementing nb_active_filter yet.
    // So if we get to the end of the list and haven't yet found the filter
    // that we're configuring, we know it's a new one and therefore that it is
    // one past the apparent end of the list.  It's not a clean solution, but
    // it seems like the cleanEST solution.

    for (uint32_t i = 0; i < filter_count + (active < 0); i++)
    {
        const char * name
            = (i == 0) ? "(input)" : filterGetNameFromTag (filters [i].tag);
        bool free_name = false;
                                   
        FILTER * filter = filters + i;
        AVDMGenericVideoStream * source = filter->filter;
        uint32_t w = source->getInfo()->width;
        uint32_t h = source->getInfo()->height;
        if (w != width || h != height)
        {
            name = g_strconcat ("XX ", name, " XX", NULL);
            free_name = true;
        }

        printf ("filter [%d] = %s (%d) @ %p; %dx%d\n",
                i, name, filter->tag, source, w, h);
        gtk_combo_box_append_text (GTK_COMBO_BOX (previewOutputMenu), name);
        if (filter->filter == myDialog->getSource())
        {
            gtk_combo_box_set_active (GTK_COMBO_BOX (previewOutputMenu), i);
            printf ("\tfilter [%d] is being configured now\n", i);
            active = i;
        }

        if (free_name)
            g_free (const_cast <char *> (name));
    }

    ADM_assert (active >= 0);
    myDialog->this_filter_index = active;

    g_signal_connect (GTK_OBJECT(previewOutputMenu), "changed",
                      GTK_SIGNAL_FUNC(previewOutputMenuChange),
                      gpointer(myDialog));

    uint8_t ret = 0;
    int response = gtk_dialog_run(GTK_DIALOG(dialog));

    if (response == GTK_RESPONSE_OK)
    {
        myDialog->download();
        myDialog->pushParam();
        ret = 1;
    }
    else
        myDialog->restoreParam();

    gtk_unregister_dialog(dialog);
    gtk_widget_destroy(dialog);

    delete myDialog;

    return ret;
}
예제 #11
0
uint8_t DIA_particle (AVDMGenericVideoStream *in,
                      ADMVideoParticle * particlep,
                      PARTICLE_PARAM * param,
                      const MenuMapping * menu_mapping,
                      uint32_t menu_mapping_count)
{
    // Allocate space for preview video
    uint32_t width = in->getInfo()->width;
    uint32_t height = in->getInfo()->height;

    dialog = create_particle_dialog();

	gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog),
								GTK_RESPONSE_OK,
								GTK_RESPONSE_CANCEL,
								-1);
    gtk_register_dialog (dialog);
    gtk_window_set_title (GTK_WINDOW (dialog),
                          QT_TR_NOOP("Particle Analysis Configuration"));
    gtk_widget_show (dialog);	

    // Fix up a bunch of things that Glade can't do.  This is less efficient
    // than just editing the Glade output, but it's not that big a deal and
    // doing it this way makes it MUCH easier to use Glade to tweak the layout
    // later.

    // actually, nothing to fix up in this one.  But if there ever is, this is
    // the place to do it...

    flyParticle * myDialog
        = new flyParticle (width, height, in,
                           WID(previewVideo), WID(previewSlider),
                           GTK_DIALOG(dialog), particlep, param,
                           menu_mapping, menu_mapping_count);

    g_signal_connect (GTK_OBJECT (WID(previewVideo)), "configure-event",
                      GTK_SIGNAL_FUNC (preview_video_configured),
                      gpointer (myDialog));

    myDialog->upload();
    myDialog->sliderChanged();

    g_signal_connect (GTK_OBJECT(WID(outputFileBrowseButton)), "clicked",
                      GTK_SIGNAL_FUNC(browse_button_clicked),
                      gpointer(myDialog));

    // update things when settings are changed
#define CNX(_widg,_signame) \
    g_signal_connect (GTK_OBJECT(WID(_widg)), _signame,                \
                      GTK_SIGNAL_FUNC(gui_update), gpointer(myDialog));

    CNX (minAreaSpinButton, "value_changed");
    CNX (maxAreaSpinButton, "value_changed");
    CNX (leftCropSpinButton, "value_changed");
    CNX (rightCropSpinButton, "value_changed");
    CNX (topCropSpinButton, "value_changed");
    CNX (bottomCropSpinButton, "value_changed");

    g_signal_connect (GTK_OBJECT(WID(previewSlider)), "value_changed",
                      GTK_SIGNAL_FUNC(frame_changed), gpointer(myDialog));
    g_signal_connect (GTK_OBJECT(WID(previewVideo)), "expose_event",
                      GTK_SIGNAL_FUNC(gui_draw), gpointer(myDialog));

    g_signal_connect (GTK_OBJECT(WID(previewVideo)), "button_press_event",
                      GTK_SIGNAL_FUNC(previewButtonEvent),
                      gpointer(myDialog));
#if 0
    g_signal_connect (GTK_OBJECT(WID(previewVideo)), "motion_notify_event",
                      GTK_SIGNAL_FUNC(previewMotionEvent),
                      gpointer(myDialog));
#endif

    GtkWidget * previewOutputMenu = WID(previewOutputMenu);
    uint32_t filter_count;
    FILTER * filters = getCurrentVideoFilterList (&filter_count);
    int32_t active = -1;

    // The " + (active < 0)" below is a bit of a hack.  We know that in
    // on_action() in gui_filtermanager.cpp, case A_ADD, the new filter-to-be
    // is added to the filter list without incrementing nb_active_filter yet.
    // So if we get to the end of the list and haven't yet found the filter
    // that we're configuring, we know it's a new one and therefore that it is
    // one past the apparent end of the list.  It's not a clean solution, but
    // it seems like the cleanEST solution.

    for (uint32_t i = 0; i < filter_count + (active < 0); i++)
    {
        const char * name
            = (i == 0) ? "(input)" : filterGetNameFromTag (filters [i].tag);
        bool free_name = false;
                                   
        FILTER * filter = filters + i;
        AVDMGenericVideoStream * source = filter->filter;
        uint32_t w = source->getInfo()->width;
        uint32_t h = source->getInfo()->height;
        if (w != width || h != height)
        {
            name = g_strconcat ("XX ", name, " XX", NULL);
            free_name = true;
        }

        printf ("filter [%d] = %s (%d) @ %p; %dx%d\n",
                i, name, filter->tag, source, w, h);
        gtk_combo_box_append_text (GTK_COMBO_BOX (previewOutputMenu), name);
        if (filter->filter == myDialog->getSource())
        {
            gtk_combo_box_set_active (GTK_COMBO_BOX (previewOutputMenu), i);
            printf ("\tfilter [%d] is being configured now\n", i);
            active = i;
        }

        if (free_name)
            g_free (const_cast <char *> (name));
    }

    ADM_assert (active >= 0);
    myDialog->this_filter_index = active;

    g_signal_connect (GTK_OBJECT(previewOutputMenu), "changed",
                      GTK_SIGNAL_FUNC(previewOutputMenuChange),
                      gpointer(myDialog));

    uint8_t ret = 0;
    int response = gtk_dialog_run(GTK_DIALOG(dialog));

    if (response == GTK_RESPONSE_OK)
    {
        myDialog->download();
        myDialog->pushParam();
        ret = 1;
    }
    else
        myDialog->restoreParam();

    gtk_unregister_dialog(dialog);
    gtk_widget_destroy(dialog);

    delete myDialog;

    return ret;
}
예제 #12
0
파일: mysql.c 프로젝트: bsmr-haxe/neko
static void free_connection( value o ) {
	mysql_close(CNX(o)->m);
}