Beispiel #1
0
  INT_PTR dialog_proc(int msg, int param1, void* param2) {
    if (msg == DN_CLOSE && param1 >= 0 && param1 != cancel_ctrl_id) {
      options = read_controls();
    }
    else if (msg == DN_INITDIALOG) {
      set_control_state();
    }
    else if (msg == DN_BTNCLICK) {
      set_control_state();
    }
    else if (msg == DN_EDITCHANGE && param1 == module_ctrl_id) {
      set_control_state();
    }
    else if (msg == DN_EDITCHANGE && param1 == profile_ctrl_id) {
      unsigned profile_idx = get_list_pos(profile_ctrl_id);
      if (profile_idx != -1 && profile_idx < profiles.size()) {
        write_controls(profiles[profile_idx].options);
        set_control_state();
      }
    }

    if (msg == DN_EDITCHANGE || msg == DN_BTNCLICK) {
      unsigned profile_idx = static_cast<unsigned>(profiles.size());
      SfxOptions options;
      bool valid_options = true;
      try {
        options = read_controls();
      }
      catch (const Error&) {
        valid_options = false;
      }
      if (valid_options) {
        for (unsigned i = 0; i < profiles.size(); i++) {
          if (options == profiles[i].options) {
            profile_idx = i;
            break;
          }
        }
      }
      if (profile_idx != get_list_pos(profile_ctrl_id)) {
        DisableEvents de(*this);
        set_list_pos(profile_ctrl_id, profile_idx);
        set_control_state();
      }
    }

    return default_dialog_proc(msg, param1, param2);
  }
Beispiel #2
0
 SfxOptions read_controls() {
   SfxOptions options;
   const SfxModules& sfx_modules = ArcAPI::sfx();
   unsigned sfx_id = get_list_pos(module_ctrl_id);
   if (sfx_id >= sfx_modules.size()) {
     FAIL_MSG(Far::get_msg(MSG_SFX_OPTIONS_DLG_WRONG_MODULE));
   }
   options.name = extract_file_name(sfx_modules[sfx_id].path);
   options.replace_icon = get_check(replace_icon_ctrl_id);
   if (options.replace_icon) {
     options.icon_path = get_text(icon_path_ctrl_id);
     if (!File::exists(options.icon_path)) {
       FAIL_MSG(Far::get_msg(MSG_SFX_OPTIONS_DLG_INVALID_ICON_PATH));
     }
   }
   else
     options.icon_path.clear();
   options.replace_version = get_check(replace_version_ctrl_id);
   if (options.replace_version) {
     options.ver_info.version = get_text(ver_info_version_ctrl_id);
     options.ver_info.comments = get_text(ver_info_comments_ctrl_id);
     options.ver_info.company_name = get_text(ver_info_company_name_ctrl_id);
     options.ver_info.file_description = get_text(ver_info_file_description_ctrl_id);
     options.ver_info.legal_copyright = get_text(ver_info_legal_copyright_ctrl_id);
     options.ver_info.product_name = get_text(ver_info_product_name_ctrl_id);
   }
   else {
     options.ver_info.version.clear();
     options.ver_info.comments.clear();
     options.ver_info.company_name.clear();
     options.ver_info.file_description.clear();
     options.ver_info.legal_copyright.clear();
     options.ver_info.product_name.clear();
   }
   bool install_config_enabled = sfx_modules[sfx_id].install_config();
   options.append_install_config = install_config_enabled && get_check(append_install_config_ctrl_id);
   if (options.append_install_config) {
     options.install_config.title = get_text(install_config_title_ctrl_id);
     options.install_config.begin_prompt = get_text(install_config_begin_prompt_ctrl_id);
     TriState value = get_check3(install_config_progress_ctrl_id);
     if (value == triUndef)
       options.install_config.progress.clear();
     else
       options.install_config.progress = value == triTrue ? L"yes" : L"no";
     options.install_config.run_program = get_text(install_config_run_program_ctrl_id);
     options.install_config.directory = get_text(install_config_directory_ctrl_id);
     options.install_config.execute_file = get_text(install_config_execute_file_ctrl_id);
     options.install_config.execute_parameters = get_text(install_config_execute_parameters_ctrl_id);
   }
   else {
     options.install_config.title.clear();
     options.install_config.begin_prompt.clear();
     options.install_config.progress.clear();
     options.install_config.run_program.clear();
     options.install_config.directory.clear();
     options.install_config.execute_file.clear();
     options.install_config.execute_parameters.clear();
   }
   return options;
 }
Beispiel #3
0
  void set_control_state() {
    DisableEvents de(*this);

    bool replace_icon = get_check(replace_icon_ctrl_id);
    for (int ctrl_id = replace_icon_ctrl_id + 1; ctrl_id < replace_version_ctrl_id; ctrl_id++)
      enable(ctrl_id, replace_icon);

    bool replace_version = get_check(replace_version_ctrl_id);
    for (int ctrl_id = replace_version_ctrl_id + 1; ctrl_id < append_install_config_ctrl_id; ctrl_id++)
      enable(ctrl_id, replace_version);

    unsigned module_id = get_list_pos(module_ctrl_id);
    bool install_config_enabled = module_id < ArcAPI::sfx().size() && ArcAPI::sfx()[module_id].install_config();
    enable(append_install_config_ctrl_id, install_config_enabled);

    bool append_install_config = get_check(append_install_config_ctrl_id);
    for (int ctrl_id = append_install_config_ctrl_id + 1; ctrl_id <= install_config_execute_parameters_ctrl_id; ctrl_id++)
      enable(ctrl_id, install_config_enabled && append_install_config);
  }
