Changeset 8296 for branches

Show
Ignore:
Timestamp:
10/12/11 14:50:42 (6 months ago)
Author:
westram
Message:
  • added special class ED4_WinContextFree
    • denies access to global context for derived classes
  • declared ED4_window and ED4_cursor as ED4_WinContextFree (the window is their explicit context)
    • replaced invalid references to global context by uses of explicit context (get_device() + window())
Location:
branches/e4fix/EDIT4
Files:
3 modified

Legend:

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

    r8295 r8296  
    13371337    } 
    13381338 
    1339     target_terminal->scroll_into_view(current_ed4w()); 
     1339    target_terminal->scroll_into_view(window()); 
    13401340 
    13411341    AW_pos termw_x, termw_y; 
  • branches/e4fix/EDIT4/ED4_window.cxx

    r8295 r8296  
    187187    scrolled_rect.link(x_link, y_link, width_link, height_link); 
    188188 
    189     const AW_screen_area& area_size = current_device()->get_area_size(); 
     189    const AW_screen_area& area_size = get_device()->get_area_size(); 
    190190 
    191191    AW::Rectangle rect = scrolled_rect.get_world_rect(); 
     
    305305    AW_pos topbottom_y = toptop_y + coords.top_area_height - 1; 
    306306 
    307     current_device()->push_clip_scale(); 
     307    get_device()->push_clip_scale(); 
    308308 
    309309    // main area 
     
    326326    } 
    327327 
    328     current_device()->pop_clip_scale(); 
     328    get_device()->pop_clip_scale(); 
    329329 
    330330    return (ED4_R_OK); 
  • branches/e4fix/EDIT4/ed4_class.hxx

    r8295 r8296  
    604604typedef bool (*ED4_TerminalTest)(ED4_base *terminal, int seqPos); 
    605605 
    606 class ED4_cursor : virtual Noncopyable { 
     606class ED4_WinContextFree { // denies usage of the following functions in classes derived from this 
     607    AW_device   *current_device(); 
     608    ED4_window  *current_ed4w(); 
     609    AW_window   *current_aww(); 
     610    ED4_cursor&  current_cursor(); 
     611public: 
     612    void avoid_warning() {} 
     613}; 
     614 
     615class ED4_cursor : virtual Noncopyable, virtual ED4_WinContextFree { 
    607616    ED4_window                *win; 
    608617    ED4_index                  cursor_abs_x;    // absolute (to terminal) x-position of cursor (absolute world coordinate of edit window) 
     
    672681}; 
    673682 
    674 class ED4_window : public ED4_foldable { // derived from Noncopyable 
     683class ED4_window : public ED4_foldable, virtual ED4_WinContextFree { // derived from Noncopyable 
    675684    ED4_window(const ED4_window&); // copy-constructor not allowed 
    676685public: 
     
    14161425}; 
    14171426 
    1418  
     1427// accessors for current context (see also ED4_WinContextFree) 
    14191428inline AW_device *current_device() { return ED4_WinContext::get_current_context().get_device(); } 
    14201429inline ED4_window *current_ed4w() { return ED4_WinContext::get_current_context().get_ed4w(); }