Show
Ignore:
Timestamp:
21/05/10 19:44:17 (2 years ago)
Author:
westram
Message:
  • AW_root
    • ctor initializes AWAR subsystem
    • made more clear that AW_root is a singleton
    • call dtor atexit; unlink AWARs from prop-DB and free memory (AW_window instances and releated mem still remain)
    • close properties DB
    • renamed some functions
  • AW_awar
    • added dtor
  • added AWT_create_root (necessary to add properties DB to DB-browser)
  • removed AWT_open_properties (done inside AW_root-ctor now)
  • EDIT properties
    • detect existing properties before constructing AW_root
  • removed AW_config_struct
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/EDIT4/ED4_root.cxx

    r6513 r6666  
    12811281} 
    12821282 
    1283 static void ED4_save_defaults(AW_window *aw, AW_CL cl_mode, AW_CL) { 
     1283static void ED4_save_properties(AW_window *aw, AW_CL cl_mode, AW_CL) { 
    12841284    int mode = (int)cl_mode; 
    12851285 
    1286     AW_save_specific_defaults(aw, ED4_propertyName(mode)); 
     1286    AW_save_specific_properties(aw, ED4_propertyName(mode)); 
    12871287} 
    12881288 
     
    15891589 
    15901590        const char *entry = GBS_global_string("Save loaded Properties (~/%s)", db_name); 
    1591         awmm->insert_menu_topic("save_loaded_props", entry, "l", "e4_defaults.hlp", AWM_ALL, ED4_save_defaults, (AW_CL)default_mode, 0); 
     1591        awmm->insert_menu_topic("save_loaded_props", entry, "l", "e4_defaults.hlp", AWM_ALL, ED4_save_properties, (AW_CL)default_mode, 0); 
    15921592        SEP________________________SEP; 
    15931593 
     
    15961596            hotkey[0]     = "Pta"[mode]; 
    15971597            entry         = GBS_global_string("Save %sProperties (~/%s)", entry_type[mode], ED4_propertyName(mode)); 
    1598             awmm->insert_menu_topic(tag[mode], entry, hotkey, "e4_defaults.hlp", AWM_ALL, ED4_save_defaults, (AW_CL)mode, 0); 
     1598            awmm->insert_menu_topic(tag[mode], entry, hotkey, "e4_defaults.hlp", AWM_ALL, ED4_save_properties, (AW_CL)mode, 0); 
    15991599        } 
    16001600    } 
     
    18871887} 
    18881888 
    1889 ED4_root::ED4_root() 
    1890 { 
     1889static char *detectProperties() { 
     1890    char *propname = NULL; 
     1891 
     1892    for (int mode = 0; !propname && mode <= 2; ++mode) { // search for properties-database 
     1893        const char *fullprop = AW_root::property_DB_fullname(ED4_propertyName(mode)); 
     1894        if (mode == 2 || GB_is_regularfile(fullprop)) { 
     1895            freedup(propname, fullprop); 
     1896        } 
     1897    } 
     1898 
     1899    GB_informationf("Using properties from '%s'", propname); 
     1900    return propname; 
     1901} 
     1902 
     1903ED4_root::ED4_root() { 
    18911904    memset((char *)this, 0, sizeof(*this)); 
    18921905 
    1893     aw_root      = new AW_root; 
    1894     first_window = NULL; 
    1895     main_manager = NULL; 
    1896     database     = NULL; 
    1897     tmp_ed4w     = NULL; 
    1898     tmp_aww      = NULL; 
    1899     tmp_device   = NULL; 
    1900     temp_gc      = 0; 
    1901  
    1902     scroll_links.link_for_hor_slider = NULL; 
    1903     scroll_links.link_for_ver_slider = NULL; 
    1904  
    1905     folding_action = 0; 
    1906  
    1907     species_mode            = ED4_SM_MOVE; 
    1908     scroll_picture.scroll   = 0; 
    1909     scroll_picture.old_x    = 0; 
    1910     scroll_picture.old_y    = 0; 
    1911     middle_area_man         = NULL; 
    1912     top_area_man            = NULL; 
    1913     root_group_man          = NULL; 
    1914     ecoli_ref               = NULL; 
    1915     protstruct              = NULL; 
    1916     protstruct_len          = 0; 
    1917     column_stat_activated   = 0; 
    1918     column_stat_initialized = 0; 
    1919     visualizeSAI            = 0; 
    1920     visualizeSAI_allSpecies = 0; 
    1921  
    1922     aw_initstatus(); 
    1923 } 
    1924  
    1925  
    1926 ED4_root::~ED4_root() 
    1927 { 
     1906    db_name  = detectProperties(); 
     1907    aw_root  = AWT_create_root(db_name, "ARB_EDIT4"); 
     1908    props_db = AW_ROOT_DEFAULT; 
     1909 
     1910    species_mode = ED4_SM_MOVE; 
     1911} 
     1912 
     1913 
     1914ED4_root::~ED4_root() { 
    19281915    delete aw_root; 
    19291916    delete first_window; 
     
    19331920    delete database; 
    19341921    delete ecoli_ref; 
    1935     if (protstruct) free(protstruct); 
    1936 } 
     1922 
     1923    free(protstruct); 
     1924    free(db_name); 
     1925}