After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763217 - [month-view] draw just the outline on multi-day selection
[month-view] draw just the outline on multi-day selection
Status: RESOLVED FIXED
Product: gnome-calendar
Classification: Applications
Component: User Interface
3.19.x
Other Linux
: Normal normal
: 3.26
Assigned To: GNOME Calendar maintainers
GNOME Calendar maintainers
Depends on:
Blocks:
 
 
Reported: 2016-03-07 11:31 UTC by Marinus Schraal
Modified: 2017-04-17 18:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
month-view: beautify multi-day selection outline (2.56 KB, patch)
2016-03-07 11:36 UTC, Marinus Schraal
needs-work Details | Review
new selection (57.56 KB, image/png)
2016-03-07 11:38 UTC, Marinus Schraal
  Details
selection outline thick (57.43 KB, image/png)
2016-03-07 11:40 UTC, Marinus Schraal
  Details
month-view: fix line width inconsistencies (3.53 KB, patch)
2016-03-08 19:10 UTC, Marinus Schraal
none Details | Review
month-view: cleanup multi-row selection drawing (4.10 KB, patch)
2016-03-08 19:11 UTC, Marinus Schraal
none Details | Review
month-view: add selection background fill (920 bytes, patch)
2016-03-08 19:11 UTC, Marinus Schraal
committed Details | Review
month-view: fix line width inconsistencies (3.29 KB, patch)
2016-03-12 11:37 UTC, Marinus Schraal
committed Details | Review
month-view: cleanup multi-row selection drawing (4.31 KB, patch)
2016-03-12 11:37 UTC, Marinus Schraal
none Details | Review
month-view: cleanup multi-row selection drawing (4.30 KB, patch)
2016-03-12 13:48 UTC, Marinus Schraal
committed Details | Review

Description Marinus Schraal 2016-03-07 11:31:57 UTC
Currently the multi-day selection draws a number of boxes if more than one week is involved in the selection. Add a new draw mode for the irregular shaped box that just draws the outline.
Comment 1 Marinus Schraal 2016-03-07 11:36:38 UTC
Created attachment 323256 [details] [review]
month-view: beautify multi-day selection outline

Draw just the outline for the irregular shaped outline of multi-day
selection.
Comment 2 Marinus Schraal 2016-03-07 11:38:58 UTC
Created attachment 323257 [details]
new selection

the new outline
Comment 3 Marinus Schraal 2016-03-07 11:40:06 UTC
Created attachment 323258 [details]
selection outline thick

An example with a thick outline (since the other is very hard to actually see).
Comment 4 Georges Basile Stavracas Neto 2016-03-07 19:19:31 UTC
Review of attachment 323256 [details] [review]:

Code-wise, the patch looks good. Please, improve the commit message (follow the guidelines at [1]).

Also, I wonder if we could draw a slightly blued background on selected cells (if you manage to make that, please share a screenshot).

[1] https://wiki.gnome.org/Newcomers/CodeContributionWorkflow#Commit_guidelines

::: src/gcal-month-view.c
@@ +1694,3 @@
+         gint last_row = last_mark / 7;
+         gint first_column = first_mark % 7;
+         gint last_column = last_mark % 7;

Initialize the variables after declaring them (starts at "start_x = ...").

@@ +1697,3 @@
+
+         gint start_x, start_y, end_x, end_y;
+         gint max_x = cell_width * 7;

Ditto

@@ +1708,3 @@
+         cairo_move_to (cr, end_x + 10, end_y);
+         cairo_arc (cr, end_x, end_y, 10, 0, 2 * M_PI);
+         */

Remove this debug code.

@@ +1710,3 @@
+         */
+
+         cairo_move_to (cr, start_x + 0.3, start_y + 0.3);

Add a detailed comment explaining the logic of the line_to() calls.
Comment 5 Marinus Schraal 2016-03-08 19:10:27 UTC
Created attachment 323427 [details] [review]
month-view: fix line width inconsistencies

The line width used for the grid changed over time, resulting in
different values used at different places. Introduce a line_widht
variable and use it consistently throughout when drawing.
Comment 6 Marinus Schraal 2016-03-08 19:11:12 UTC
Created attachment 323428 [details] [review]
month-view: cleanup multi-row selection drawing

