Changeset 8306

Show
Ignore:
Timestamp:
14/12/11 11:33:42 (5 months ago)
Author:
westram
Message:
  • fixed '(re)load config'
    • explicitely remove all callbacks before destroying old hierarchy
    • implemented missing ED4_foldable::delete_folding_line
    • when destroying terminal, check in all windows whether it contains the cursor
    • clear_whole_background (moved into ED4_main_manager; act on all windows)
Location:
branches/e4fix/EDIT4
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • branches/e4fix/EDIT4/ED4_base.cxx

    r8304 r8306  
    12711271} 
    12721272 
    1273 ED4_returncode ED4_base::clear_whole_background() { 
     1273void ED4_main_manager::clear_whole_background() { 
    12741274    // clear AW_MIDDLE_AREA 
    1275     if (current_device()) { // @@@ should clear be done for all windows? 
    1276         current_device()->push_clip_scale(); 
    1277         current_device()->clear(AW_ALL_DEVICES); 
    1278         current_device()->pop_clip_scale(); 
    1279     } 
    1280  
    1281     return (ED4_R_OK); 
     1275    for (ED4_window *window = ED4_ROOT->first_window; window; window=window->next) { 
     1276        AW_device *device = window->get_device(); 
     1277        if (device) { 
     1278            device->push_clip_scale(); 
     1279            device->clear(AW_ALL_DEVICES); 
     1280            device->pop_clip_scale(); 
     1281        } 
     1282    } 
    12821283} 
    12831284 
     
    13251326 
    13261327 
    1327 ED4_base::~ED4_base() // before calling this function the first time, parent has to be set NULL 
    1328 { 
    1329     ED4_base *object; 
    1330     ED4_base *sequence_terminal = NULL; 
    1331     ED4_list_elem *list_elem, *old_elem; 
    1332     ED4_window *ed4w; 
    1333  
     1328ED4_base::~ED4_base() { 
     1329    // before calling this function the first time, parent has to be set NULL 
    13341330    e4_assert(!parent); // unlink from parent first! 
    13351331 
    1336     list_elem = linked_objects.first(); 
     1332    ED4_list_elem *list_elem = linked_objects.first(); 
    13371333    while (list_elem) { 
    1338         object = (ED4_base *) list_elem->elem(); 
     1334        ED4_base *object = (ED4_base *) list_elem->elem(); 
    13391335        if (object->width_link == this) { 
    13401336            object->width_link->linked_objects.delete_elem((void *) this);              // delete link and 
     
    13471343        } 
    13481344 
    1349         old_elem = list_elem; 
     1345        ED4_list_elem *old_elem = list_elem; 
    13501346        list_elem = list_elem->next(); 
    13511347        linked_objects.delete_elem(old_elem->elem()); 
     
    13561352        if (ED4_ROOT->main_manager) 
    13571353        { 
    1358             sequence_terminal = ED4_ROOT->main_manager->search_spec_child_rek(ED4_L_SEQUENCE_STRING); 
     1354            ED4_base *sequence_terminal = ED4_ROOT->main_manager->search_spec_child_rek(ED4_L_SEQUENCE_STRING); 
    13591355 
    13601356            if (sequence_terminal) 
     
    13641360            ED4_ROOT->scroll_links.link_for_hor_slider = sequence_terminal; 
    13651361 
    1366             ed4w = current_ed4w(); 
     1362            ED4_window *ed4w = ED4_ROOT->first_window; 
    13671363            while (ed4w != NULL) { 
    13681364                ed4w->scrolled_rect.replace_x_width_link_to(this, sequence_terminal); 
  • branches/e4fix/EDIT4/ED4_manager.cxx

    r8286 r8306  
    18331833} 
    18341834 
     1835static ARB_ERROR removeAllCallbacks(ED4_base *base) { 
     1836    if (base->is_species_manager()) { 
     1837        base->to_species_manager()->remove_all_callbacks(); 
     1838    } 
     1839    return NULL; 
     1840} 
     1841 
     1842void ED4_root::remove_all_callbacks() { 
     1843    root_group_man->route_down_hierarchy(removeAllCallbacks).expect_no_error(); 
     1844} 
    18351845 
    18361846// ------------------------ 
  • branches/e4fix/EDIT4/ED4_no_class.cxx

    r8305 r8306  
    831831 
    832832void ED4_quit_editor(AW_window *aww, AW_CL /* cd1 */, AW_CL /* cd2 */) { 
    833     ED4_LocalWinContext uses(aww); 
     833    ED4_LocalWinContext uses(aww); // @@@ dont use context here 
    834834 
    835835    if (ED4_ROOT->first_window == current_ed4w()) { // quit button has been pressed in first window 
     
    12791279} 
    12801280 
    1281 void ED4_load_new_config(char *string) 
    1282 { 
    1283     char *config_data_top    = NULL; 
    1284     char *config_data_middle = NULL; 
    1285  
    1286     ED4_window     *window; 
    1287     GB_transaction  dummy(GLOBAL_gb_main); 
    1288  
     1281void ED4_load_new_config(char *string) { 
     1282    GB_transaction ta(GLOBAL_gb_main); 
    12891283 
    12901284    ED4_ROOT->main_manager->clear_whole_background(); 
     
    12951289    ED4_init_notFoundMessage(); 
    12961290 
    1297  
    12981291    if (ED4_ROOT->selected_objects.no_of_entries() > 0) { 
    12991292        ED4_ROOT->deselect_all(); 
    13001293    } 
     1294 
     1295    ED4_ROOT->remove_all_callbacks(); 
    13011296 
    13021297    ED4_ROOT->scroll_picture.scroll         = 0; 
     
    13061301    ED4_ROOT->ref_terminals.clear(); 
    13071302 
    1308     for (window=ED4_ROOT->first_window; window; window=window->next) { 
     1303    for (ED4_window *window = ED4_ROOT->first_window; window; window=window->next) { 
    13091304        window->cursor.init(); 
    13101305        window->aww->set_horizontal_scrollbar_position (0); 
     
    13121307    } 
    13131308 
    1314     ED4_ROOT->scroll_links.link_for_hor_slider  = NULL; 
    1315     ED4_ROOT->scroll_links.link_for_ver_slider  = NULL; 
    1316     ED4_ROOT->middle_area_man           = NULL; 
    1317     ED4_ROOT->top_area_man              = NULL; 
     1309    ED4_ROOT->scroll_links.link_for_hor_slider = NULL; 
     1310    ED4_ROOT->scroll_links.link_for_ver_slider = NULL; 
     1311    ED4_ROOT->middle_area_man                  = NULL; 
     1312    ED4_ROOT->top_area_man                     = NULL; 
     1313 
     1314     
    13181315 
    13191316    delete ED4_ROOT->main_manager; 
    1320     ED4_ROOT->main_manager              = NULL; 
     1317    ED4_ROOT->main_manager = NULL; 
    13211318    delete ED4_ROOT->ecoli_ref; 
     1319 
     1320    char *config_data_top    = NULL; 
     1321    char *config_data_middle = NULL; 
    13221322    { 
    13231323        GB_push_transaction(GLOBAL_gb_main); 
  • branches/e4fix/EDIT4/ED4_terminal.cxx

    r8293 r8306  
    764764ED4_terminal::~ED4_terminal() { 
    765765    delete selection_info; 
    766     ED4_cursor& cursor = current_cursor(); 
    767     if (this == cursor.owner_of_cursor) { 
    768         cursor.init(); 
     766    for (ED4_window *window = ED4_ROOT->first_window; window; window=window->next) { 
     767        ED4_cursor& cursor = window->cursor; 
     768        if (this == cursor.owner_of_cursor) { 
     769            cursor.init(); 
     770        } 
    769771    } 
    770772} 
  • branches/e4fix/EDIT4/ED4_window.cxx

    r8296 r8306  
    119119 
    120120 
    121 ED4_returncode ED4_foldable::delete_folding_line(ED4_folding_line */*fl*/, ED4_properties /*prop*/) { 
    122     e4_assert(0); // not implement - cause it's unused 
    123     return ED4_R_OK; 
     121void ED4_foldable::delete_folding_line(ED4_folding_line *fl, ED4_properties prop) { 
     122    if (prop == ED4_P_HORIZONTAL) { 
     123        horizontal_fl = horizontal_fl->delete_member(fl); 
     124    } 
     125    else { 
     126        e4_assert(prop == ED4_P_VERTICAL); 
     127        vertical_fl = vertical_fl->delete_member(fl); 
     128    } 
    124129} 
    125130 
  • branches/e4fix/EDIT4/ed4_class.hxx

    r8304 r8306  
    306306    } 
    307307 
     308    ED4_folding_line *delete_member(ED4_folding_line *fl) { 
     309        ED4_folding_line *result = this; 
     310        if (this == fl) { 
     311            result = next; 
     312            next   = NULL; 
     313            delete this; 
     314        } 
     315        return result; 
     316    } 
     317 
    308318    AW_pos get_dimension() const { return dimension; } 
    309319    const ED4_folding_line *get_next() const { return next; } 
     
    357367 
    358368    ED4_folding_line *insert_folding_line(AW_pos pos, AW_pos dimension, ED4_properties prop); 
    359     ED4_returncode  delete_folding_line(ED4_folding_line *fl, ED4_properties prop); 
     369    void              delete_folding_line(ED4_folding_line *fl, ED4_properties prop); 
    360370}; 
    361371 
     
    10501060    ED4_returncode  clear_background(int color=0); 
    10511061 
    1052     ED4_returncode clear_whole_background();       // clear AW_MIDDLE_AREA 
    10531062    bool is_visible(ED4_window *in_ed4w, AW_pos x, AW_pos y, ED4_direction direction); 
    10541063    bool is_visible(ED4_window *in_ed4w, AW_pos x1, AW_pos y1, AW_pos x2, AW_pos y2, ED4_direction direction); 
     
    15091518    ED4_index pixel2pos(AW_pos click_x); 
    15101519 
     1520    void remove_all_callbacks(); 
     1521     
    15111522    ED4_root(); 
    15121523    ~ED4_root(); 
     
    15701581    virtual ED4_returncode Show(int refresh_all=0, int is_cleared=0); 
    15711582    virtual ED4_returncode resize_requested_by_parent(); 
     1583     
     1584    void clear_whole_background(); 
    15721585}; 
    15731586