clean up, fix preview sizes, fix ticket #89, fix ticket #90

git-svn-id: svn://code.dyne.org/veejay/trunk@508 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2006-01-20 16:38:38 +00:00
parent b8314eb2ba
commit 18ca387003
2 changed files with 84 additions and 26 deletions

View File

@@ -2339,11 +2339,52 @@ void on_mt_sync_incspeed_clicked( GtkWidget *w, gpointer user_data)
if( n > 0 ) n += 1; if( n > 0 ) n += 1;
multitrack_sync_simple_cmd( info->mt, VIMS_VIDEO_SET_SPEED, n ); multitrack_sync_simple_cmd( info->mt, VIMS_VIDEO_SET_SPEED, n );
} }
void on_mt_prev_clicked( GtkWidget *w , gpointer user_data) void on_mt_sync_prev_clicked( GtkWidget *w , gpointer user_data)
{ {
multitrack_sync_simple_cmd( info->mt, VIMS_VIDEO_PREV_FRAME ,0 ); multitrack_sync_simple_cmd( info->mt, VIMS_VIDEO_PREV_FRAME ,0 );
} }
void on_mt_next_clicked( GtkWidget *w, gpointer user_data) void on_mt_sync_next_clicked( GtkWidget *w, gpointer user_data)
{ {
multitrack_sync_simple_cmd( info->mt, VIMS_VIDEO_SKIP_FRAME, 0 ); multitrack_sync_simple_cmd( info->mt, VIMS_VIDEO_SKIP_FRAME, 0 );
} }
void on_button_fx_cut_clicked( GtkWidget *w, gpointer user_data)
{
DBG_C();
}
void on_delete1_activate(GtkWidget *w, gpointer user_data)
{
DBG_C();
}
void on_new_source1_activate( GtkWidget *w , gpointer data )
{
DBG_C();
}
void on_add_file1_activate(GtkWidget *w, gpointer user_data)
{
DBG_C();
}
void on_colorselection_color_changed( GtkWidget *w, gpointer user_data)
{
DBG_C();
}
void on_button_fx_paste_clicked( GtkWidget *w, gpointer user_data)
{
DBG_C();
}
void on_button_fx_copy_clicked(GtkWidget *w, gpointer user_data)
{
DBG_C();
}
void on_copy1_activate( GtkWidget *w, gpointer user_data)
{
DBG_C();
}
void on_new_color1_activate(GtkWidget *w , gpointer user_data)
{
DBG_C();
}
void on_delete2_activate( GtkWidget *w, gpointer user_data)
{
DBG_C();
}

View File

