/* Callback for the bar operations */ static gboolean item_event_help (GooCanvasItem *item, GooCanvasItem *target, GdkEventButton *event, gchar *data) { gc_sound_play_ogg ("sounds/bleep.wav", NULL); if(!strcmp((char *)data, "ok")) { gc_help_stop(); } else if(!strcmp((char *)data, "prerequisite")) { select_item(item_prerequisite, item_prerequisite_text); set_content(prerequisite); } else if(!strcmp((char *)data, "goal")) { select_item(item_goal, item_goal_text); set_content(goal); } else if(!strcmp((char *)data, "manual")) { select_item(item_manual, item_manual_text); set_content(manual); } else if(!strcmp((char *)data, "credit")) { select_item(item_credit, item_credit_text); set_content(credit); } return TRUE; }
void BinaryDataEditor::setup() { set_title("Edit Data"); set_content(&_box); _box.set_padding(12); _box.set_spacing(12); _box.add(&_tab_view, true, true); _box.add(&_length_text, false, true); _box.add(&_hbox, false, true); _hbox.add(&_export, false, true); if (!_read_only) _hbox.add(&_import, false, true); if (!_read_only) _hbox.add_end(&_save, false, true); _hbox.add_end(&_close, false, true); _hbox.set_spacing(12); _save.set_text("Apply"); _close.set_text("Close"); _export.set_text("Save..."); _import.set_text("Load..."); scoped_connect(_tab_view.signal_tab_changed(),boost::bind(&BinaryDataEditor::tab_changed, this)); scoped_connect(_save.signal_clicked(),boost::bind(&BinaryDataEditor::save, this)); scoped_connect(_close.signal_clicked(),boost::bind(&BinaryDataEditor::close, this)); scoped_connect(_import.signal_clicked(),boost::bind(&BinaryDataEditor::import_value, this)); scoped_connect(_export.signal_clicked(),boost::bind(&BinaryDataEditor::export_value, this)); set_size(800, 500); // Golden ratio. center(); }
void init_content(t_env *env, char *filename) { int fd; int content; char *line; content = 0; fd = open(filename, O_RDONLY); if (fd >= 0) { while (get_next_line(fd, &line)) { if (content == 2 && !ft_strcmp(line, "]")) content = 3; if (content == 2) set_content(env, line); if (!ft_strcmp(line, "content")) content = 1; if (content && !ft_strcmp(line, "[")) content = 2; } close(fd); free(line); } }
void FolderPost::Serialize(Json::Value& root) { Json::Value folder(Json::objectValue); folder["foldername"] = folder_.foldername(); folder["parent_post"] = folder_.parent_post_id(); set_content("folder", folder); Post::Serialize(root); }
static int copy_content(const struct sol_memdesc *desc, const void *src_memory, void *dst_memory) { if (desc->ops && desc->ops->copy) return desc->ops->copy(desc, src_memory, dst_memory); return set_content(desc, dst_memory, src_memory); }
thread_specific_base::thread_specific_base() { m_Key.as_dword = TlsAlloc(); if (m_Key.as_dword == TLS_OUT_OF_INDEXES) { BOOST_LOG_THROW_DESCR(system_error, "TLS capacity depleted"); } set_content(0); }
Elis::UI::Line Elis::UI::Window::new_line(const char *c) { auto line = Elis::UI::Line(lines->size() + 1); line.set_content(std::string(c)); lines->push_front(line); return line; }
void Date_::deserialize(ifstream& reader) { int size = read_int_from_file(reader); char* to_read = new char[size + 1]; reader.read(to_read, size); to_read[size] = '\0'; field_name = to_read; current_date->deserialize(reader); set_content(current_date->to_string()); }
int jester::parse_options(int argc, char *argv[]) { static const struct option longopts[] = {{"method", required_argument, NULL, 'm'}, {"uri", required_argument, NULL, 'u'}, {"data", required_argument, NULL, 'd'}, {"interactive", no_argument, NULL, 'i'}, {"content", required_argument, NULL, 'c'}, {"header", required_argument, NULL, 'h'}, {NULL, 0, NULL, 0}}; int opt; std::shared_ptr<jest::arg_pair> pair; while ((opt = getopt_long(argc, argv, "u:m:d:ih:", longopts, NULL)) != -1) { switch (opt) { case 'u': set_uri(optarg); break; case 'm': if (!set_method(optarg)) { printf("Unknown HTTP method %s\n", optarg); return EXIT_FAILURE; } break; case 'd': pair = jest::split_arg(optarg, "="); if (!pair) { printf("Data should be in key=value format."); return EXIT_FAILURE; } append_data(*pair); break; case 'c': set_content(optarg); break; case 'i': set_interactive(true); break; case 'h': pair = jest::split_arg(optarg, ":"); if (!pair) { printf("header should be in key:value format."); return EXIT_FAILURE; } append_header(*pair); break; default: syntax(argv[0]); return EXIT_FAILURE; } } return EXIT_SUCCESS; }
static inline int set_content(const struct sol_memdesc *desc, void *mem, const void *ptr_content) { if (desc->ops && desc->ops->set_content) return desc->ops->set_content(desc, mem, ptr_content); if (desc->type == SOL_MEMDESC_TYPE_STRING) { const char *const *pv = ptr_content; int r = sol_util_replace_str_if_changed(mem, *pv); if (r >= 0) return 0; return r; } else if (desc->type == SOL_MEMDESC_TYPE_PTR && desc->pointed_item) { const void *const *pv = ptr_content; void **m = mem; if (!*m && *pv) { *m = sol_memdesc_new_with_defaults(desc->pointed_item); if (!*m) return -errno; } else if (*m && !*pv) { sol_memdesc_free(desc->pointed_item, *m); *m = NULL; return 0; } else if (!*pv) return 0; return set_content(desc->pointed_item, *m, *pv); } else if (desc->type == SOL_MEMDESC_TYPE_STRUCTURE) { if (!desc->structure_members) { SOL_WRN("desc=%p is SOL_MEMDESC_TYPE_STRUCTURE but does not provide structure_members", desc); return -EINVAL; } return copy_structure(desc, mem, ptr_content); } else if (desc->type == SOL_MEMDESC_TYPE_ARRAY) { if (!desc->array_item) { SOL_WRN("desc=%p is SOL_MEMDESC_TYPE_ARRAY but does not provide array_item", desc); return -EINVAL; } return copy_array(desc, mem, ptr_content); } memcpy(mem, ptr_content, sol_memdesc_get_size(desc)); return 0; }
DocumentPropertiesForm::DocumentPropertiesForm(wb::WBContextUI *wbui) : Form(NULL, mforms::FormResizable), _bottom_box(true), _text(mforms::BothScrollBars) { _wbui= wbui; set_title(_("Document Properties")); set_name("document_properties"); set_content(&_table); _table.set_padding(TOP_FORM_PADDING); _table.set_row_spacing(8); _table.set_column_spacing(4); _table.set_row_count(8); _table.set_column_count(2); add_control(_("Name:"), &_entry1); add_control(_("Version:"), &_entry2); add_control(_("Author:"), &_entry3); add_control(_("Project:"), &_entry4); add_control(_("Created:"), &_entry5); add_control(_("Last Changed:"), &_entry6); add_control(_("Description:"), &_text, true); _entry5.set_enabled(false); _entry6.set_enabled(false); _table.add(&_bottom_box, 0, 2, 7, 8, mforms::HFillFlag); _bottom_box.set_spacing(8); scoped_connect(_ok_button.signal_clicked(),boost::bind(&DocumentPropertiesForm::ok_clicked, this)); scoped_connect(_cancel_button.signal_clicked(),boost::bind(&DocumentPropertiesForm::cancel_clicked, this)); _ok_button.enable_internal_padding(true); _cancel_button.enable_internal_padding(true); _bottom_box.add_end(&_ok_button, false, true); _ok_button.set_text(_(" OK ")); _bottom_box.add_end(&_cancel_button, false, true); _cancel_button.set_text(_("Cancel")); set_size(400, 400); center(); pull_values(); }
void AudioCode::updateValues(QString &field, QString &value) { if(field == "audio_format") { set_audio_format(value); } else if(field == "audio_bitrate_Kb") { set_audio_bitrate_Kb(value); } else if(field == "channel") { set_channel(value); } else if(field == "content") { set_content(value); } else if(field == "encryption") { set_encryption(value); } else if(field == "language_code") { set_language_code(value); } else if(field == "sampling") { set_sampling(value); } }
void gen_cell::remove_content(){ set_content(0); }
Date_::Date_(){ current_date = new date(); set_content(current_date->to_string()); };
Date_::Date_(date*& value) { set_date(value); set_content(current_date->to_string()); }
void gc_help_start (GcomprisBoard *gcomprisBoard) { gchar *item_id = "#UP"; GooCanvasItem *item; gint y = 0; gint y_start = 0; gint x_start = 0; gchar *name = NULL; gchar *text_to_display = NULL; if(rootitem) return; gc_board_pause(TRUE); caller_cursor = gc_cursor_get(); gc_cursor_set(GCOMPRIS_DEFAULT_CURSOR); item_selected = NULL; item_selected_text = NULL; name = gcomprisBoard->title; gc_help_has_board(gcomprisBoard); rootitem = goo_canvas_group_new (goo_canvas_get_root_item(gc_get_canvas()), NULL); item = goo_canvas_svg_new (rootitem, gc_skin_rsvg_get(), "svg-id", "#DIALOG", "pointer-events", GOO_CANVAS_EVENTS_NONE, NULL); GooCanvasBounds bounds; guint pixmap_width = 40; goo_canvas_item_get_bounds(item, &bounds); x_start = bounds.x1; y_start = bounds.y1; y = bounds.y2 - 26; y_start += 15; if(gcomprisBoard->section && gcomprisBoard->name) { text_to_display = g_strdup_printf("%s/%s", gcomprisBoard->section, gcomprisBoard->name); goo_canvas_text_new (rootitem, text_to_display, BOARDWIDTH*0.10, y_start, -1, GTK_ANCHOR_NW, "font", gc_skin_font_board_tiny, "fill-color-rgba", gc_skin_color_title, NULL); g_free(text_to_display); } y_start += 30; goo_canvas_text_new (rootitem, name, BOARDWIDTH/2, y_start, -1, GTK_ANCHOR_CENTER, "font", gc_skin_font_title, "fill-color-rgba", gc_skin_color_title, NULL); y_start += 80; // Prerequisite Button if(prerequisite) { item_prerequisite = goo_canvas_svg_new (rootitem, gc_skin_rsvg_get(), "svg-id", item_id, NULL); SET_ITEM_LOCATION(item_prerequisite, (BOARDWIDTH*0.2) - pixmap_width/2, y_start - 10) g_signal_connect(item_prerequisite, "button_press_event", (GtkSignalFunc) item_event_help, "prerequisite"); gc_item_focus_init(item_prerequisite, NULL); item_prerequisite_text = \ goo_canvas_text_new (rootitem, _("Prerequisite"), BOARDWIDTH*0.20, y_start + GAP_TO_BUTTON, -1, GTK_ANCHOR_CENTER, "font", gc_skin_font_content, "fill-color-rgba", gc_skin_get_color("gcompris/helpunselect"), NULL); g_signal_connect(item_prerequisite_text, "button_press_event", (GtkSignalFunc) item_event_help, "prerequisite"); } // Goal Button if(goal) { item_goal = goo_canvas_svg_new (rootitem, gc_skin_rsvg_get(), "svg-id", item_id, NULL); SET_ITEM_LOCATION(item_goal, (BOARDWIDTH*0.4) - pixmap_width/2, y_start - 10); g_signal_connect(item_goal, "button_press_event", (GtkSignalFunc) item_event_help, "goal"); gc_item_focus_init(item_goal, NULL); item_goal_text = goo_canvas_text_new (rootitem, _("Goal"), BOARDWIDTH*0.4, y_start + GAP_TO_BUTTON, -1, GTK_ANCHOR_CENTER, "font", gc_skin_font_content, "fill-color-rgba", gc_skin_get_color("gcompris/helpunselect"), NULL); g_signal_connect(item_goal_text, "button_press_event", (GtkSignalFunc) item_event_help, "goal"); } // Manual Button if(manual) { item_manual = goo_canvas_svg_new (rootitem, gc_skin_rsvg_get(), "svg-id", item_id, NULL); SET_ITEM_LOCATION(item_manual, (BOARDWIDTH*0.6) - pixmap_width/2, y_start - 10); g_signal_connect(item_manual, "button_press_event", (GtkSignalFunc) item_event_help, "manual"); gc_item_focus_init(item_manual, NULL); item_manual_text = goo_canvas_text_new (rootitem, _("Manual"), BOARDWIDTH*0.6, y_start + GAP_TO_BUTTON, -1, GTK_ANCHOR_CENTER, "font", gc_skin_font_content, "fill-color-rgba", gc_skin_get_color("gcompris/helpunselect"), NULL); g_signal_connect(item_manual_text, "button_press_event", (GtkSignalFunc) item_event_help, "manual"); } // Credit Button if(credit) { item_credit = goo_canvas_svg_new (rootitem, gc_skin_rsvg_get(), "svg-id", item_id, NULL); SET_ITEM_LOCATION(item_credit, (BOARDWIDTH*0.8) - pixmap_width/2, y_start - 10); g_signal_connect(item_credit, "button_press_event", (GtkSignalFunc) item_event_help, "credit"); gc_item_focus_init(item_credit, NULL); item_credit_text = goo_canvas_text_new (rootitem, _("Credit"), BOARDWIDTH*0.8, y_start + GAP_TO_BUTTON, -1, GTK_ANCHOR_CENTER, "font", gc_skin_font_content, "fill-color-rgba", gc_skin_get_color("gcompris/helpunselect"), NULL); g_signal_connect(item_credit_text, "button_press_event", (GtkSignalFunc) item_event_help, "credit"); } // CONTENT // default text to display if(prerequisite) { text_to_display = prerequisite; select_item(item_prerequisite, item_prerequisite_text); } else if(goal) { text_to_display = goal; select_item(item_goal, item_goal_text); } else if(manual) { text_to_display = manual; select_item(item_manual, item_manual_text); } else if(credit) { text_to_display = credit; select_item(item_credit, item_credit_text); } y_start += 45; /* Create a scrolled area for the text content */ GtkWidget *view; GtkWidget *sw; view = gtk_text_view_new (); gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD); gtk_text_view_set_editable(GTK_TEXT_VIEW (view), FALSE); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (view), FALSE); gtk_signal_connect(GTK_OBJECT(view), "button-press-event", (GtkSignalFunc) event_disable_right_click_popup, NULL); PangoFontDescription *font_desc; font_desc = pango_font_description_from_string (gc_skin_font_content); gtk_widget_modify_font (view, font_desc); pango_font_description_free (font_desc); GdkColor fg_color; GdkColor bg_color; gc_skin_get_gdkcolor("gcompris/helpfg", &fg_color); gc_skin_get_gdkcolor("gcompris/helpbg", &bg_color); gtk_widget_modify_base(view, GTK_STATE_NORMAL, &bg_color); gtk_widget_modify_text(view, GTK_STATE_NORMAL, &fg_color); buffer_content = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add (GTK_CONTAINER (sw), view); goo_canvas_widget_new (rootitem, sw, x_start + 40, y_start, 618.0, 280.0, NULL); gtk_widget_show_all (sw); set_content(text_to_display); // OK gc_util_button_text_svg(rootitem, BOARDWIDTH * 0.5, y, "#BUTTON_TEXT", _("OK"), (GtkSignalFunc) item_event_help, "ok"); gc_bar_hide(TRUE); help_displayed = TRUE; }
int preferences::load(){ xmlNodePtr p; char *rcfile; char *home; char *dir_adm; char buf[1024]; DIR *dir; dir_adm=ADM_getBaseDir(); if(!dir_adm) return RC_FAILED; rcfile=new char[strlen(dir_adm)+4+strlen(CONFIG)]; strcpy(rcfile,dir_adm); strcat(rcfile,"/"); strcat(rcfile,CONFIG); // Now build the filename if( access(rcfile,R_OK) == -1 ){ if( errno != ENOENT ) fprintf(stderr,"can't read(%s): %d (%s)\n", rcfile, errno, strerror(errno) ); delete [] rcfile; return RC_FAILED; } if( !(xdoc = xmlParseFile(rcfile)) ){ fprintf(stderr,"can't parse \"rcfile\".\n"); delete [] rcfile; return RC_FAILED; } delete [] rcfile; erase_blank_nodes(xdoc->children); p = xdoc->children; // ->avidemux buf[0] = '\0'; if( p ) p = p->children; // ->avidemux->??? while( p ){ if( strlen(buf) ){ strncpy(&buf[strlen(buf)],".",1024-strlen(buf)); buf[1023] = '\0'; } strncpy(&buf[strlen(buf)],(char*)p->name,1024-strlen(buf)); buf[1023] = '\0'; if( p->content ){ set_content(buf, p); }else if( p->children ){ xmlNodePtr c = p->children; if( c->type == XML_TEXT_NODE && ! c->children && ! c->next && ! c->prev ){ set_content(buf, c); // the routine below will go to c->parent->next (p->next) if we do: p = c; strncpy(&buf[strlen(buf)],".DUMMY",1024-strlen(buf)); buf[1023] = '\0'; } } if( p->children ){ // go down first p = p->children; }else if( p->next ){ // than go next char *t = rindex(buf,'.'); if( t ) *t = '\0'; else buf[0] = '\0'; p = p->next; }else{ // and last go up AND next do{ if( p->parent == xdoc->children ){ p = NULL; }else{ char *t = rindex(buf,'.'); if( t ) *t = '\0'; else buf[0] = '\0'; p = p->parent; } }while( p && ! p->next ); if( p ){ char *t = rindex(buf,'.'); if( t ) *t = '\0'; else buf[0] = '\0'; p = p->next; } } } // load xml to preferences // check ranges foreach val // set to min if <min or to max if >max - generate warning // warn about unused options printf("Preferences found and loaded\n"); return RC_OK; }
//! Sets the value of this text or CData section. //! \param value the value to set. void set_value(const std::string& value) { set_content(value); }