/** * init_view_raw_attr: * @view: * @raw_attr: * * TODO: Write me */ void init_view_raw_attr(CongAdvancedNodePropertiesView *view, struct RawAttr* raw_attr) { /* FIXME: use libglade for this... */ GtkWidget *vbox = gtk_vbox_new(FALSE, 6); GtkWidget *hbox = gtk_hbox_new(FALSE, 6); g_assert(view); g_assert(raw_attr); g_assert(cong_node_type(view->node)==CONG_NODE_TYPE_ELEMENT); raw_attr->category = cong_dialog_content_add_category(view->dialog_content, _("Raw Attributes")); raw_attr->list_store = GTK_LIST_STORE(gtk_list_store_new(RAW_ATTR_MODEL_NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING)); /* Initialise store: */ raw_attr_list_refresh(view, &view->raw_attr); /* Initialise treeview */ { GtkCellRenderer *renderer; GtkTreeViewColumn *column; raw_attr->tree_view = GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(raw_attr->list_store))); /* Build columns & renderers: */ renderer = gtk_cell_renderer_text_new(); g_object_set(G_OBJECT(renderer), "editable", TRUE, NULL); g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK(on_name_edited), view); column = gtk_tree_view_column_new_with_attributes( _("Name"), renderer, "text", RAW_ATTR_MODEL_COLUMN_NAME, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (raw_attr->tree_view), column); renderer = gtk_cell_renderer_text_new(); g_object_set(G_OBJECT(renderer), "editable", TRUE, NULL); g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK(on_value_edited), view); column = gtk_tree_view_column_new_with_attributes( _("Value"), renderer, "text", RAW_ATTR_MODEL_COLUMN_VALUE, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (raw_attr->tree_view), column); g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(raw_attr->tree_view)), "changed", G_CALLBACK(on_tree_view_selection_change), view); } /* Buttons to add and remove attributes: */ { GtkWidget *add_button = gtk_button_new_from_stock(GTK_STOCK_ADD); raw_attr->delete_button = gtk_button_new_from_stock(GTK_STOCK_DELETE); gtk_container_add(GTK_CONTAINER(hbox), add_button); gtk_container_add(GTK_CONTAINER(hbox), raw_attr->delete_button); gtk_widget_set_sensitive(raw_attr->delete_button, FALSE); g_signal_connect(G_OBJECT(add_button), "clicked", G_CALLBACK(on_add_attribute), view); g_signal_connect(G_OBJECT(raw_attr->delete_button), "clicked", G_CALLBACK(on_delete_attribute), view); gtk_widget_show(raw_attr->delete_button); gtk_widget_show(add_button); } gtk_container_add(GTK_CONTAINER(vbox), GTK_WIDGET(raw_attr->tree_view)); gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, TRUE, 0); gtk_widget_show(GTK_WIDGET(raw_attr->tree_view)); gtk_widget_show(hbox); gtk_widget_show(vbox); cong_dialog_category_add_selflabelled_field(raw_attr->category, vbox, TRUE); }
static void make_dtd_attribute_editor (CongDocument *doc, CongNodePtr node, xmlElementPtr xml_element, CongDialogContent *dialog_content) { xmlAttributePtr attr; CongDialogCategory *category; gchar *category_name; GtkWidget *scrolled_window; GtkWidget *vbox_attributes; GtkSizeGroup *size_group; { gchar *tag_name = cong_util_get_tag_string_for_node_escaped (node); category_name = g_strdup_printf ( _("Attributes for <tt>%s</tt> elements"), tag_name); g_free (tag_name); } category = cong_dialog_content_add_category (dialog_content, category_name); g_free (category_name); scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); cong_dialog_category_add_selflabelled_field (category, scrolled_window, TRUE); vbox_attributes = gtk_vbox_new (FALSE, 6); gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW(scrolled_window), vbox_attributes); size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); for (attr=xml_element->attributes; attr; attr=attr->nexth) { GtkWidget *hbox; GtkWidget *label; GtkWidget *attr_editor = cong_attribute_editor_new (doc, node, attr); gtk_widget_show (attr_editor); hbox = gtk_hbox_new(FALSE, 6); label = gtk_label_new ((const gchar*)attr->name); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_size_group_add_widget(size_group, label); gtk_container_add(GTK_CONTAINER(hbox), label); gtk_container_add(GTK_CONTAINER(hbox), attr_editor); gtk_widget_show (label); gtk_widget_show (hbox); gtk_box_pack_start (GTK_BOX(vbox_attributes), hbox, FALSE, TRUE, 0); } gtk_widget_show (vbox_attributes); gtk_widget_show (scrolled_window); }
static void _preferences_window(Camera * camera) { GtkWidget * dialog; GtkWidget * notebook; GtkWidget * vbox; GtkWidget * widget; GtkListStore * store; GtkTreeIter iter; GtkCellRenderer * renderer; const struct { GdkInterpType type; char const * name; } interp[] = { { GDK_INTERP_NEAREST, N_("Nearest") }, { GDK_INTERP_TILES, N_("Tiles") }, { GDK_INTERP_BILINEAR, N_("Bilinear") }, { GDK_INTERP_HYPER, N_("Hyperbolic") }, }; const struct { CameraSnapshotFormat format; char const * name; } sformats[CSF_COUNT - 1] = { { CSF_JPEG, "JPEG" }, { CSF_PNG, "PNG" } }; size_t i; dialog = gtk_dialog_new_with_buttons(_("Preferences"), GTK_WINDOW(camera->window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); camera->pr_window = dialog; g_signal_connect(dialog, "response", G_CALLBACK( _preferences_on_response), camera); notebook = gtk_notebook_new(); /* picture */ #if GTK_CHECK_VERSION(3, 0, 0) vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4); #else vbox = gtk_vbox_new(FALSE, 4); #endif camera->pr_hflip = gtk_check_button_new_with_mnemonic( _("Flip _horizontally")); gtk_box_pack_start(GTK_BOX(vbox), camera->pr_hflip, FALSE, TRUE, 0); camera->pr_vflip = gtk_check_button_new_with_mnemonic( _("Flip _vertically")); gtk_box_pack_start(GTK_BOX(vbox), camera->pr_vflip, FALSE, TRUE, 0); camera->pr_ratio = gtk_check_button_new_with_mnemonic( _("Keep aspect _ratio")); gtk_box_pack_start(GTK_BOX(vbox), camera->pr_ratio, FALSE, TRUE, 0); /* interpolation */ #if GTK_CHECK_VERSION(3, 0, 0) widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4); #else widget = gtk_hbox_new(FALSE, 4); #endif gtk_box_pack_start(GTK_BOX(widget), gtk_label_new(_("Interpolation: ")), FALSE, TRUE, 0); store = gtk_list_store_new(2, G_TYPE_UINT, G_TYPE_STRING); for(i = 0; i < sizeof(interp) / sizeof(*interp); i++) { gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, interp[i].type, 1, _(interp[i].name), -1); } camera->pr_interp = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); renderer = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(camera->pr_interp), renderer, TRUE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(camera->pr_interp), renderer, "text", 1, NULL); gtk_box_pack_start(GTK_BOX(widget), camera->pr_interp, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, TRUE, 0); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, gtk_label_new(_("Picture"))); /* snapshots */ #if GTK_CHECK_VERSION(3, 0, 0) vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4); #else vbox = gtk_vbox_new(FALSE, 4); #endif /* format */ #if GTK_CHECK_VERSION(3, 0, 0) widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4); #else widget = gtk_hbox_new(FALSE, 4); #endif gtk_box_pack_start(GTK_BOX(widget), gtk_label_new(_("Format: ")), FALSE, TRUE, 0); store = gtk_list_store_new(2, G_TYPE_UINT, G_TYPE_STRING); for(i = 0; i < sizeof(sformats) / sizeof(*sformats); i++) { gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, sformats[i].format, 1, sformats[i].name, -1); } camera->pr_sformat = gtk_combo_box_new_with_model( GTK_TREE_MODEL(store)); renderer = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(camera->pr_sformat), renderer, TRUE); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(camera->pr_sformat), renderer, "text", 1, NULL); gtk_box_pack_start(GTK_BOX(widget), camera->pr_sformat, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, TRUE, 0); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, gtk_label_new(_("Snapshots"))); #if GTK_CHECK_VERSION(2, 14, 0) vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); #else vbox = dialog->vbox; #endif gtk_box_set_spacing(GTK_BOX(vbox), 4); gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); gtk_widget_show_all(vbox); _preferences_cancel(camera); }
/* * ctk_xvideo_new() - constructor for the XVideo widget */ GtkWidget* ctk_xvideo_new(CtrlTarget *ctrl_target, CtkConfig *ctk_config, CtkEvent *ctk_event) { GObject *object; CtkXVideo *ctk_xvideo; GtkWidget *banner; GtkWidget *frame; GtkWidget *alignment; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *label; GtkWidget *hseparator; int xv_overlay_present, xv_texture_present, xv_blitter_present; int display_id; gboolean show_page; ReturnStatus ret; gchar *current_sync_name; /* * before we do anything else, determine if any of the Xv adapters * are present */ ret = NvCtrlGetAttribute(ctrl_target, NV_CTRL_ATTR_EXT_XV_OVERLAY_PRESENT, &xv_overlay_present); if (ret != NvCtrlSuccess) { xv_overlay_present = FALSE; } ret = NvCtrlGetAttribute(ctrl_target, NV_CTRL_ATTR_EXT_XV_TEXTURE_PRESENT, &xv_texture_present); if (ret != NvCtrlSuccess) { xv_texture_present = FALSE; } ret = NvCtrlGetAttribute(ctrl_target, NV_CTRL_ATTR_EXT_XV_BLITTER_PRESENT, &xv_blitter_present); if (ret != NvCtrlSuccess) { xv_blitter_present = FALSE; } if (!xv_overlay_present && !xv_texture_present && !xv_blitter_present) { return NULL; } /* If nothing to show, bail */ show_page = FALSE; if (xv_texture_present || xv_blitter_present) { ret = NvCtrlGetAttribute(ctrl_target, NV_CTRL_XV_SYNC_TO_DISPLAY_ID, &display_id); if (ret == NvCtrlSuccess) { show_page = TRUE; } } if (!show_page) { return NULL; } /* create the XVideo widget */ object = g_object_new(CTK_TYPE_XVIDEO, NULL); ctk_xvideo = CTK_XVIDEO(object); ctk_xvideo->ctrl_target = ctrl_target; ctk_xvideo->ctk_config = ctk_config; ctk_xvideo->active_attributes = 0; gtk_box_set_spacing(GTK_BOX(ctk_xvideo), 10); /* Video film banner */ banner = ctk_banner_image_new(BANNER_ARTWORK_XVIDEO); gtk_box_pack_start(GTK_BOX(object), banner, FALSE, FALSE, 0); /* Top Label */ hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(object), hbox, FALSE, FALSE, 0); label = gtk_label_new("Xvideo Settings"); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hseparator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(hbox), hseparator, TRUE, TRUE, 0); /* Current Sync Value */ ret = NvCtrlGetAttribute(ctrl_target, NV_CTRL_CURRENT_XV_SYNC_TO_DISPLAY_ID, &display_id); if (ret == NvCtrlSuccess) { hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(object), hbox, FALSE, FALSE, 5); label = gtk_label_new("Currently synced to display:"); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); label = gtk_label_new(""); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); current_sync_name = xv_sync_to_display_radio_button_label(ctk_xvideo, display_id); gtk_label_set_text(GTK_LABEL(label), current_sync_name); g_free(current_sync_name); ctk_xvideo->current_xv_sync_to_display_label = label; } else { ctk_xvideo->current_xv_sync_to_display_label = NULL; } /* Sync to display selection */ frame = gtk_frame_new("Sync to this display device"); gtk_box_pack_start(GTK_BOX(object), frame, FALSE, FALSE, 0); vbox = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(vbox), FRAME_PADDING); gtk_container_add(GTK_CONTAINER(frame), vbox); ctk_xvideo->xv_sync_to_display_button_box = vbox; ctk_config_set_tooltip(ctk_xvideo->ctk_config, ctk_xvideo->xv_sync_to_display_button_box, __xv_sync_to_display_help); xv_sync_to_display_rebuild_buttons(ctk_xvideo, FALSE); g_signal_connect(G_OBJECT(ctk_event), CTK_EVENT_NAME(NV_CTRL_XV_SYNC_TO_DISPLAY_ID), G_CALLBACK(xv_sync_to_display_id_handler), (gpointer) ctk_xvideo); if (ctk_xvideo->current_xv_sync_to_display_label) { g_signal_connect(G_OBJECT(ctk_event), CTK_EVENT_NAME(NV_CTRL_CURRENT_XV_SYNC_TO_DISPLAY_ID), G_CALLBACK(current_xv_sync_to_display_id_handler), (gpointer) ctk_xvideo); } g_signal_connect(G_OBJECT(ctk_event), CTK_EVENT_NAME(NV_CTRL_ENABLED_DISPLAYS), G_CALLBACK(enabled_displays_handler), (gpointer) ctk_xvideo); alignment = gtk_alignment_new(1, 1, 0, 0); gtk_box_pack_start(GTK_BOX(object), alignment, TRUE, TRUE, 0); /* finally, show the widget */ gtk_widget_show_all(GTK_WIDGET(ctk_xvideo)); return GTK_WIDGET(ctk_xvideo); }
/* camera_new */ Camera * camera_new(GtkWidget * window, GtkAccelGroup * group, char const * device) { Camera * camera; GtkWidget * vbox; GtkWidget * widget; GtkToolItem * toolitem; if((camera = object_new(sizeof(*camera))) == NULL) return NULL; camera->device = (device != NULL) ? string_new(device) : string_new("/dev/video0"); camera->hflip = FALSE; camera->vflip = FALSE; camera->ratio = TRUE; camera->interp = GDK_INTERP_BILINEAR; camera->snapshot_format = CSF_PNG; camera->snapshot_quality = 100; camera->source = 0; camera->fd = -1; memset(&camera->cap, 0, sizeof(camera->cap)); camera->channel = NULL; camera->buffers = NULL; camera->buffers_cnt = 0; camera->raw_buffer = NULL; camera->raw_buffer_cnt = 0; camera->rgb_buffer = NULL; camera->rgb_buffer_cnt = 0; camera->yuv_amp = 255; camera->overlays = NULL; camera->overlays_cnt = 0; camera->widget = NULL; camera->window = window; camera->bold = NULL; camera->gc = NULL; camera->pr_window = NULL; camera->pp_window = NULL; /* check for errors */ if(camera->device == NULL) { camera_delete(camera); return NULL; } /* create the window */ camera->bold = pango_font_description_new(); pango_font_description_set_weight(camera->bold, PANGO_WEIGHT_BOLD); camera->gc = gdk_gc_new(window->window); /* XXX */ #if GTK_CHECK_VERSION(3, 0, 0) camera->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); #else camera->widget = gtk_vbox_new(FALSE, 0); #endif vbox = camera->widget; /* toolbar */ widget = desktop_toolbar_create(_camera_toolbar, camera, group); gtk_widget_set_sensitive(GTK_WIDGET(_camera_toolbar[0].widget), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(_camera_toolbar[2].widget), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(_camera_toolbar[4].widget), FALSE); toolitem = gtk_tool_button_new_from_stock(GTK_STOCK_FULLSCREEN); g_signal_connect_swapped(toolitem, "clicked", G_CALLBACK( _camera_on_fullscreen), camera); gtk_toolbar_insert(GTK_TOOLBAR(widget), toolitem, -1); gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, TRUE, 0); #if GTK_CHECK_VERSION(2, 18, 0) /* infobar */ camera->infobar = gtk_info_bar_new_with_buttons(GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); gtk_info_bar_set_message_type(GTK_INFO_BAR(camera->infobar), GTK_MESSAGE_ERROR); g_signal_connect(camera->infobar, "close", G_CALLBACK(gtk_widget_hide), NULL); g_signal_connect(camera->infobar, "response", G_CALLBACK( gtk_widget_hide), NULL); widget = gtk_info_bar_get_content_area(GTK_INFO_BAR(camera->infobar)); camera->infobar_label = gtk_label_new(NULL); gtk_widget_show(camera->infobar_label); gtk_box_pack_start(GTK_BOX(widget), camera->infobar_label, TRUE, TRUE, 0); gtk_widget_set_no_show_all(camera->infobar, TRUE); gtk_box_pack_start(GTK_BOX(vbox), camera->infobar, FALSE, TRUE, 0); #endif camera->area = gtk_drawing_area_new(); camera->pixmap = NULL; g_signal_connect(camera->area, "configure-event", G_CALLBACK( _camera_on_drawing_area_configure), camera); g_signal_connect(camera->area, "expose-event", G_CALLBACK( _camera_on_drawing_area_expose), camera); gtk_box_pack_start(GTK_BOX(vbox), camera->area, TRUE, TRUE, 0); gtk_widget_show_all(vbox); camera_start(camera); return camera; }
int main(int argc, char *argv[]) { GtkWidget *window; GtkWidget *vbox; GtkWidget *menubar; GtkWidget *fileMenu; GtkWidget *imprMenu; GtkWidget *sep; GtkWidget *fileMi; GtkWidget *imprMi; GtkWidget *feedMi; GtkWidget *bookMi; GtkWidget *mailMi; GtkWidget *quitMi; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_window_set_default_size(GTK_WINDOW(window), 1024, 728); gtk_window_set_title(GTK_WINDOW(window), "Submenu"); vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(window), vbox); menubar = gtk_menu_bar_new(); fileMenu = gtk_menu_new(); fileMi = gtk_menu_item_new_with_label("File"); imprMenu = gtk_menu_new(); imprMi = gtk_menu_item_new_with_label("Importar"); feedMi = gtk_menu_item_new_with_label("Importar novos..."); bookMi = gtk_menu_item_new_with_label("Importar Favoritos..."); mailMi = gtk_menu_item_new_with_label("Importar Enviados..."); gtk_menu_item_set_submenu(GTK_MENU_ITEM(imprMi), imprMenu); gtk_menu_shell_append(GTK_MENU_SHELL(imprMenu), feedMi); gtk_menu_shell_append(GTK_MENU_SHELL(imprMenu), bookMi); gtk_menu_shell_append(GTK_MENU_SHELL(imprMenu), mailMi); sep = gtk_separator_menu_item_new(); quitMi = gtk_menu_item_new_with_label("Sair"); gtk_menu_item_set_submenu(GTK_MENU_ITEM(fileMi), fileMenu); gtk_menu_shell_append(GTK_MENU_SHELL(fileMenu), imprMi); gtk_menu_shell_append(GTK_MENU_SHELL(fileMenu), sep); gtk_menu_shell_append(GTK_MENU_SHELL(fileMenu), quitMi); gtk_menu_shell_append(GTK_MENU_SHELL(menubar), fileMi); gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(G_OBJECT(quitMi), "activate", G_CALLBACK(gtk_main_quit), NULL); gtk_widget_show_all(window); gtk_main(); return 0; }
HeaderView *headerview_create(void) { HeaderView *headerview; GtkWidget *hbox; GtkWidget *vbox; GtkWidget *hbox1; GtkWidget *hbox2; GtkWidget *hbox3; GtkWidget *from_header_label; GtkWidget *from_body_label; GtkWidget *to_header_label; GtkWidget *to_body_label; GtkWidget *ng_header_label; GtkWidget *ng_body_label; GtkWidget *subject_header_label; GtkWidget *subject_body_label; GtkWidget *tags_header_label; GtkWidget *tags_body_label; debug_print("Creating header view...\n"); headerview = g_new0(HeaderView, 1); hbox = gtk_hbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox), 2); vbox = gtk_vbox_new(FALSE, 2); gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); hbox1 = gtk_hbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 0); hbox2 = gtk_hbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0); hbox3 = gtk_hbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(vbox), hbox3, FALSE, FALSE, 0); from_header_label = gtk_label_new(prefs_common_translated_header_name("From:")); from_body_label = gtk_label_new(""); to_header_label = gtk_label_new(prefs_common_translated_header_name("To:")); to_body_label = gtk_label_new(""); ng_header_label = gtk_label_new(prefs_common_translated_header_name("Newsgroups:")); ng_body_label = gtk_label_new(""); subject_header_label = gtk_label_new(prefs_common_translated_header_name("Subject:")); subject_body_label = gtk_label_new(""); tags_header_label = gtk_label_new(_("Tags:")); tags_body_label = gtk_label_new(""); gtk_label_set_selectable(GTK_LABEL(from_body_label), TRUE); gtk_label_set_selectable(GTK_LABEL(to_body_label), TRUE); gtk_label_set_selectable(GTK_LABEL(ng_body_label), TRUE); gtk_label_set_selectable(GTK_LABEL(subject_body_label), TRUE); gtk_label_set_selectable(GTK_LABEL(tags_body_label), TRUE); gtkut_widget_set_can_focus(from_body_label, FALSE); gtkut_widget_set_can_focus(to_body_label, FALSE); gtkut_widget_set_can_focus(ng_body_label, FALSE); gtkut_widget_set_can_focus(subject_body_label, FALSE); gtkut_widget_set_can_focus(tags_body_label, FALSE); gtk_box_pack_start(GTK_BOX(hbox1), from_header_label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox1), from_body_label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox1), to_header_label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox1), to_body_label, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox1), ng_header_label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox1), ng_body_label, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox2), subject_header_label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox2), subject_body_label, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox3), tags_header_label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox3), tags_body_label, TRUE, TRUE, 0); gtk_misc_set_alignment(GTK_MISC(to_body_label), 0, 0.5); gtk_misc_set_alignment(GTK_MISC(ng_body_label), 0, 0.5); gtk_misc_set_alignment(GTK_MISC(subject_body_label), 0, 0.5); gtk_misc_set_alignment(GTK_MISC(tags_body_label), 0, 0.5); gtk_label_set_ellipsize(GTK_LABEL(to_body_label), PANGO_ELLIPSIZE_END); gtk_label_set_ellipsize(GTK_LABEL(ng_body_label), PANGO_ELLIPSIZE_END); gtk_label_set_ellipsize(GTK_LABEL(subject_body_label), PANGO_ELLIPSIZE_END); gtk_label_set_ellipsize(GTK_LABEL(tags_body_label), PANGO_ELLIPSIZE_END); headerview->hbox = hbox; headerview->from_header_label = from_header_label; headerview->from_body_label = from_body_label; headerview->to_header_label = to_header_label; headerview->to_body_label = to_body_label; headerview->ng_header_label = ng_header_label; headerview->ng_body_label = ng_body_label; headerview->subject_header_label = subject_header_label; headerview->subject_body_label = subject_body_label; headerview->tags_header_label = tags_header_label; headerview->tags_body_label = tags_body_label; headerview->image = NULL; gtk_widget_show_all(hbox); return headerview; }
void DisplayDialog() { int return_value; GtkWidget *dialog; GtkWidget *main_frame, *main_box; GtkWidget *mixing_frame, *mixing_box; GtkWidget *int_label, *int_box; GtkWidget *effects_check; GtkWidget *dealias_filter; GtkWidget *debug_check; GtkWidget *debug_button; GtkWidget *output_frame, *output_box; GtkWidget *mod_label, *mod_box; GtkWidget *api_label, *api_box; #if SDL_MAJOR_VERSION >= 2 GtkWidget *sdl_api_label, *sdl_api_box; #endif GtkWidget *latency_label, *latency_slide; GtkWidget *sync_label, *sync_box; GtkWidget *advanced_button; /* Create the widgets */ dialog = gtk_dialog_new_with_buttons ( "SPU2-X Config", NULL, /* parent window*/ (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT), "OK", GTK_RESPONSE_ACCEPT, "Cancel", GTK_RESPONSE_REJECT, NULL); int_label = gtk_label_new ("Interpolation:"); int_box = gtk_combo_box_text_new (); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(int_box), "0 - Nearest (fastest/bad quality)"); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(int_box), "1 - Linear (simple/okay sound)"); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(int_box), "2 - Cubic (artificial highs)"); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(int_box), "3 - Hermite (better highs)"); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(int_box), "4 - Catmull-Rom (PS2-like/slow)"); gtk_combo_box_set_active(GTK_COMBO_BOX(int_box), Interpolation); effects_check = gtk_check_button_new_with_label("Disable Effects Processing"); dealias_filter = gtk_check_button_new_with_label("Use the de-alias filter (overemphasizes the highs)"); debug_check = gtk_check_button_new_with_label("Enable Debug Options"); debug_button = gtk_button_new_with_label("Debug..."); mod_label = gtk_label_new ("Module:"); mod_box = gtk_combo_box_text_new (); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mod_box), "0 - No Sound (emulate SPU2 only)"); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mod_box), "1 - PortAudio (cross-platform)"); #ifdef __linux__ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mod_box), "2 - SDL Audio (recommended for PulseAudio)"); #endif //gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mod_box), "3 - Alsa (probably doesn't work)"); gtk_combo_box_set_active(GTK_COMBO_BOX(mod_box), OutputModule); api_label = gtk_label_new ("PortAudio API:"); api_box = gtk_combo_box_text_new (); #ifdef __linux__ // In order to keep it the menu light, I only put linux major api gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(api_box), "0 - ALSA (recommended)"); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(api_box), "1 - OSS (legacy)"); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(api_box), "2 - JACK"); #else gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(api_box), "OSS"); #endif gtk_combo_box_set_active(GTK_COMBO_BOX(api_box), OutputAPI); #if SDL_MAJOR_VERSION >= 2 sdl_api_label = gtk_label_new ("SDL API:"); sdl_api_box = gtk_combo_box_text_new (); // YES It sucks ... for (int i = 0; i < SDL_GetNumAudioDrivers(); ++i) { gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(sdl_api_box), SDL_GetAudioDriver(i)); } gtk_combo_box_set_active(GTK_COMBO_BOX(sdl_api_box), SdlOutputAPI); #endif latency_label = gtk_label_new ("Latency:"); #if GTK_MAJOR_VERSION < 3 latency_slide = gtk_hscale_new_with_range(LATENCY_MIN, LATENCY_MAX, 5); #else latency_slide = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, LATENCY_MIN, LATENCY_MAX, 5); #endif gtk_range_set_value(GTK_RANGE(latency_slide), SndOutLatencyMS); sync_label = gtk_label_new ("Synchronization Mode:"); sync_box = gtk_combo_box_text_new (); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(sync_box), "TimeStretch (Recommended)"); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(sync_box), "Async Mix (Breaks some games!)"); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(sync_box), "None (Audio can skip.)"); gtk_combo_box_set_active(GTK_COMBO_BOX(sync_box), SynchMode); advanced_button = gtk_button_new_with_label("Advanced..."); main_box = gtk_hbox_new(false, 5); main_frame = gtk_frame_new ("SPU2-X Config"); gtk_container_add (GTK_CONTAINER(main_frame), main_box); mixing_box = gtk_vbox_new(false, 5); mixing_frame = gtk_frame_new ("Mixing Settings:"); gtk_container_add (GTK_CONTAINER(mixing_frame), mixing_box); output_box = gtk_vbox_new(false, 5); output_frame = gtk_frame_new ("Output Settings:"); gtk_container_add (GTK_CONTAINER(output_frame), output_box); gtk_container_add(GTK_CONTAINER(mixing_box), int_label); gtk_container_add(GTK_CONTAINER(mixing_box), int_box); gtk_container_add(GTK_CONTAINER(mixing_box), effects_check); gtk_container_add(GTK_CONTAINER(mixing_box), dealias_filter); gtk_container_add(GTK_CONTAINER(mixing_box), debug_check); gtk_container_add(GTK_CONTAINER(mixing_box), debug_button); gtk_container_add(GTK_CONTAINER(output_box), mod_label); gtk_container_add(GTK_CONTAINER(output_box), mod_box); gtk_container_add(GTK_CONTAINER(output_box), api_label); gtk_container_add(GTK_CONTAINER(output_box), api_box); #if SDL_MAJOR_VERSION >= 2 gtk_container_add(GTK_CONTAINER(output_box), sdl_api_label); gtk_container_add(GTK_CONTAINER(output_box), sdl_api_box); #endif gtk_container_add(GTK_CONTAINER(output_box), sync_label); gtk_container_add(GTK_CONTAINER(output_box), sync_box); gtk_container_add(GTK_CONTAINER(output_box), latency_label); gtk_container_add(GTK_CONTAINER(output_box), latency_slide); gtk_container_add(GTK_CONTAINER(output_box), advanced_button); gtk_container_add(GTK_CONTAINER(main_box), mixing_frame); gtk_container_add(GTK_CONTAINER(main_box), output_frame); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(effects_check), EffectsDisabled); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dealias_filter), postprocess_filter_dealias); //FinalVolume; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(debug_check), DebugEnabled); gtk_container_add (GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), main_frame); gtk_widget_show_all (dialog); g_signal_connect_swapped(advanced_button, "clicked", G_CALLBACK(advanced_dialog), advanced_button); g_signal_connect_swapped(debug_button, "clicked", G_CALLBACK(debug_dialog), debug_button); return_value = gtk_dialog_run (GTK_DIALOG (dialog)); if (return_value == GTK_RESPONSE_ACCEPT) { DebugEnabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(debug_check)); postprocess_filter_dealias = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dealias_filter)); if (gtk_combo_box_get_active(GTK_COMBO_BOX(int_box)) != -1) Interpolation = gtk_combo_box_get_active(GTK_COMBO_BOX(int_box)); EffectsDisabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(effects_check)); //FinalVolume; if (gtk_combo_box_get_active(GTK_COMBO_BOX(mod_box)) != -1) OutputModule = gtk_combo_box_get_active(GTK_COMBO_BOX(mod_box)); if (gtk_combo_box_get_active(GTK_COMBO_BOX(api_box)) != -1) { OutputAPI = gtk_combo_box_get_active(GTK_COMBO_BOX(api_box)); #ifdef __linux__ switch(OutputAPI) { case 0: PortaudioOut->SetApiSettings(L"ALSA"); break; case 1: PortaudioOut->SetApiSettings(L"OSS"); break; case 2: PortaudioOut->SetApiSettings(L"JACK"); break; default: PortaudioOut->SetApiSettings(L"Unknown"); } #else switch(OutputAPI) { case 0: PortaudioOut->SetApiSettings(L"OSS"); break; default: PortaudioOut->SetApiSettings(L"Unknown"); } #endif } #if SDL_MAJOR_VERSION >= 2 if (gtk_combo_box_get_active(GTK_COMBO_BOX(sdl_api_box)) != -1) { SdlOutputAPI = gtk_combo_box_get_active(GTK_COMBO_BOX(sdl_api_box)); // YES It sucks ... SDLOut->SetApiSettings(wxString(SDL_GetAudioDriver(SdlOutputAPI), wxConvUTF8)); } #endif SndOutLatencyMS = gtk_range_get_value(GTK_RANGE(latency_slide)); if (gtk_combo_box_get_active(GTK_COMBO_BOX(sync_box)) != -1) SynchMode = gtk_combo_box_get_active(GTK_COMBO_BOX(sync_box)); } gtk_widget_destroy (dialog); }
static void jana_gtk_recurrence_init (JanaGtkRecurrence *self) { GtkWidget *label, *hbox, *sub_hbox, *arrow, *button; GtkSizeGroup *size_group; JanaGtkRecurrencePrivate *priv = RECURRENCE_PRIVATE (self); gtk_box_set_spacing (GTK_BOX (self), 6); /* Create preview text-view */ priv->preview_frame = gtk_frame_new (NULL); priv->preview_textview = gtk_text_view_new (); gtk_text_view_set_editable (GTK_TEXT_VIEW ( priv->preview_textview), FALSE); gtk_text_view_set_cursor_visible ( GTK_TEXT_VIEW (priv->preview_textview), FALSE); gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (priv->preview_textview), GTK_WRAP_WORD_CHAR); gtk_container_add (GTK_CONTAINER (priv->preview_frame), priv->preview_textview); gtk_box_pack_end (GTK_BOX (self), priv->preview_frame, TRUE, TRUE, 0); gtk_frame_set_shadow_type ( GTK_FRAME (priv->preview_frame), GTK_SHADOW_NONE); gtk_widget_show_all (priv->preview_frame); priv->edit_vbox = gtk_vbox_new (FALSE, 6); size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); /* 'Repeats' (recurrence type) combo box */ hbox = gtk_hbox_new (FALSE, 6); label = gtk_label_new ("Repeats:"); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_size_group_add_widget (size_group, label); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0); priv->type_combo = gtk_combo_box_new_text (); gtk_combo_box_append_text (GTK_COMBO_BOX (priv->type_combo), "None"); gtk_combo_box_append_text (GTK_COMBO_BOX (priv->type_combo), "Every day"); gtk_combo_box_append_text (GTK_COMBO_BOX (priv->type_combo), "Every week"); gtk_combo_box_append_text (GTK_COMBO_BOX (priv->type_combo), "Every year"); gtk_combo_box_set_active (GTK_COMBO_BOX (priv->type_combo), 0); gtk_box_pack_start (GTK_BOX (hbox), priv->type_combo, TRUE, TRUE, 0); g_signal_connect (priv->type_combo, "changed", G_CALLBACK (type_combo_changed_cb), self); /* Interval buttons */ sub_hbox = gtk_hbox_new (TRUE, 0); priv->interval_dec_button = gtk_button_new (); arrow = gtk_arrow_new (GTK_ARROW_LEFT, GTK_SHADOW_IN); gtk_container_add (GTK_CONTAINER (priv->interval_dec_button), arrow); gtk_box_pack_start (GTK_BOX (sub_hbox), priv->interval_dec_button, FALSE, TRUE, 0); priv->interval_inc_button = gtk_button_new (); arrow = gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_IN); gtk_container_add (GTK_CONTAINER (priv->interval_inc_button), arrow); gtk_box_pack_start (GTK_BOX (sub_hbox), priv->interval_inc_button, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), sub_hbox, FALSE, TRUE, 0); g_signal_connect (priv->interval_inc_button, "clicked", G_CALLBACK (interval_inc_clicked_cb), self); g_signal_connect (priv->interval_dec_button, "clicked", G_CALLBACK (interval_dec_clicked_cb), self); gtk_widget_show_all (hbox); gtk_box_pack_start (GTK_BOX (priv->edit_vbox), hbox, FALSE, TRUE, 0); /* Weekly recurrence day-chooser */ priv->week_hbox = gtk_hbox_new (FALSE, 6); label = gtk_label_new ("On:"); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_size_group_add_widget (size_group, label); gtk_box_pack_start (GTK_BOX (priv->week_hbox), label, FALSE, TRUE, 0); sub_hbox = gtk_hbox_new (TRUE, 0); /* Weekday toggle widgets */ #define day_toggle_widget(x) \ button = gtk_toggle_button_new_with_label (jana_utils_ab_day (x)); \ gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE); \ gtk_box_pack_start (GTK_BOX (sub_hbox), button, TRUE, TRUE, 0); \ priv->week_buttons[x] = GTK_TOGGLE_BUTTON (button); \ g_signal_connect (button, "toggled", \ G_CALLBACK (day##x##_toggled_cb), self) day_toggle_widget(0); day_toggle_widget(1); day_toggle_widget(2); day_toggle_widget(3); day_toggle_widget(4); day_toggle_widget(5); day_toggle_widget(6); gtk_box_pack_start (GTK_BOX (priv->week_hbox), sub_hbox, TRUE, TRUE, 0); gtk_widget_show_all (priv->week_hbox); gtk_box_pack_start (GTK_BOX (priv->edit_vbox), priv->week_hbox, FALSE, TRUE, 0); /* Monthly recurrence by date/day chooser */ priv->month_hbox = gtk_hbox_new (FALSE, 6); label = gtk_label_new ("By:"); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_size_group_add_widget (size_group, label); gtk_box_pack_start (GTK_BOX (priv->month_hbox), label, FALSE, TRUE, 0); sub_hbox = gtk_hbox_new (TRUE, 0); /* By day */ priv->byday_button = GTK_TOGGLE_BUTTON ( gtk_radio_button_new_with_label (NULL, "Day")); gtk_toggle_button_set_mode (priv->byday_button, FALSE); gtk_box_pack_start (GTK_BOX (sub_hbox), GTK_WIDGET ( priv->byday_button), FALSE, TRUE, 0); /* By date */ priv->bydate_button = GTK_TOGGLE_BUTTON ( gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON (priv->byday_button), "Date")); gtk_toggle_button_set_mode (priv->bydate_button, FALSE); g_signal_connect (priv->bydate_button, "toggled", G_CALLBACK (bydate_toggled_cb), self); gtk_box_pack_start (GTK_BOX (sub_hbox), GTK_WIDGET ( priv->bydate_button), FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (priv->month_hbox), sub_hbox, FALSE, TRUE, 0); gtk_widget_show_all (priv->month_hbox); gtk_box_pack_start (GTK_BOX (priv->edit_vbox), priv->month_hbox, FALSE, TRUE, 0); /* Until time editor */ priv->end_hbox = gtk_hbox_new (FALSE, 6); label = gtk_label_new ("Until:"); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_size_group_add_widget (size_group, label); gtk_box_pack_start (GTK_BOX (priv->end_hbox), label, FALSE, TRUE, 0); priv->end_button = gtk_button_new (); hbox = gtk_hbox_new (FALSE, 6); priv->end_label = gtk_label_new (NULL); arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (hbox), priv->end_label, TRUE, TRUE, 0); gtk_box_pack_end (GTK_BOX (hbox), arrow, FALSE, TRUE, 0); gtk_container_add (GTK_CONTAINER (priv->end_button), hbox); g_signal_connect (priv->end_button, "clicked", G_CALLBACK (end_clicked_cb), self); gtk_box_pack_start (GTK_BOX (priv->end_hbox), priv->end_button, FALSE, TRUE, 0); gtk_widget_show_all (priv->end_hbox); gtk_box_pack_start (GTK_BOX (priv->edit_vbox), priv->end_hbox, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (self), priv->edit_vbox, FALSE, TRUE, 0); gtk_widget_set_no_show_all (priv->edit_vbox, TRUE); gtk_widget_set_no_show_all (priv->preview_frame, TRUE); refresh (self); }