texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] Displaying table grids


From: Joris van der Hoeven
Subject: Re: [Texmacs-dev] Displaying table grids
Date: Mon, 14 Dec 2009 10:43:58 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

Dear Norbert,

Thanks for your patch. I support the idea of it, but still find
the rendering suboptimal: I think that the width of the table hints
should always be 1ln, whereas the width is currently 2ln for interior cells.
Also, the rendering of eqnarray* environments is ugly; one should try to
use the mean y-values of successive rows.

I agree that this will be some more work, but do you think that you
can fix these issues? Don't forget that some cells may have
non trivial spans...

Best wishes, --Joris


On Tue, Dec 08, 2009 at 10:07:52AM +0000, Norbert Nemec wrote:
> Hi there,
>
> attached is a patch implementing an idea that I had for a long time:
>
> Currently, when the cursor is inside a table, only the outer border of  
> the whole table is displayed as a cyan rectangle. This patch displays  
> the whole grid of a table as very faint gray lines.
>
> I hope that this feature will help greatly if you do intense layout with  
> complex tables and especially nested tables.
>
> The patch also slightly changes the color of outline rectangles from  
> intense cyan to fainter gray-cyan. This is mostly a matter of taste. I  
> always found the intense color a bit "loud" on the eye. The intense red  
> for selections is fine, but the outline should be a mere hint to guide  
> the eye and seems a bit more elegant in a fainter tone.
>
> This whole patch is probably not the final form of this feature, but  
> more a basis of discussion.
>
> Greetings,
> Norbert

