/* * call-seq: * DirDialog.new(parent, name, [options]) * DirDialog.new(parent, [options]) * * creates a new DirDialog widget. * ===Arguments * * parent of this window or nil * * name is a String describing a resource in a loaded xrc * * *options: Hash with possible options to set: * * path String default path * * message String * * * must_exist Style Flag does set MUST_EXIST * * change_dir Style Flag does set CHANGE_DIR * */ DLL_LOCAL VALUE _initialize(int argc,VALUE *argv,VALUE self) { VALUE parent,name,hash; rb_scan_args(argc, argv, "11:",&parent,&name,&hash); if(!_created && !rb_obj_is_kind_of(name,rb_cString)) { wxString message(wxDirSelectorPromptStr); wxString path(wxEmptyString); int style(wxDD_DEFAULT_STYLE); if(rb_obj_is_kind_of(hash,rb_cHash)) { set_default_values(hash,message,path,style); TopLevel::set_style_flags(hash,style); set_style_flags(hash,style); } _self->Create(unwrap<wxWindow*>(parent),message,path,style); } rb_call_super(argc,argv); if(rb_obj_is_kind_of(name, rb_cString) && rb_obj_is_kind_of(hash, rb_cHash)) { set_obj_option(hash, "message", &wxDirDialog::SetMessage, _self); set_obj_option(hash, "path", &wxDirDialog::SetPath, _self); } return self; }
/* * call-seq: * dir_dialog([parent], [options]) -> String * * shows an DirDialog. * ===Arguments * * parent of this window or nil * * *options: Hash with possible options to set: * * path String default path * * message String * * style Integer * * pos WX::Point * * must_exist Style Flag does set MUST_EXIST * * change_dir Style Flag does set CHANGE_DIR * ===Return value * selected path */ DLL_LOCAL VALUE _getUserDir(int argc,VALUE *argv,VALUE self) { VALUE parent,hash; rb_scan_args(argc, argv, "01:",&parent,&hash); app_protected(); wxString message(wxDirSelectorPromptStr); wxString defaultPath(wxEmptyString); int style(wxDD_DEFAULT_STYLE); wxPoint pos(wxDefaultPosition); if(rb_obj_is_kind_of(hash,rb_cHash)) { set_default_values(hash,message,defaultPath,style); set_hash_option(hash,"pos",pos); set_style_flags(hash,style); } return wrap(wxDirSelector(message, defaultPath,style,pos, unwrap<wxWindow*>(parent))); }
GtkWidget* eog_save_as_dialog_new (GtkWindow *main, GList *images, GFile *base_file) { GtkBuilder *xml; GtkWidget *dlg; SaveAsData *data; GtkWidget *label; xml = gtk_builder_new_from_resource ("/org/gnome/eog/ui/eog-multiple-save-as-dialog.ui"); gtk_builder_set_translation_domain (xml, GETTEXT_PACKAGE); dlg = GTK_WIDGET (g_object_ref (gtk_builder_get_object (xml, "eog_multiple_save_as_dialog"))); gtk_window_set_transient_for (GTK_WINDOW (dlg), GTK_WINDOW (main)); gtk_window_set_position (GTK_WINDOW (dlg), GTK_WIN_POS_CENTER_ON_PARENT); data = g_slice_new0 (SaveAsData); /* init widget references */ data->dir_chooser = GTK_WIDGET (gtk_builder_get_object (xml, "dir_chooser")); data->token_entry = GTK_WIDGET (gtk_builder_get_object (xml, "token_entry")); data->replace_spaces_check = GTK_WIDGET (gtk_builder_get_object (xml, "replace_spaces_check")); data->counter_spin = GTK_WIDGET (gtk_builder_get_object (xml, "counter_spin")); data->preview_label = GTK_WIDGET (gtk_builder_get_object (xml, "preview_label")); data->format_combobox = GTK_WIDGET (gtk_builder_get_object (xml, "format_combobox")); /* init preview information */ data->idle_id = 0; data->n_images = g_list_length (images); data->nth_image = (int) ((float) data->n_images * rand() / (float) (RAND_MAX+1.0)); g_assert (data->nth_image >= 0 && data->nth_image < data->n_images); data->image = g_object_ref (EOG_IMAGE (g_list_nth_data (images, data->nth_image))); g_object_set_data_full (G_OBJECT (dlg), "data", data, destroy_data_cb); g_signal_connect (G_OBJECT (data->format_combobox), "changed", (GCallback) on_format_combobox_changed, dlg); g_signal_connect (G_OBJECT (data->token_entry), "changed", (GCallback) on_token_entry_changed, dlg); g_signal_connect (G_OBJECT (data->replace_spaces_check), "toggled", (GCallback) on_replace_spaces_check_clicked, dlg); g_signal_connect (G_OBJECT (data->counter_spin), "changed", (GCallback) on_counter_spin_changed, dlg); label = GTK_WIDGET (gtk_builder_get_object (xml, "preview_label_from")); gtk_label_set_text (GTK_LABEL (label), eog_image_get_caption (data->image)); prepare_format_combobox (data); set_default_values (dlg, base_file); g_object_unref (xml); return dlg; }
void set_var_type(int index, v_type t) { if(index > ALL_VARIABLES_SIZE || index < 0) { yyerror("Erro: index errado / nao encontrado em get_var"); return; } ALL_VARIABLES[index].my_type = t; set_default_values(&ALL_VARIABLES[index]); return; }
void M2MReportHandler::set_under_observation(bool observed) { tr_debug("M2MReportHandler::set_under_observation(observed %d)", (int)observed); _under_observation = observed; _report_scheduled = false; stop_timers(); if(observed) { handle_timers(); } else { set_default_values(); } }
void extract_cli_parser_c::add_extraction_spec() { if ( (options_c::em_tracks != m_options.m_extraction_mode) && (options_c::em_timecodes_v2 != m_options.m_extraction_mode) && (options_c::em_attachments != m_options.m_extraction_mode)) mxerror(boost::format(Y("Unrecognized command line option '%1%'.\n")) % m_current_arg); boost::regex s_track_id_re("^(\\d+)(:(.+))?$", boost::regex::perl); boost::smatch matches; if (!boost::regex_search(m_current_arg, matches, s_track_id_re)) { if (options_c::em_attachments == m_options.m_extraction_mode) mxerror(boost::format(Y("Invalid attachment ID/file name specification in argument '%1%'.\n")) % m_current_arg); else mxerror(boost::format(Y("Invalid track ID/file name specification in argument '%1%'.\n")) % m_current_arg); } track_spec_t track; parse_number(matches[1].str(), track.tid); std::string output_file_name; if (matches[3].matched) output_file_name = matches[3].str(); if (output_file_name.empty()) { if (options_c::em_attachments == m_options.m_extraction_mode) mxinfo(Y("No output file name specified, will use attachment name.\n")); else mxerror(boost::format(Y("Missing output file name in argument '%1%'.\n")) % m_current_arg); } track.out_name = output_file_name; track.sub_charset = m_charset; track.extract_cuesheet = m_extract_cuesheet; track.extract_blockadd_level = m_extract_blockadd_level; track.target_mode = m_target_mode; m_options.m_tracks.push_back(track); set_default_values(); }
/* parse_configuration_file() reads configuration file and stores its content in an array; then creates plugin structures and parses supported config keys */ int parse_configuration_file(char *filename) { char localbuf[10240]; char cmdline [] = "cmdline"; FILE *file; int num = 0, cmdlineflag = FALSE, rows_cmdline = rows, idx; rows = 0; /* NULL filename means we don't have a configuration file; 1st stage: read from file and store lines into a first char* array; merge commandline options, if required, placing them at the tail - in order to override directives placed in the configuration file */ if (filename) { if ((file = fopen(filename,"r")) == NULL) { Log(LOG_ERR, "ERROR: file %s not found.\n", filename); return ERR; } else { while (!feof(file)) { if (rows == SRVBUFLEN) { Log(LOG_ERR, "ERROR ( %s ): maximum number of %d lines reached.\n", filename, SRVBUFLEN); break; } memset(localbuf, 0, sizeof(localbuf)); if (fgets(localbuf, sizeof(localbuf), file) == NULL) break; else { localbuf[sizeof(localbuf)-1] = '\0'; cfg[rows] = malloc(strlen(localbuf)+2); if (!cfg[rows]) { Log(LOG_ERR, "ERROR ( %s ): malloc() failed (parse_configuration_file). Exiting ..\n", filename); exit(1); } strcpy(cfg[rows], localbuf); cfg[rows][strlen(localbuf)+1] = '\0'; rows++; } } } fclose(file); } else { filename = cmdline; cmdlineflag = TRUE; } if (rows_cmdline) { for (idx = 0; idx < rows_cmdline && (rows+idx) < SRVBUFLEN; idx++) { cfg[rows+idx] = cfg_cmdline[idx]; } rows += idx; } /* 2nd stage: sanitize lines */ sanitize_cfg(rows, filename); /* 3rd stage: plugin structures creation; we discard plugin names if 'pmacctd' has been invoked commandline; if any plugin has been activated we default to a single 'imt' plugin */ if (!cmdlineflag) parse_core_process_name(filename, rows, FALSE); else parse_core_process_name(filename, rows, TRUE); if (!cmdlineflag) num = parse_plugin_names(filename, rows, FALSE); else num = parse_plugin_names(filename, rows, TRUE); if (!num) { Log(LOG_WARNING, "WARN ( %s ): No plugin has been activated; defaulting to in-memory table.\n", filename); num = create_plugin(filename, "default", "memory"); } if (debug) { struct plugins_list_entry *list = plugins_list; while (list) { Log(LOG_DEBUG, "DEBUG ( %s ): plugin name/type: '%s'/'%s'.\n", filename, list->name, list->type.string); list = list->next; } } /* 4th stage: setting some default value */ set_default_values(); /* 5th stage: parsing keys and building configurations */ evaluate_configuration(filename, rows); return SUCCESS; }
extract_cli_parser_c::extract_cli_parser_c(const std::vector<std::string> &args) : cli_parser_c(args) , m_num_unknown_args(0) { set_default_values(); }
IMPSTATISTICS_BEGIN_INTERNAL_NAMESPACE KMLProxy::KMLProxy() { set_default_values(); is_init_ = false; }