The selection mode was drawing a number of boxes on multi-row
selections, resulting in unwanted outlines within the selection area.
This patch adds a multirow mode that just draws the outline of a
selection.

Make cell_{width,height} integers so divison lines always get drawn on
exact grid coordinates, otherwise line calculations could result in
fuzzy lines.
Comment 7 Marinus Schraal 2016-03-08 19:11:53 UTC
Created attachment 323429 [details] [review]
month-view: add selection background fill
Comment 8 Georges Basile Stavracas Neto 2016-03-12 01:24:57 UTC
Review of attachment 323427 [details] [review]:

A small nitpick. Besides that, looks good.

::: src/gcal-month-view.c
@@ +1355,3 @@
   gint i, j, sw, lower_mark = 43, upper_mark = -2;
   gdouble start_grid_y, cell_width, cell_height, first_row_gap = 0.0;
+  gdouble line_width = 0.5;

Put this in a #define.
Comment 9 Georges Basile Stavracas Neto 2016-03-12 01:31:23 UTC
Review of attachment 323428 [details] [review]:

Code looks ok, needs only some style changes.

::: src/gcal-month-view.c
@@ -1646,3 @@
      cairo_set_line_width (cr, line_width);
 
-     /* horizontals */

Why did you remove this comment?

@@ +1649,3 @@
      if ((first_mark / 7) == (last_mark / 7))
        {
+         /* selection all on the same row */

Didn't understand the comment.

@@ +1714,3 @@
+         cairo_move_to (cr, start_x, start_y);
+         cairo_line_to (cr, max_x, start_y);
+         if (last_column == 6)

Jump a line before the 'if' and add a comment explaining the difference between drawing in the last column.

@@ +1724,3 @@
+             cairo_line_to (cr, end_x, end_y);
+           }
+         cairo_line_to (cr, (line_width / 2), end_y);

Jump a line between '}' and 'cairo_line_to(...)'.
Comment 10 Georges Basile Stavracas Neto 2016-03-12 01:35:03 UTC
Review of attachment 323429 [details] [review]:

LGTM.
Comment 11 Marinus Schraal 2016-03-12 11:37:29 UTC
Created attachment 323753 [details] [review]
month-view: fix line width inconsistencies

The line width used for the grid changed over time, resulting in
different values used at different places. Introduce a LINE_WIDTH
definition and use it consistently throughout when drawing.
Comment 12 Marinus Schraal 2016-03-12 11:37:44 UTC
Created attachment 323754 [details] [review]
month-view: cleanup multi-row selection drawing

The selection mode was drawing a number of boxes on multi-row
selections, resulting in unwanted outlines within the selection area.
This patch adds a multirow mode that just draws the outline of a
selection.

Make cell_{width,height} integers so divison lines always get drawn on
exact grid coordinates, otherwise line calculations could result in
fuzzy lines.
Comment 13 Marinus Schraal 2016-03-12 11:41:34 UTC
(In reply to Georges Basile Stavracas Neto from comment #9)
> Review of attachment 323428 [details] [review] [review]:
> -     /* horizontals */
> 
> Why did you remove this comment?

Horizontals is not really what it is anymore and the comments have been moved into the 'if (else)' parts.

> 
> @@ +1649,3 @@
>       if ((first_mark / 7) == (last_mark / 7))
>         {
> +         /* selection all on the same row */
> 
> Didn't understand the comment.

clarified
Comment 14 Marinus Schraal 2016-03-12 13:48:34 UTC
Created attachment 323758 [details] [review]
month-view: cleanup multi-row selection drawing

The selection mode was drawing a number of boxes on multi-row
selections, resulting in unwanted outlines within the selection area.
This patch adds a multirow mode that just draws the outline of a
selection.

Make cell_{width,height} integers so divison lines always get drawn on
exact grid coordinates, otherwise line calculations could result in
fuzzy lines.
Comment 15 Georges Basile Stavracas Neto 2016-03-13 01:00:47 UTC
Thanks for your work on this issue.

Attachment 323429 [details] pushed as 8a72bf0 - month-view: add selection background fill
Attachment 323753 [details] pushed as 0fce5ba - month-view: fix line width inconsistencies
Attachment 323758 [details] pushed as 0ce85f6 - month-view: cleanup multi-row selection drawing