@@ -6199,7 +6199,7 @@ void vj_gui_init(char *glade_file)
gtk_widget_show( info->sample_bank_pad ); gtk_widget_show( info->sample_bank_pad );
setup_samplebank( NUM_SAMPLES_PER_COL, NUM_SAMPLES_PER_ROW ); setup_samplebank( NUM_SAMPLES_PER_COL, NUM_SAMPLES_PER_ROW );
create_ref_slots(skin__ == 0 ? MEM_SLOT_SIZE/2: MEM_SLOT_SIZE); create_ref_slots(skin__ == 0 ? MEM_SLOT_SIZE/4: MEM_SLOT_SIZE);
setup_knobs(); setup_knobs();
setup_vimslist(); setup_vimslist();
@@ -6316,13 +6316,19 @@ void vj_gui_preview(void)
GdkRectangle result; GdkRectangle result;
widget_get_rect_in_screen( info->quick_select, &result ); widget_get_rect_in_screen(
glade_xml_get_widget_(info->main_window, "quickselect"),
&result
);
gdouble ratio = (gdouble) h / (gdouble) w; gdouble ratio = (gdouble) h / (gdouble) w;
gint image_width = result.width / (skin__ == 0 ? MEM_SLOT_SIZE/2: MEM_SLOT_SIZE); gint image_width = result.width / (skin__ == 0 ? MEM_SLOT_SIZE/4: MEM_SLOT_SIZE);
gint image_height = image_width * ratio; gint image_height = image_width * ratio;
info->sequence_view->w = image_width; info->sequence_view->w = image_width;
info->sequence_view->h = image_height; info->sequence_view->h = image_height;
gtk_widget_set_size_request(info->quick_select,
image_width * (skin__ == 0 ? MEM_SLOT_SIZE/4:MEM_SLOT_SIZE),
image_height );
} }
@@ -6645,14 +6651,16 @@ static void
widget_get_rect_in_screen (GtkWidget *widget, GdkRectangle *r) widget_get_rect_in_screen (GtkWidget *widget, GdkRectangle *r)
{ {
gint x,y,w,h; gint x,y,w,h;
GdkRectangle extents; //GdkRectangle extents;
GdkWindow *window; //GdkWindow *window;
window = gtk_widget_get_parent_window(widget); /* getting parent window */ //window = GDK_WINDOW(gtk_widget_get_parent_window(widget)); /* getting parent window */
gdk_window_get_root_origin(window, &x,&y); /* parent's left-top screen coordinates */ //gdk_window_get_root_origin(window, &x,&y); /* parent's left-top screen coordinates */
gdk_drawable_get_size(window, &w,&h); /* parent's width and height */ //gdk_drawable_get_size(window, &w,&h); /* parent's width and height */
gdk_window_get_frame_extents(window, &extents); /* parent's extents (including decorations) */ //gdk_window_get_frame_extents(window, &extents); /* parent's extents (including decorations) */
r->x = x + (extents.width-w)/2 + widget->allocation.x; /* calculating x (assuming: left border size == right border size) */ //r->x = x + (extents.width-w)/2 + widget->allocation.x; /* calculating x (assuming: left border size == right border size) */
r->y = y + (extents.height-h)-(extents.width-w)/2 + widget->allocation.y; /* calculating y (assuming: left border size == right border size == bottom border size) */ //r->y = y + (extents.height-h)-(extents.width-w)/2 + widget->allocation.y; /* calculating y (assuming: left border size == right border size == bottom border size) */
r->x = 0;
r->y = 0;
r->width = widget->allocation.width; r->width = widget->allocation.width;
r->height = widget->allocation.height; r->height = widget->allocation.height;
} }
@@ -6846,17 +6854,21 @@ void setup_samplebank(gint num_cols, gint num_rows)
// print width of notebook samples // print width of notebook samples
GdkRectangle result; GdkRectangle result;
widget_get_rect_in_screen( info->sample_bank_pad, &result );
widget_get_rect_in_screen(
glade_xml_get_widget_( info->main_window, "sample_bank_hbox" ),
&result
);
printf("W = %d, H = %d, NC =%d, NR = %d\n", result.width,result.height,num_cols,num_rows );
// gint image_width = 44; // gint image_width = 44;
// gint image_height = 36; // gint image_height = 36;
gint image_width = result.width / num_cols; gint image_width = result.width / num_rows;
gint image_height = result.height / num_rows; gint image_height = result.height / num_cols;
//printf("IMAGE DIMENSIONS = %d x %d\n", image_width,image_height ); // info->image_dimensions[0] = 176/2;
info->image_dimensions[0] = 176/2; // info->image_dimensions[1] = 144/2;
info->image_dimensions[1] = 144/2;
// info->image_dimensions[0] = image_width * 0.7; info->image_dimensions[0] = image_width ;
// info->image_dimensions[1] = image_height * 0.7; info->image_dimensions[1] = image_height;
} }
/* -------------------------------------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------------------------------------
@@ -6975,8 +6987,13 @@ image_configure_event (GtkWidget *widget, GdkEventConfigure *event, gpointer dat
*/ */
static int compare_pixbuf(GdkPixbuf *a, GdkPixbuf *b) static int compare_pixbuf(GdkPixbuf *a, GdkPixbuf *b)
{ {
if(!a || !b )
return 0;
guchar *A = gdk_pixbuf_get_pixels( a ); guchar *A = gdk_pixbuf_get_pixels( a );
guchar *B = gdk_pixbuf_get_pixels( b ); guchar *B = gdk_pixbuf_get_pixels( b );
if(!A || !B )
return 0;
gint aN = gdk_pixbuf_get_width(a ) * gdk_pixbuf_get_height(a); gint aN = gdk_pixbuf_get_width(a ) * gdk_pixbuf_get_height(a);
gint bN = gdk_pixbuf_get_width(b ) * gdk_pixbuf_get_height(b); gint bN = gdk_pixbuf_get_width(b ) * gdk_pixbuf_get_height(b);
gint i; gint i;
@@ -7067,15 +7084,16 @@ image_expose_seq_event (GtkWidget *widget, GdkEventExpose *event, gpointer data)
}*/ }*/
if(info->sequence_view->w == 0 || info->sequence_view->h == 0 ) // if(info->sequence_view->w == 0 || info->sequence_view->h == 0 )
{ // {
sequence_gui_slot_t *g = info->sequence_view->gui_slot[j]; sequence_gui_slot_t *g = info->sequence_view->gui_slot[j];
GdkRectangle result; GdkRectangle result;
widget_get_rect_in_screen( g->frame, &result ); widget_get_rect_in_screen( g->frame, &result );
info->sequence_view->w = result.width; info->sequence_view->w = result.width;
info->sequence_view->h = result.height; info->sequence_view->h = result.height;
return FALSE; // return FALSE;
} // }
if(no_draw_) if(no_draw_)
return FALSE; return FALSE;
@@ -7200,7 +7218,6 @@ static void create_ref_slots(int envelope_size)
gchar frame_label[50]; gchar frame_label[50];
GtkWidget *vbox = glade_xml_get_widget_ (info->main_window, "quickselect"); GtkWidget *vbox = glade_xml_get_widget_ (info->main_window, "quickselect");
info->quick_select = gtk_frame_new(NULL); info->quick_select = gtk_frame_new(NULL);
gtk_widget_set_size_request(info->quick_select, 400,40 );
gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET(info->quick_select), TRUE, TRUE, 0); gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET(info->quick_select), TRUE, TRUE, 0);
gtk_widget_show(info->quick_select); gtk_widget_show(info->quick_select);