source: branches/lib/AWT/AWT_misc.cxx

Last change on this file was 19575, checked in by westram, 3 weeks ago
  • reintegrates 'help' into 'trunk'
    • preformatted text gets checked for width now (to enforce it fits into the arb help window).
    • fixed help following these checks, using the following steps:
      • ignore problems in foreign documentation.
      • increase default help window width.
      • introduce control comments to
        • accept oversized preformatted sections.
        • enforce preformatted style for whole sections.
        • simply define single-line preformatted sections
          Used intensive for definition of internal script languages.
    • fixed several non-related problems found in documentation.
    • minor layout changes for HTML version of arb help (more compacted; highlight anchored/all sections).
    • refactor system interface (GUI version) and use it from help module.
  • adds: log:branches/help@19532:19574
File size: 3.0 KB
Line 
1// ============================================================ //
2//                                                              //
3//   File      : AWT_misc.cxx                                   //
4//   Purpose   :                                                //
5//                                                              //
6//   Coded by Ralf Westram (coder@reallysoft.de) in July 2015   //
7//   http://www.arb-home.de/                                    //
8//                                                              //
9// ============================================================ //
10
11#include "awt_misc.hxx"
12
13#include <aw_root.hxx>
14#include <aw_window.hxx>
15#include <aw_awar.hxx>
16#include <aw_advice.hxx>
17
18#include <arbdb.h>
19#include <arb_strarray.h>
20
21AW_window *AWT_create_IUPAC_info_window(AW_root *aw_root) {
22    // Open window showing IUPAC tables
23    static AW_window_simple *aws = NULp;
24    if (!aws) {
25        aws = new AW_window_simple;
26
27        aws->init(aw_root, "SHOW_IUPAC", "IUPAC info");
28        aws->load_xfig("iupac.fig");
29
30        aws->button_length(7);
31
32        aws->at("ok");
33        aws->callback(AW_POPDOWN);
34        aws->create_button("CLOSE", "CLOSE", "O");
35    }
36    return aws;
37}
38
39void AWT_insert_DBsaveType_selector(AW_window *aww, const char *awar_name) {
40    aww->get_root()->awar_string(awar_name, "b"); // default=save binary database
41
42    aww->label("Type ");
43    aww->create_option_menu(awar_name);
44    aww->insert_default_option("Binary",          "B", "b");
45    aww->insert_option        ("Bin (+FastLoad)", "F", "bm");
46    aww->insert_option        ("Ascii",           "A", "a");
47    aww->update_option_menu();
48}
49
50static void warn_compression_type(AW_root*, AW_awar *awar_compression) {
51    if (awar_compression->read_char_pntr()[0]) { // not empty
52        AW_advice("Using extra compression is not compatible with older\n"
53                  "arb-versions (prior to arb-7.0)!\n"
54                  "\n"
55                  "Databases will fail to load there..",
56                  AW_ADVICE_TOGGLE,
57                  "Extra database compression warning",
58                  NULp);
59    }
60}
61
62void AWT_insert_DBcompression_selector(AW_window *aww, const char *awar_name) {
63    AW_awar *awar_compression = aww->get_root()->awar_string(awar_name, ""); // default = do not use extra compression
64
65    aww->label("Compression ");
66
67    ConstStrArray compressor;
68    GBT_split_string(compressor, GB_get_supported_compression_flags(true), "=, ", SPLIT_DROPEMPTY);
69    arb_assert((compressor.size()%2) == 0); // should contain alternating flag/name entries
70
71    aww->create_option_menu(awar_name);
72    aww->insert_default_option("none", "N", "");
73    for (int c = 0; compressor[c]; c += 2) {
74        const char *flag = compressor[c];
75        const char *name = compressor[c+1];
76        arb_assert(strlen(flag) == 1);
77        aww->insert_option(name, NULp, flag);
78    }
79    aww->update_option_menu();
80
81    awar_compression->add_callback(makeRootCallback(warn_compression_type, awar_compression));
82}
83
Note: See TracBrowser for help on using the repository browser.