void on_filechooser_dialog_response(Etk_Dialog *filechooser_dialog, int response_id, void *data) { const char *cover_file_name; const char *cover_file_folder; char *cover_path; Etk_Tree_Row *row; if (response_id == ETK_RESPONSE_OK) { cover_file_name = etk_filechooser_widget_selected_file_get (ETK_FILECHOOSER_WIDGET(filechooser)); cover_file_folder = etk_filechooser_widget_current_folder_get (ETK_FILECHOOSER_WIDGET(filechooser)); asprintf(&cover_path, "%s/%s", cover_file_folder, cover_file_name); change_cover_path(cover_path); row = etk_tree_selected_row_get(ETK_TREE(tree)); free(etk_tree_row_data_get(row)); etk_tree_row_data_set(row, cover_path); etk_image_set_from_file(ETK_IMAGE(cover), cover_path, NULL); } etk_widget_hide_all(ETK_WIDGET(filechooser_dialog)); }
static Etk_Bool _etk_cairo_size_requested_cb(Etk_Object *object, Etk_Size *size, void *data) { Etk_Cairo *cairo; unsigned char *pixels = NULL; int static old_w = -1, old_h = -1; int w, h; if (!(cairo = ETK_CAIRO(object))) return ETK_TRUE; etk_widget_geometry_get(ETK_WIDGET(cairo), NULL, NULL, &w, &h); if (old_w == w && old_h == h) return ETK_TRUE; old_w = w; old_h = h; _etk_cairo_rebuild(cairo); cairo_rectangle(cairo->cairo.cr, 0, 0, w, h); etk_signal_emit(ETK_CAIRO_REDRAW_REQUIRED_SIGNAL, object, NULL); pixels = cairo_image_surface_get_data(cairo->cairo.surface); if (pixels) etk_image_set_from_data(ETK_IMAGE(cairo->image), w, h, pixels, ETK_FALSE); return ETK_TRUE; }
/** * @brief Make a menu with small stock image and sets a callback on "activated" on each elements * @param menu The Etk_Menu to setup * @param ... An (char*)menu_item name, an (Etk_Stock_Id)image id, a Etk_Callback function and * it data ... terminated by NULL */ void emphasis_menu_append(Etk_Widget *menu, ...) { Etk_Widget *menu_item, *item_image = NULL; char *item_name; Etk_Stock_Id item_image_id; void *callback, *data; va_list arglist; va_start(arglist, menu); while ((item_name = va_arg(arglist, char *)) != NULL) { menu_item = etk_menu_item_image_new_with_label(item_name); item_image_id = va_arg(arglist, Etk_Stock_Id); if (item_image_id) { item_image = etk_image_new_from_stock(item_image_id, ETK_STOCK_SMALL); etk_menu_item_image_set(ETK_MENU_ITEM_IMAGE(menu_item), ETK_IMAGE(item_image)); } callback = va_arg(arglist, void *); data = va_arg(arglist, void *); if (callback) { etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(callback), data); } etk_menu_shell_append(ETK_MENU_SHELL(menu), ETK_MENU_ITEM(menu_item)); } va_end(arglist); }
void _ex_tab_current_zoom_one_to_one(Exhibit *e) { if (e->cur_tab->fit_window) { if (e->cur_tab->comment.visible) { etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook), e->cur_tab->num, e->cur_tab->comment.vbox); etk_container_remove(e->cur_tab->alignment); etk_container_remove(e->cur_tab->comment.frame); etk_box_append(ETK_BOX(e->cur_tab->comment.vbox), e->cur_tab->scrolled_view, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); etk_box_append(ETK_BOX(e->cur_tab->comment.vbox), e->cur_tab->comment.frame, ETK_BOX_START, ETK_BOX_NONE, 3); } else etk_notebook_page_child_set(ETK_NOTEBOOK(e->notebook), e->cur_tab->num, e->cur_tab->scrolled_view); etk_widget_size_request_set(e->cur_tab->alignment, -1, -1); etk_scrolled_view_add_with_viewport(ETK_SCROLLED_VIEW(e->cur_tab->scrolled_view), e->cur_tab->alignment); e->cur_tab->fit_window = ETK_FALSE; } e->zoom = 0; e->brightness = 128; e->contrast = 0; _ex_image_zoom(ETK_IMAGE(e->cur_tab->image), e->zoom); _ex_main_statusbar_zoom_update(e); }
/*Function to make standard menu items*/ static Etk_Widget *_entropy_etk_menu_item_new(Etk_Menu_Item_Type item_type, const char *label, Etk_Stock_Id stock_id, Etk_Menu_Shell *menu_shell, Etk_Widget *statusbar) { Etk_Widget *menu_item = NULL; switch (item_type) { case ETK_MENU_ITEM_NORMAL: menu_item = etk_menu_item_image_new_with_label(label); break; case ETK_MENU_ITEM_SEPARATOR: menu_item = etk_menu_item_separator_new(); break; default: return NULL; } if (stock_id != ETK_STOCK_NO_STOCK) { Etk_Widget *image; image = etk_image_new_from_stock(stock_id, ETK_STOCK_SMALL); etk_menu_item_image_set(ETK_MENU_ITEM_IMAGE(menu_item), ETK_IMAGE(image)); } etk_menu_shell_append(menu_shell, ETK_MENU_ITEM(menu_item)); /*etk_signal_connect("selected", ETK_OBJECT(menu_item), ETK_CALLBACK(_etk_test_menu_item_selected_cb), statusbar); etk_signal_connect("deselected", ETK_OBJECT(menu_item), ETK_CALLBACK(_etk_test_menu_item_deselected_cb), statusbar);*/ return menu_item; }
void on_tree_row_selected(Etk_Object *object, Etk_Tree_Row *row, void *data) { char *path; path = etk_tree_row_data_get(row); if(path) { etk_image_set_from_file(ETK_IMAGE(cover), path, NULL); } else { etk_image_set_from_stock(ETK_IMAGE(cover), ETK_STOCK_IMAGE_MISSING, ETK_STOCK_BIG); } }
/* TODO : doc */ void emphasis_player_vol_image_set(Emphasis_Player_Gui *player, int high, const char *path) { switch(high) { case 0: etk_image_set_from_file(ETK_IMAGE(player->small.sound_low), path, NULL); etk_image_set_from_file(ETK_IMAGE(player->full.sound_low) , path, NULL); break; default: etk_image_set_from_file(ETK_IMAGE(player->small.sound_high), path, NULL); etk_image_set_from_file(ETK_IMAGE(player->full.sound_high) , path, NULL); break; } }
/* TODO : documentation */ void emphasis_player_cover_set(Emphasis_Player_Gui *player, const char *path) { const char *cover; if(!path) { cover = emphasis_cover_haricotmagique(); } else { cover = path; } etk_image_set_from_file(ETK_IMAGE(player->full.cover) , cover, NULL); etk_image_set_from_file(ETK_IMAGE(player->small.cover), cover, NULL); if(!path) { return; } if( etk_image_has_error(ETK_IMAGE(player->full.cover)) == ETK_TRUE || etk_image_has_error(ETK_IMAGE(player->small.cover)) == ETK_TRUE ) { emphasis_player_cover_set(player, NULL); } }
/* Menu_Item_Image: Sets the property whose id is "property_id" to the value "value" */ static void _etk_menu_item_image_property_set(Etk_Object *object, int property_id, Etk_Property_Value *value) { Etk_Menu_Item_Image *image_item; if (!(image_item = ETK_MENU_ITEM_IMAGE(object)) || !value) return; switch (property_id) { case ETK_MENU_ITEM_IMAGE_PROPERTY: etk_menu_item_image_set(image_item, ETK_IMAGE(etk_property_value_object_get(value))); break; default: break; } }
/** * @brief Sets the label of the menu-item from a stock-id. If the menu-item is an Etk_Menu_Item_Image, * the image is also changed depending on the stock-id * @param menu_item a menu-item * @param stock_id the stock-id corresponding to the label and the image you want to use * @see Etk_Stock */ void etk_menu_item_set_from_stock(Etk_Menu_Item *menu_item, Etk_Stock_Id stock_id) { const char *label; if (!menu_item) return; label = etk_stock_label_get(stock_id); etk_menu_item_label_set(menu_item, label); if (ETK_IS_MENU_ITEM_IMAGE(menu_item)) { Etk_Widget *image; image = etk_image_new_from_stock(stock_id, ETK_STOCK_SMALL); etk_menu_item_image_set(ETK_MENU_ITEM_IMAGE(menu_item), ETK_IMAGE(image)); etk_widget_internal_set(image, ETK_TRUE); etk_widget_show(image); } }
static void _ex_tab_tree_drag_begin_cb(Etk_Object *object, void *data) { Ex_Tab *tab; Etk_Tree *tree; Etk_Tree_Row *row; Etk_Widget *drag; Etk_Widget *image; Eina_List *rows; char *icol1_string; char *icol2_string; char *drag_data; const char **types; unsigned int num_types; tab = data; tree = ETK_TREE(object); /* TODO: reimplement dnd when it is reimplemented in Etk drag = (ETK_WIDGET(tree))->drag; */ drag = NULL; rows = etk_tree_selected_rows_get(tree); types = calloc(1, sizeof(char*)); num_types = 1; types[0] = strdup("text/uri-list"); if (eina_list_count(rows) > 1) { Eina_List *ll; Etk_Widget *table; int i = 0, l = 0, r = 0, t = 0, b = 0, row_num; if (eina_list_count(rows) >= EX_DND_COL_NUM) row_num = eina_list_count(rows) / EX_DND_COL_NUM; else row_num = 1; table = etk_table_new(EX_DND_COL_NUM, row_num + 1, ETK_TABLE_HOMOGENEOUS); drag_data = calloc(PATH_MAX * eina_list_count(rows), sizeof(char)); EINA_LIST_FOREACH(rows, ll, row) { char tmp[PATH_MAX]; etk_tree_row_fields_get(row, etk_tree_nth_col_get(tree, 0), &icol1_string, &icol2_string, etk_tree_nth_col_get(tree, 1),NULL); snprintf(tmp, PATH_MAX * sizeof(char), "file://%s%s\r\n", tab->dir, icol2_string); strncat(drag_data, tmp, PATH_MAX * eina_list_count(rows)); if (i <= EX_DND_MAX_NUM * EX_DND_MAX_NUM) { image = etk_image_new_from_file(icol1_string, NULL); etk_image_keep_aspect_set(ETK_IMAGE(image), ETK_TRUE); etk_widget_size_request_set(image, 48, 48); etk_table_attach(ETK_TABLE(table), image, l, r, t, b, ETK_TABLE_NONE, 3, 3); ++l; ++r; if (l == EX_DND_COL_NUM) { l = r = 0; ++t; ++b; } } ++i; }
Ex_Tab * _ex_tab_new(Exhibit *e, char *dir) { Ex_Tab *tab; Etk_Tree_Model *imodel; char *file; file = NULL; tab = calloc(1, sizeof(Ex_Tab)); //tab->num = eina_list_count(e->tabs); tab->dirs = NULL; if (!dir) { D(("NO DIR\n")); exit(-1); } D(("Creating new tab with %s\n", dir)); if (e->options->default_view == EX_IMAGE_FIT_TO_WINDOW) { tab->fit_window = ETK_TRUE; D(("Setting EX_IMAGE_FIT_TO_WINDOW\n")); } else tab->fit_window = ETK_FALSE; tab->comment.visible = ETK_FALSE; tab->image_loaded = ETK_FALSE; tab->dtree = etk_tree_new(); etk_widget_size_request_set(tab->dtree, 180, 120); etk_signal_connect("row-clicked", ETK_OBJECT(tab->dtree), ETK_CALLBACK(_ex_tab_dtree_item_clicked_cb), e); tab->dcol = etk_tree_col_new(ETK_TREE(tab->dtree), "Directories", 10, 0.0); etk_tree_col_model_add(tab->dcol, etk_tree_model_image_new()); etk_tree_col_model_add(tab->dcol, etk_tree_model_text_new()); etk_tree_headers_visible_set(ETK_TREE(tab->dtree), 0); etk_scrolled_view_policy_set(etk_tree_scrolled_view_get(ETK_TREE(tab->dtree)), ETK_POLICY_AUTO, ETK_POLICY_SHOW); etk_tree_build(ETK_TREE(tab->dtree)); tab->itree = etk_tree_new(); etk_scrolled_view_dragable_set(ETK_SCROLLED_VIEW(etk_tree_scrolled_view_get(ETK_TREE(tab->itree))), ETK_TRUE); etk_scrolled_view_drag_bouncy_set(ETK_SCROLLED_VIEW(etk_tree_scrolled_view_get(ETK_TREE(tab->itree))), ETK_FALSE); etk_scrolled_view_drag_damping_set(ETK_SCROLLED_VIEW(etk_tree_scrolled_view_get(ETK_TREE(tab->itree))), 300); etk_widget_dnd_source_set(ETK_WIDGET(tab->itree), ETK_TRUE); // etk_signal_connect("drag_begin", ETK_OBJECT(tab->itree), ETK_CALLBACK(_ex_tab_tree_drag_begin_cb), tab); etk_widget_size_request_set(tab->itree, 180, 220); etk_tree_multiple_select_set(ETK_TREE(tab->itree), ETK_TRUE); etk_signal_connect("row-selected", ETK_OBJECT(tab->itree), ETK_CALLBACK(_ex_tab_itree_item_clicked_cb), e); etk_signal_connect("key-down", ETK_OBJECT(tab->itree), ETK_CALLBACK(_ex_tab_itree_key_down_cb), e); imodel = etk_tree_model_wobbly_new(); tab->imodel = imodel; //etk_tree_model_image_width_set(imodel, 80, 0.0); tab->icol = etk_tree_col_new(ETK_TREE(tab->itree), "Files", 10, 0.0); etk_tree_col_model_add(tab->icol, imodel); etk_tree_col_model_add(tab->icol, etk_tree_model_text_new()); etk_tree_headers_visible_set(ETK_TREE(tab->itree), 0); etk_tree_rows_height_set(ETK_TREE(tab->itree), 60); etk_scrolled_view_policy_set(etk_tree_scrolled_view_get(ETK_TREE(tab->itree)), ETK_POLICY_AUTO, ETK_POLICY_SHOW); etk_tree_build(ETK_TREE(tab->itree)); tab->dir = _ex_path_normalize(ecore_file_realpath(dir)); tab->alignment = etk_alignment_new(0.5, 0.5, 1.0, 1.0); tab->image = etk_image_new(); etk_widget_theme_file_set(tab->image, PACKAGE_DATA_DIR"/gui.edj"); etk_widget_theme_group_set(tab->image, "image_bg"); etk_signal_connect("mouse-down", ETK_OBJECT(tab->image), ETK_CALLBACK(_ex_image_mouse_down), e); etk_signal_connect("mouse-up", ETK_OBJECT(tab->image), ETK_CALLBACK(_ex_image_mouse_up), e); etk_signal_connect("mouse-move", ETK_OBJECT(tab->image), ETK_CALLBACK(_ex_image_mouse_move), e); etk_signal_connect("mouse-wheel", ETK_OBJECT(tab->image), ETK_CALLBACK(_ex_image_mouse_wheel), e); etk_image_keep_aspect_set(ETK_IMAGE(tab->image), ETK_TRUE); etk_container_add(ETK_CONTAINER(tab->alignment), tab->image); tab->scrolled_view = etk_scrolled_view_new(); etk_scrolled_view_policy_set(ETK_SCROLLED_VIEW(tab->scrolled_view), ETK_POLICY_HIDE, ETK_POLICY_HIDE); etk_scrolled_view_dragable_set(ETK_SCROLLED_VIEW(tab->scrolled_view), ETK_TRUE); etk_scrolled_view_drag_bouncy_set((ETK_SCROLLED_VIEW(tab->scrolled_view)), ETK_FALSE); etk_scrolled_view_add_with_viewport(ETK_SCROLLED_VIEW(tab->scrolled_view), tab->alignment); etk_widget_has_event_object_set(tab->scrolled_view, ETK_TRUE); etk_signal_connect("mouse-wheel", ETK_OBJECT(tab->scrolled_view), ETK_CALLBACK(_ex_image_mouse_wheel), e); return tab; }
/*** Implementation ***/ Etk_Widget* state_frame_create(void) { Etk_Widget *vbox; Etk_Widget *hbox; Etk_Widget *label; Etk_Combobox_Item *ComboItem; //vbox vbox = etk_vbox_new(ETK_FALSE, 0); // etk_container_add(ETK_CONTAINER(UI_DescriptionFrame), vbox); //hbox hbox = etk_hbox_new(ETK_FALSE, 0); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); label = etk_label_new("<b>Name</b>"); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //StateEntry UI_StateEntry = etk_entry_new(); UI_StateEntryImage = etk_image_new_from_stock(ETK_STOCK_DIALOG_OK, ETK_STOCK_SMALL); etk_entry_image_set(ETK_ENTRY(UI_StateEntry), ETK_ENTRY_IMAGE_SECONDARY, ETK_IMAGE(UI_StateEntryImage)); etk_box_append(ETK_BOX(hbox), UI_StateEntry, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //UI_StateIndexSpinner //~ UI_StateIndexSpinner = etk_spinner_new(0.0, 1.0, 0.0, 0.1, 1.0); //~ etk_spinner_digits_set(ETK_SPINNER(UI_StateIndexSpinner), 1); //~ etk_widget_size_request_set(UI_StateIndexSpinner,45, 20); //~ etk_box_append(ETK_BOX(hbox),UI_StateIndexSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); //hbox hbox = etk_hbox_new(ETK_FALSE, 0); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); label = etk_label_new("<b>Aspect</b>"); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); label = etk_label_new("min:"); etk_object_properties_set(ETK_OBJECT(label), "xalign", 1.0, NULL); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_AspectMinSpinner UI_AspectMinSpinner = etk_spinner_new(0.0, 100.0, 0.0, 0.1, 1.0); etk_spinner_digits_set(ETK_SPINNER(UI_AspectMinSpinner), 1); etk_widget_size_request_set(UI_AspectMinSpinner,45, 20); etk_box_append(ETK_BOX(hbox), UI_AspectMinSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); label = etk_label_new("max:"); etk_object_properties_set(ETK_OBJECT(label), "xalign", 1.0, NULL); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_AspectMaxSpinner UI_AspectMaxSpinner = etk_spinner_new(0.0, 100.0, 0.0, 0.1, 1.0); etk_spinner_digits_set(ETK_SPINNER(UI_AspectMaxSpinner), 1); etk_widget_size_request_set(UI_AspectMaxSpinner, 45, 20); etk_box_append(ETK_BOX(hbox), UI_AspectMaxSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_AspectCombo UI_AspectComboBox = etk_combobox_new(); etk_combobox_column_add(ETK_COMBOBOX(UI_AspectComboBox), ETK_COMBOBOX_LABEL, 30, ETK_COMBOBOX_NONE, 0.0); etk_combobox_build(ETK_COMBOBOX(UI_AspectComboBox)); etk_box_append(ETK_BOX(hbox), UI_AspectComboBox, ETK_BOX_START, ETK_BOX_NONE, 0); ComboItem = etk_combobox_item_append(ETK_COMBOBOX(UI_AspectComboBox), "None"); etk_combobox_item_data_set(ComboItem, (void*)EDJE_ASPECT_PREFER_NONE); ComboItem = etk_combobox_item_append(ETK_COMBOBOX(UI_AspectComboBox), "Vertical"); etk_combobox_item_data_set(ComboItem, (void*)EDJE_ASPECT_PREFER_VERTICAL); ComboItem = etk_combobox_item_append(ETK_COMBOBOX(UI_AspectComboBox), "Horizontal"); etk_combobox_item_data_set(ComboItem, (void*)EDJE_ASPECT_PREFER_HORIZONTAL); ComboItem = etk_combobox_item_append(ETK_COMBOBOX(UI_AspectComboBox), "Both"); etk_combobox_item_data_set(ComboItem, (void*)EDJE_ASPECT_PREFER_BOTH); //hbox hbox = etk_hbox_new(ETK_FALSE, 0); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_NONE, 0); label = etk_label_new("<b>Size</b> min"); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_StateMinWSpinner UI_StateMinWSpinner = etk_spinner_new(0, 2000, 0, 1, 10); etk_widget_size_request_set(UI_StateMinWSpinner, 45, 20); etk_box_append(ETK_BOX(hbox), UI_StateMinWSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); label = etk_label_new("x"); etk_object_properties_set(ETK_OBJECT(label), "xalign", 0.5, NULL); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_StateMinHSpinner UI_StateMinHSpinner = etk_spinner_new(0, 2000, 0, 1, 10); etk_widget_size_request_set(UI_StateMinHSpinner, 45, 20); etk_box_append(ETK_BOX(hbox), UI_StateMinHSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); label = etk_label_new("max"); etk_object_properties_set(ETK_OBJECT(label), "xalign", 1.0, NULL); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); //UI_StateMaxWSpinner UI_StateMaxWSpinner = etk_spinner_new(0, 2000, 0, 1, 10); etk_widget_size_request_set(UI_StateMaxWSpinner, 45, 20); etk_box_append(ETK_BOX(hbox), UI_StateMaxWSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); label = etk_label_new("x"); etk_object_properties_set(ETK_OBJECT(label), "xalign", 0.5, NULL); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_StateMaxHspinner UI_StateMaxHSpinner = etk_spinner_new(0, 2000, 0, 1, 10); etk_widget_size_request_set(UI_StateMaxHSpinner, 45, 20); etk_box_append(ETK_BOX(hbox), UI_StateMaxHSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); //hbox hbox = etk_hbox_new(ETK_FALSE, 0); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_StateAlignHSpinner label = etk_label_new("<b>Align</b> H"); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); UI_StateAlignHSpinner = etk_spinner_new(0, 1, 0, 0.01, 0.1); etk_spinner_digits_set(ETK_SPINNER(UI_StateAlignHSpinner), 2); etk_widget_size_request_set(UI_StateAlignHSpinner, 45, 20); etk_box_append(ETK_BOX(hbox), UI_StateAlignHSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_StateAlignVSpinner label = etk_label_new("V"); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); UI_StateAlignVSpinner = etk_spinner_new(0, 1, 0, 0.01, 0.1); etk_spinner_digits_set(ETK_SPINNER(UI_StateAlignVSpinner), 2); etk_widget_size_request_set(UI_StateAlignVSpinner, 45, 20); etk_box_append(ETK_BOX(hbox), UI_StateAlignVSpinner, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_StateVisibleCheck UI_StateVisibleCheck = etk_check_button_new_with_label("Visible"); etk_widget_padding_set(UI_StateVisibleCheck, 20, 0, 0, 0); etk_box_append(ETK_BOX(hbox), UI_StateVisibleCheck, ETK_BOX_START, ETK_BOX_NONE, 0); //hbox hbox = etk_hbox_new(ETK_FALSE, 0); etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_NONE, 0); //UI_StateCCEntry label = etk_label_new("Color Class"); etk_box_append(ETK_BOX(hbox), label, ETK_BOX_START, ETK_BOX_NONE, 0); UI_StateCCEntry = etk_entry_new(); etk_box_append(ETK_BOX(hbox), UI_StateCCEntry, ETK_BOX_START, ETK_BOX_NONE, 0); etk_signal_connect("key-down", ETK_OBJECT(UI_StateEntry), ETK_CALLBACK(_state_Entry_key_down_cb), NULL); etk_signal_connect("mouse-click", ETK_OBJECT(UI_StateEntryImage), ETK_CALLBACK(_state_EntryImage_clicked_cb), NULL); etk_signal_connect("text-changed", ETK_OBJECT(UI_StateEntry), ETK_CALLBACK(_group_NamesEntry_text_changed_cb), NULL); etk_signal_connect("value-changed", ETK_OBJECT(UI_AspectMinSpinner), ETK_CALLBACK(_state_AspectSpinner_value_changed_cb), NULL); etk_signal_connect("value-changed", ETK_OBJECT(UI_AspectMaxSpinner), ETK_CALLBACK(_state_AspectSpinner_value_changed_cb), NULL); etk_signal_connect("active-item-changed", ETK_OBJECT(UI_AspectComboBox), ETK_CALLBACK(_state_AspectComboBox_changed_cb), NULL); etk_signal_connect("value-changed", ETK_OBJECT(UI_StateMinWSpinner), ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL); etk_signal_connect("value-changed", ETK_OBJECT(UI_StateMinHSpinner), ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL); etk_signal_connect("value-changed", ETK_OBJECT(UI_StateMaxWSpinner), ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL); etk_signal_connect("value-changed", ETK_OBJECT(UI_StateMaxHSpinner), ETK_CALLBACK(_state_MinMaxSpinner_value_changed_cb), NULL); etk_signal_connect("value-changed", ETK_OBJECT(UI_StateAlignVSpinner), ETK_CALLBACK(_text_FontAlignSpinner_value_changed_cb), (void*)STATE_ALIGNV_SPINNER); etk_signal_connect("value-changed", ETK_OBJECT(UI_StateAlignHSpinner), ETK_CALLBACK(_text_FontAlignSpinner_value_changed_cb), (void*)STATE_ALIGNH_SPINNER); etk_signal_connect("toggled", ETK_OBJECT(UI_StateVisibleCheck), ETK_CALLBACK(_state_VisibleCheck_toggled_cb), NULL); etk_signal_connect("text-changed", ETK_OBJECT(UI_StateCCEntry), ETK_CALLBACK(_state_CCEntry_text_changed_cb), NULL); return vbox; }
void ew_image_edje_load(Entrance_Widget ew, const char *edje_filename, const char *edje_group) { etk_image_set_from_edje(ETK_IMAGE(ew->owner), edje_filename, edje_group); }
void ew_image_file_load(Entrance_Widget ew, const char *filename) { etk_image_set_from_file(ETK_IMAGE(ew->owner), filename, NULL); }
Etk_Widget* image_browser_create(void) { Etk_Widget *hbox, *vbox, *vbox2; Etk_Widget *button; Etk_Widget *frame; Etk_Widget *label; Etk_Widget *image; //ImageBrowserWin UI_ImageBrowserWin = etk_window_new(); etk_window_title_set(ETK_WINDOW(UI_ImageBrowserWin), "Image Browser"); etk_window_resize(ETK_WINDOW(UI_ImageBrowserWin), 590, 370); etk_signal_connect("delete-event", ETK_OBJECT(UI_ImageBrowserWin), ETK_CALLBACK(etk_window_hide_on_delete), NULL); etk_container_border_width_set(ETK_CONTAINER(UI_ImageBrowserWin), 5); hbox = etk_hbox_new(ETK_FALSE, 0); etk_container_add (ETK_CONTAINER(UI_ImageBrowserWin), hbox); //ImageBrowserIconbox UI_ImageBrowserIconbox = etk_iconbox_new(); etk_signal_connect("icon-selected", ETK_OBJECT(UI_ImageBrowserIconbox), ETK_CALLBACK(_image_browser_iconbox_selected_cb), NULL); etk_box_append(ETK_BOX(hbox), UI_ImageBrowserIconbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); vbox = etk_vbox_new(ETK_FALSE, 0); etk_box_append (ETK_BOX(hbox), vbox, ETK_BOX_START, ETK_BOX_NONE, 5); //AddImageButton button = etk_button_new_from_stock(ETK_STOCK_DOCUMENT_OPEN); etk_object_properties_set(ETK_OBJECT(button), "label","Import image",NULL); etk_button_style_set(ETK_BUTTON(button), ETK_BUTTON_BOTH_VERT); etk_signal_connect("clicked", ETK_OBJECT(button), ETK_CALLBACK(_window_all_button_click_cb), (void*)TOOLBAR_IMAGE_FILE_ADD); etk_box_append(ETK_BOX(vbox), button, ETK_BOX_START, ETK_BOX_NONE, 0); //DeleteImageButton button = etk_button_new_from_stock(ETK_STOCK_EDIT_DELETE); etk_object_properties_set(ETK_OBJECT(button), "label","Remove image",NULL); etk_button_style_set(ETK_BUTTON(button), ETK_BUTTON_BOTH_VERT); etk_widget_disabled_set(button, 1); etk_box_append(ETK_BOX(vbox), button, ETK_BOX_START, ETK_BOX_NONE, 0); //EditImageButton button = etk_button_new_with_label("Edit Image"); image = etk_image_new_from_edje(EdjeFile, "GIMP.PNG"); etk_button_image_set(ETK_BUTTON(button), ETK_IMAGE(image)); etk_button_style_set(ETK_BUTTON(button), ETK_BUTTON_BOTH_VERT); etk_widget_disabled_set(button, 1); etk_box_append(ETK_BOX(vbox), button, ETK_BOX_START, ETK_BOX_NONE, 0); //ImageInfo frame = etk_frame_new("Image Info"); etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 10); vbox2 = etk_vbox_new(ETK_FALSE, 0); etk_container_add(ETK_CONTAINER(frame), vbox2); label = etk_label_new("<b>name:</b>"); etk_box_append(ETK_BOX(vbox2), label, ETK_BOX_START, ETK_BOX_NONE, 0); label = etk_label_new("Unknow"); etk_box_append(ETK_BOX(vbox2), label, ETK_BOX_START, ETK_BOX_NONE, 0); label = etk_label_new(" "); etk_box_append(ETK_BOX(vbox2), label, ETK_BOX_START, ETK_BOX_NONE, 0); UI_ImageBrowserSizeLabel = etk_label_new("<b>size:</b> Unknow"); etk_object_properties_set(ETK_OBJECT(UI_ImageBrowserSizeLabel), "xalign", 0, NULL); etk_box_append(ETK_BOX(vbox2), UI_ImageBrowserSizeLabel, ETK_BOX_START, ETK_BOX_NONE, 0); label = etk_label_new("<b>comp:</b> Unknow"); etk_box_append(ETK_BOX(vbox2), label, ETK_BOX_START, ETK_BOX_NONE, 0); //CloseButton button = etk_button_new_from_stock(ETK_STOCK_DIALOG_CLOSE); etk_button_style_set(ETK_BUTTON(button), ETK_BUTTON_BOTH_VERT); etk_signal_connect("clicked", ETK_OBJECT(button), ETK_CALLBACK(_window_all_button_click_cb), (void*)IMAGE_BROWSER_CLOSE); etk_box_append(ETK_BOX(vbox), button, 0, ETK_BOX_NONE, 0); return UI_ImageBrowserWin; }
void emphasis_configgui_save(Emphasis_Config_Gui *configgui) { Emphasis_Config *config; char *key = NULL, *value = NULL; int reconnect = 0; config = config_load(); if((key = config->hostname)) { value = strdup(etk_entry_text_get(ETK_ENTRY(configgui->hostname))); if(strcmp(key,value)) { reconnect = 1; } free(config->hostname); } config->hostname = value; if((key = config->password)) { value = strdup(etk_entry_text_get(ETK_ENTRY(configgui->password))); if(!reconnect && strcmp(key,value)) { reconnect = 1; } free(config->password); } config->password = value; if(!reconnect && config->port != etk_range_value_get(ETK_RANGE(configgui->port))) { reconnect = 1; } config->port = etk_range_value_get(ETK_RANGE(configgui->port)); config->crossfade = etk_range_value_get(ETK_RANGE(configgui->xfade)); config->stop_on_exit = etk_toggle_button_active_get(ETK_TOGGLE_BUTTON(configgui->stop)); config->keep_aspect = etk_toggle_button_active_get(ETK_TOGGLE_BUTTON(configgui->aspect)); if(configgui->data) { etk_image_keep_aspect_set (ETK_IMAGE(((Emphasis_Gui*)configgui->data)->player->small.cover), config->keep_aspect); etk_image_keep_aspect_set (ETK_IMAGE(((Emphasis_Gui*)configgui->data)->player->full.cover), config->keep_aspect); } mpc_set_crossfade(config->crossfade); config_save(config); config_free(config); if(reconnect) { Emphasis_Gui *gui = configgui->data; emphasis_player_cover_set(gui->player, NULL); emphasis_player_progress_set(gui->player, 0.0, 0.001); mpc_disconnect(); } }