Changeset 8334 for branches

Show
Ignore:
Timestamp:
20/01/12 14:37:13 (4 months ago)
Author:
westram
Message:
  • DRYed test for hidden terminals
Location:
branches/e4fix/EDIT4
Files:
2 modified

Legend:

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

    r8333 r8334  
    955955    } 
    956956 
    957     // @@@ move parts of the following section into function is_hidden_by_parent() 
    958     ED4_base *temp_parent = owner_of_cursor; 
    959     while (temp_parent->parent) { 
    960         temp_parent = temp_parent->parent; 
    961         if (temp_parent->flag.hidden) return; // don't move cursor if terminal is flag.hidden 
    962     } 
     957    if (owner_of_cursor->is_hidden()) return; // do not jump if cursor terminal is hidden 
    963958 
    964959    AW_pos terminal_x, terminal_y; 
     
    11491144    // move cursor up down 
    11501145    ED4_cursor_move dir     = ED4_C_NONE; 
    1151     ED4_returncode result   = ED4_R_OK; 
     1146    ED4_returncode  result  = ED4_R_OK; 
    11521147    bool            endHome = false; 
    11531148 
     
    11611156 
    11621157    if (dir != ED4_C_NONE) { 
    1163         // don't move cursor if terminal is hidden 
    1164         { 
    1165             ED4_base *temp_parent = owner_of_cursor->parent; 
    1166             while (temp_parent->parent && result == ED4_R_OK) { 
    1167                 if (temp_parent->flag.hidden) { result = ED4_R_IMPOSSIBLE; } 
    1168                 temp_parent = temp_parent->parent; 
    1169             } 
    1170         } 
     1158        if (owner_of_cursor->is_hidden()) result = ED4_R_IMPOSSIBLE; // don't move cursor if terminal is hidden 
    11711159 
    11721160        if (result == ED4_R_OK) { 
  • branches/e4fix/EDIT4/ed4_class.hxx

    r8333 r8334  
    11331133 
    11341134    ED4_group_manager  *is_in_folded_group() const; 
     1135    virtual bool is_hidden() const = 0; 
     1136 
    11351137    char *get_name_of_species();                      // go from terminal to name of species 
    11361138 
     
    13191321    ED4_returncode unhide_children(); 
    13201322 
     1323    bool is_hidden() const { 
     1324        if (flag.hidden) return true; 
     1325        if (!parent) return false; 
     1326        return parent->is_hidden(); 
     1327    } 
     1328 
    13211329    ED4_manager(const ED4_objspec& spec_, const char *id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent); 
    13221330    virtual ~ED4_manager(); 
     
    13791387    void scroll_into_view(ED4_window *ed4w); 
    13801388    inline bool setCursorTo(ED4_cursor *cursor, int seq_pos, bool unfoldGroups, ED4_CursorJumpType jump_type); 
     1389 
     1390    bool is_hidden() const { return parent && parent->is_hidden(); } 
    13811391 
    13821392    ED4_terminal(const ED4_objspec& spec_, GB_CSTR id, AW_pos x, AW_pos y, AW_pos width, AW_pos height, ED4_manager *parent);