> >From 1092fa3a4e3e6ce5703aeee82b868802e433357e Mon Sep 17 00:00:00 2001
> From: Norbert Nemec <address@hidden>
> Date: Mon, 7 Dec 2009 12:11:43 +0000
> Subject: [PATCH] Display table grid (very faint gray). Also change color of 
> environment boxes from intense cyan to faint gray cyan and put them behind 
> the displayed content.
> 
> ---
>  src/src/Edit/Interface/edit_interface.cpp |   30 ++++++++++++++++++++++------
>  src/src/Edit/Interface/edit_interface.hpp |    3 +-
>  src/src/Edit/Interface/edit_repaint.cpp   |   10 +++++++-
>  3 files changed, 33 insertions(+), 10 deletions(-)
> 
> diff --git a/src/src/Edit/Interface/edit_interface.cpp 
> b/src/src/Edit/Interface/edit_interface.cpp
> index a035b5a..9443cc0 100644
> --- a/src/src/Edit/Interface/edit_interface.cpp
> +++ b/src/src/Edit/Interface/edit_interface.cpp
> @@ -261,26 +261,36 @@ is_graphical (tree t) {
>  }
>  
>  void
> -edit_interface_rep::compute_env_rects (path p, rectangles& rs, bool recurse) 
> {
> +edit_interface_rep::compute_env_rects (path p,
> +    rectangles& rs, rectangles& tcrs, bool recurse) {
>    p= path_up (p);
>    if (p == rp) return;
>    tree st= subtree (et, p);
> -  if (is_atomic (st) ||
> +  if(is_func(st,TABLE)) {
> +    rectangles r;
> +    for(int i=0;i<N(st);i++)
> +        if(is_func(st[i],ROW))
> +            for(int j=0;j<N(st[i]);j++) {
> +                selection sel= eb->find_check_selection (p*i*j*0,p*i*j*1);
> +                r << sel->rs - ::correct(thicken(sel->rs,-pixel,-pixel));
> +            }
> +    tcrs << simplify(r);
> +    compute_env_rects (p, rs, tcrs, recurse);
> +  } else if (is_atomic (st) ||
>        drd->is_child_enforcing (st) ||
>        //is_document (st) || is_concat (st) ||
> -      is_func (st, TABLE) || is_func (st, SUBTABLE) ||
> +      is_func (st, SUBTABLE) ||
>        is_func (st, ROW) || is_func (st, TFORMAT) ||
>        is_graphical (st) ||
>        (is_func (st, WITH) && is_graphical (st[N(st)-1])) ||
>        (is_func (st, WITH) && is_func (st[N(st)-1], TEXT_AT)) ||
>        (is_compound (st, "math", 1) &&
>         is_compound (subtree (et, path_up (p)), "input")))
> -    compute_env_rects (p, rs, recurse);
> +    compute_env_rects (p, rs, tcrs, recurse);
>    else {
>      int new_mode= DRD_ACCESS_NORMAL;
>      if (get_init_string (MODE) == "src") new_mode= DRD_ACCESS_SOURCE;
>      int old_mode= set_access_mode (new_mode);
> -    tree st= subtree (et, p);
>      if (is_accessible_cursor (et, p * right_index (st)) || in_source ()) {
>        bool right;
>        path p1= p * 0, p2= p * 1, q1, q2;
> @@ -294,7 +304,7 @@ edit_interface_rep::compute_env_rects (path p, 
> rectangles& rs, bool recurse) {
>        rs << outline (sel->rs, pixel);
>      }
>      set_access_mode (old_mode);
> -    if (recurse) compute_env_rects (p, rs, recurse);
> +    if (recurse) compute_env_rects (p, rs, tcrs, recurse);
>    }
>  }
>  
> @@ -457,8 +467,14 @@ edit_interface_rep::apply_changes () {
>      oc= copy (cu);
>  
>      rectangles old_rects= env_rects;
> +    rectangles old_tc_rects= tblcell_rects;
>      env_rects= rectangles ();
> -    compute_env_rects (path_up (tp), env_rects, true);
> +    tblcell_rects= rectangles ();
> +    compute_env_rects (path_up (tp), env_rects, tblcell_rects, true);
> +    if (tblcell_rects != old_tc_rects) {
> +      invalidate (old_tc_rects);
> +      invalidate (tblcell_rects);
> +    }
>      if (env_rects != old_rects) {
>        invalidate (old_rects);
>        invalidate (env_rects);
> diff --git a/src/src/Edit/Interface/edit_interface.hpp 
> b/src/src/Edit/Interface/edit_interface.hpp
> index 05cf7d8..dbf5c85 100644
> --- a/src/src/Edit/Interface/edit_interface.hpp
> +++ b/src/src/Edit/Interface/edit_interface.hpp
> @@ -55,6 +55,7 @@ protected:
>    bool          table_selection;
>    rectangles    selection_rects;
>    rectangles    env_rects;
> +  rectangles    tblcell_rects;
>    cursor        oc;
>    bool          temp_invalid_cursor;
>    array<string> completions;
> @@ -110,7 +111,7 @@ public:
>    void animate ();
>  
>    /* miscellaneous */
> -  void compute_env_rects (path p, rectangles& rs, bool recurse);
> +  void compute_env_rects (path p, rectangles& rs, rectangles& trs, bool 
> recurse);
>    void cursor_visible ();
>    void selection_visible ();
>    void full_screen_mode (bool flag);
> diff --git a/src/src/Edit/Interface/edit_repaint.cpp 
> b/src/src/Edit/Interface/edit_repaint.cpp
> index 69a1efd..08a2a6b 100644
> --- a/src/src/Edit/Interface/edit_repaint.cpp
> +++ b/src/src/Edit/Interface/edit_repaint.cpp
> @@ -35,9 +35,15 @@ edit_interface_rep::draw_text (renderer ren, rectangles& 
> l) {
>  void
>  edit_interface_rep::draw_env (renderer ren) {
>    if (!full_screen) {
> -    rectangles rs= env_rects;
> +    rectangles rs= tblcell_rects;
>      while (!is_nil (rs)) {
> -      ren->set_color (rgb_color (0, 255, 255));
> +      ren->set_color (rgb_color (224, 224, 224));
> +      ren->fill (rs->item->x1, rs->item->y1, rs->item->x2, rs->item->y2);
> +      rs= rs->next;
> +    }
> +    rs= env_rects;
> +    while (!is_nil (rs)) {
> +      ren->set_color (rgb_color (162, 224, 224));
>        ren->fill (rs->item->x1, rs->item->y1, rs->item->x2, rs->item->y2);
>        rs= rs->next;
>      }
> -- 
> 1.6.3.3
> 

> _______________________________________________
> Texmacs-dev mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/texmacs-dev





reply via email to

[Prev in Thread] Current Thread [Next in Thread]