Beispiel #4
0
Term *
func_op_name(TermList terms)
{
  Term *op_t;
  Op_Instance *opi;

  op_t  = (Term *)get_list_pos(terms, 1);
  if (! op_t ) {
    report_fatal_external_error((char *)"Cannot retrieve OP instance term");
  }
  if (op_t->type != TT_OP_INSTANCE) {
    report_fatal_external_error((char *)"Term is not of type OP_INSTANCE");
  }

  opi = (Op_Instance *)(op_t->u.opi);
  Op_Structure *op_s = op_instance_op(opi);
  if (! op_s) {
    report_fatal_external_error((char *)"Failed to get OP structure from OP instance");
  }

  return build_id(op_name(op_s));
}
Beispiel #5
0
 intptr_t dialog_proc(intptr_t msg, intptr_t param1, void* param2) {
   if ((msg == DN_CLOSE) && (param1 >= 0) && (param1 != cancel_ctrl_id)) {
     options.use_full_install_ui = get_check(use_full_install_ui_ctrl_id);
     options.update_stable_builds = get_check(update_stable_builds_ctrl_id);
     options.logged_install = get_check(logged_install_ctrl_id);
     options.open_changelog = get_check(open_changelog_ctrl_id);
     options.install_properties = get_text(install_properties_ctrl_id);
     options.http.use_proxy = get_check(use_proxy_ctrl_id);
     options.http.proxy_server = get_text(proxy_server_ctrl_id);
     options.http.proxy_port = str_to_int(get_text(proxy_port_ctrl_id));
     options.http.proxy_auth_scheme = get_list_pos(proxy_auth_scheme_ctrl_id);
     options.http.proxy_user_name = get_text(proxy_user_name_ctrl_id);
     options.http.proxy_password = get_text(proxy_password_ctrl_id);
     options.cache_enabled = get_check(cache_enabled_ctrl_id);
     options.cache_max_size = str_to_int(get_text(cache_max_size_ctrl_id));
     options.cache_dir = get_text(cache_dir_ctrl_id);
   }
   else if (msg == DN_INITDIALOG) {
     bool f_enabled = get_check(use_proxy_ctrl_id);
     for (int ctrl_id = use_proxy_ctrl_id + 1; ctrl_id <= proxy_password_ctrl_id; ctrl_id++)
       enable(ctrl_id, f_enabled);
     f_enabled = get_check(cache_enabled_ctrl_id);
     for (int ctrl_id = cache_enabled_ctrl_id + 1; ctrl_id <= cache_dir_ctrl_id; ctrl_id++)
       enable(ctrl_id, f_enabled);
     return TRUE;
   }
   else if ((msg == DN_BTNCLICK) && (param1 == use_proxy_ctrl_id)) {
     bool f_enabled = param2 ? true : false;
     for (int ctrl_id = use_proxy_ctrl_id + 1; ctrl_id <= proxy_password_ctrl_id; ctrl_id++)
       enable(ctrl_id, f_enabled);
   }
   else if ((msg == DN_BTNCLICK) && (param1 == cache_enabled_ctrl_id)) {
     bool f_enabled = param2 ? true : false;
     for (int ctrl_id = cache_enabled_ctrl_id + 1; ctrl_id <= cache_dir_ctrl_id; ctrl_id++)
       enable(ctrl_id, f_enabled);
   }
   return default_dialog_proc(msg, param1, param2);
 }
Beispiel #6
0
Term *
func_op_names(TermList terms)
{
  Term *ops_t;

  ops_t  = (Term *)get_list_pos(terms, 1);
  if (! ops_t ) {
    report_fatal_external_error((char *)"Cannot retrieve OP instance term");
  }
  if (ops_t->type != LISP_LIST) {
    report_fatal_external_error((char *)"Term is not of type LISP_LIST");
  }

  TermList name_list = sl_make_slist();

  for (L_List p_l = ops_t->u.l_list; p_l; p_l = l_cdr(p_l)) {
    Term *t = l_car(p_l);
    if (t->type == TT_INTENTION) {
      Op_Instance *opi = (Op_Instance *)(t->u.in->top_op);
      Op_Structure *op_s = op_instance_op(opi);
      name_list = build_term_list(name_list, build_id(op_name(op_s)));
    } else if (t->type == TT_OP_INSTANCE) {
      Op_Instance *opi = (Op_Instance *)(t->u.opi);
      Op_Structure *op_s = op_instance_op(opi);
      if (! op_s) {
        name_list = build_term_list(name_list, build_id(declare_atom("NOT-AN-OP")));
      } else {
        name_list = build_term_list(name_list, build_id(op_name(op_s)));
      }
    } else {
      name_list = build_term_list(name_list, build_id(declare_atom("NOT-AN-OP-INSTANCE")));
    }
  }

  return build_term_l_list_from_c_list(name_list);
}
Beispiel #7
0
dl_list_handlerPtr info_base::get_list(const char* list_nm)
{
   return ( get_list(get_list_pos(list_nm)) );
}