|
|
|
|
@ -100,6 +100,31 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
|
|
|
|
|
vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(terminal), TRUE);
|
|
|
|
|
gtk_widget_show_all(terminal);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_gtk_set_scroll(GtkWidget* self,GdkEventScroll *event, GtkAdjustment *adjustment){
|
|
|
|
|
if (self){};
|
|
|
|
|
gdouble val = gtk_adjustment_get_value(adjustment);
|
|
|
|
|
gdouble lower = gtk_adjustment_get_lower(adjustment);
|
|
|
|
|
gdouble upper = gtk_adjustment_get_upper(adjustment);
|
|
|
|
|
switch (event->direction){
|
|
|
|
|
case GDK_SCROLL_DOWN:
|
|
|
|
|
val+=2;
|
|
|
|
|
if (val>upper) val=upper;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_SCROLL_UP:
|
|
|
|
|
val-=2;
|
|
|
|
|
if (val<lower) val=lower;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
}
|
|
|
|
|
gtk_adjustment_set_value(adjustment,val);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_gtk_widget_set_scroll_window_for_scroll(GtkWidget *target, GtkScrollbar *scroll){
|
|
|
|
|
GtkAdjustment *adjustment = gtk_range_get_adjustment(GTK_RANGE(scroll));
|
|
|
|
|
g_signal_connect(G_OBJECT(target),"scroll-event",G_CALLBACK(yon_gtk_set_scroll),adjustment);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Window config section
|
|
|
|
|
|
|
|
|
|
#define check_window_config_setup if(__yon_window_config_target_window)
|
|
|
|
|
@ -926,7 +951,7 @@ typedef int (*RmbCheck)(void*);
|
|
|
|
|
|
|
|
|
|
gboolean on_rmb_menu_open(GtkWidget *self,GdkEventButton *event, rmb_menu_window *window){
|
|
|
|
|
int (*func)(void*) = (RmbCheck)(window->show_function);
|
|
|
|
|
if (func(window->show_data)){
|
|
|
|
|
if (!func||func(window->show_data)){
|
|
|
|
|
if (self){};
|
|
|
|
|
if (event->button==3){
|
|
|
|
|
|
|
|
|
|
@ -979,28 +1004,32 @@ rmb_menu_window *yon_rmb_menu_setup(GtkWidget *target_widget, int (show_function
|
|
|
|
|
GCallback current_function;
|
|
|
|
|
gpointer *current_data;
|
|
|
|
|
while ((current_label=va_arg(list,const char*))){
|
|
|
|
|
current_icon=va_arg(list,const char*);
|
|
|
|
|
current_function=va_arg(list,GCallback);
|
|
|
|
|
current_data=va_arg(list,gpointer);
|
|
|
|
|
GtkWidget *menu_item = gtk_menu_item_new();
|
|
|
|
|
GtkWidget *content_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
|
|
|
|
|
gtk_container_add(GTK_CONTAINER(menu_item),content_box);
|
|
|
|
|
|
|
|
|
|
GtkWidget *image=NULL;
|
|
|
|
|
if (!yon_char_is_empty(current_icon)){
|
|
|
|
|
image=gtk_image_new_from_icon_name(current_icon,GTK_ICON_SIZE_BUTTON);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(content_box),image,0,0,0);
|
|
|
|
|
gtk_widget_show(image);
|
|
|
|
|
if (current_label){
|
|
|
|
|
current_icon=va_arg(list,const char*);
|
|
|
|
|
current_function=va_arg(list,GCallback);
|
|
|
|
|
current_data=va_arg(list,gpointer);
|
|
|
|
|
GtkWidget *menu_item = gtk_menu_item_new();
|
|
|
|
|
GtkWidget *content_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
|
|
|
|
|
gtk_container_add(GTK_CONTAINER(menu_item),content_box);
|
|
|
|
|
|
|
|
|
|
GtkWidget *image=NULL;
|
|
|
|
|
if (!yon_char_is_empty(current_icon)){
|
|
|
|
|
image=gtk_image_new_from_icon_name(current_icon,GTK_ICON_SIZE_BUTTON);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(content_box),image,0,0,0);
|
|
|
|
|
gtk_widget_show(image);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GtkWidget *label = gtk_label_new(current_label);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(content_box),label,0,0,0);
|
|
|
|
|
|
|
|
|
|
if (current_function){
|
|
|
|
|
g_signal_connect(G_OBJECT(menu_item),"activate",current_function,current_data);
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(window->buttons,(char*)current_label,menu_item);
|
|
|
|
|
gtk_menu_shell_append(GTK_MENU_SHELL(window->menu),menu_item);
|
|
|
|
|
gtk_widget_show(menu_item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GtkWidget *label = gtk_label_new(current_label);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(content_box),label,0,0,0);
|
|
|
|
|
|
|
|
|
|
if (current_function){
|
|
|
|
|
g_signal_connect(G_OBJECT(menu_item),"activate",current_function,current_data);
|
|
|
|
|
}
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(window->buttons,(char*)current_label,menu_item);
|
|
|
|
|
gtk_menu_shell_append(GTK_MENU_SHELL(window->menu),menu_item);
|
|
|
|
|
}
|
|
|
|
|
g_signal_connect(G_OBJECT(target_widget),"button-press-event",G_CALLBACK(on_rmb_menu_open),window);
|
|
|
|
|
return window;
|
|
|
|
|
|