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 669542 - Adding a feature to write vertically
Adding a feature to write vertically
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkTextView
3.0.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
: 746831 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-02-07 08:42 UTC by nagi
Modified: 2018-05-02 15:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for write-vertical property (39.81 KB, patch)
2012-02-07 08:42 UTC, nagi
needs-work Details | Review
test application for gtktextview widget (1.61 KB, application/x-compressed-tar)
2012-02-07 08:44 UTC, nagi
  Details
fixed the code style from Andre's comment (52.52 KB, patch)
2012-02-07 10:16 UTC, nagi
needs-work Details | Review
write-vertical property added to gtktextview (26.68 KB, patch)
2012-02-07 11:55 UTC, nagi
none Details | Review
fixed hard coded cairo x position (27.00 KB, patch)
2012-02-08 07:53 UTC, nagi
none Details | Review
fixed arrow keypress (27.65 KB, patch)
2012-02-08 10:45 UTC, nagi
none Details | Review
scrolling direction is detected, but scrolls strange (46.36 KB, patch)
2012-02-11 13:44 UTC, nagi
none Details | Review

Description nagi 2012-02-07 08:42:41 UTC
Created attachment 206956 [details] [review]
patch for write-vertical property

Found no way to write vertically on the gtktextview widget.
So this is my attempt. The new "write-vertical" property is added in gtktextview.
You can see first result on youtube: 

http://www.youtube.com/watch?feature=player_embedded&v=BpcO-DxzNfg

The patch from my branch and the test application are attached.

here are the lists about what are not completed or issues: (note that, there is no issue when writing horizontally!)
- scrollbar handling
- start drawing x position is hard coded (gtktextdisplay.c:879).
  So text will be disappear when the font size is changed!

- Select All - select all line except first and last line.
- Partial selection doesn't show blue background
- cursor blinks only once :)
- need to change keyboard arrow direction when vertically write

First two issues are important to me. As a mongolian, it is really nice to write vertically with gtk widget :)
Comment 1 nagi 2012-02-07 08:44:33 UTC
Created attachment 206957 [details]
test application for gtktextview widget
Comment 2 André Klapper 2012-02-07 09:34:36 UTC
Review of attachment 206956 [details] [review]:

Somebody else has to comment on technical things, I only provide some style comments.

::: gtk/gtkstylecontext.c
@@ +4702,3 @@
     }
 
+  cairo_save(cr); //nagi

Please clean up / remove all your "//nagi"" comments.
Please keep the code style around, which means having a whitespace in front of an opening braket.

::: gtk/gtktextdisplay.c
@@ +637,3 @@
           gdk_cairo_set_source_rgba (cr, &selection);
+          cairo_rotate(cr, M_PI/2);
+          //pango_cairo_update_layout(text_renderer->cr, line_display->layout);

Please don't add unused commented code. Remove it instead. This happens in several places of your patch.

@@ +641,2 @@
                            line_display->left_margin, selection_y,
+                           screen_width, selection_height); //nagi added

Please remove "//nagi added" comments.

@@ +716,2 @@
 	      text_renderer_set_state (text_renderer, SELECTED);
+        cairo_rotate(text_renderer->cr, M_PI/2);//nagi

The indentation is not aligned with the rest.

@@ +952,3 @@
+      if(write_vertical){
+        cairo_translate (cr, line_display->height, 0); //nagi
+      }else{

Please check the if/else style of other code in this file (e.g. }else{ should be one three lines), plus use proper whitespacing.

::: gtk/gtktextview.h
@@ +255,3 @@
 						       gboolean		 accepts_tab);
+/* write vertical */
+void		 gtk_text_view_set_write_vertical        (GtkTextView	*text_view,

Please align the spacing of the second third and fourth "column" with the rest of the file.
Comment 3 nagi 2012-02-07 10:16:25 UTC
Created attachment 206960 [details] [review]
fixed the code style from Andre's comment

thanks Andre Klapper!
Comment 4 André Klapper 2012-02-07 10:25:05 UTC
Comment on attachment 206960 [details] [review]
fixed the code style from Andre's comment

The patch has still exactly the problem that I described before.
Comment 5 nagi 2012-02-07 10:35:19 UTC
(In reply to comment #4)
> (From update of attachment 206960 [details] [review])
> The patch has still exactly the problem that I described before.

Sorry Andre, now i'm a little bit confused... After i corrected and commited on my branch, i created the patch with the following command:

> git format-patch master --stdout > foo.patch

I also see your described problems in the patch file. Could you tell me that, is this the right way to create a patch ?
Comment 6 nagi 2012-02-07 11:55:34 UTC
Created attachment 206975 [details] [review]
write-vertical property added to gtktextview

Sorry Andre! this time i hope that is the correct patch.

(made with git diff --no-prefix master..HEAD)
Comment 7 nagi 2012-02-08 07:53:52 UTC
Created attachment 207061 [details] [review]
fixed hard coded cairo x position

hard coded start x position is fixed. So it can display text with bigger font styles.
Comment 8 nagi 2012-02-08 10:45:49 UTC
Created attachment 207079 [details] [review]
fixed arrow keypress

keypresses of arrow buttons are handled correctly in write-vertical mode
Comment 9 nagi 2012-02-11 13:44:50 UTC
Created attachment 207338 [details] [review]
scrolling direction is detected, but scrolls strange

It works somehow,, but i couldn't locate the problem for strange effect after scrolling. (looks like it scrolls in both direction... )
I'm trying to resolve this bug sine a week. If somebody else has any idea on it, let me know please :)
Comment 10 Daniel Boles 2017-08-24 23:59:22 UTC
*** Bug 746831 has been marked as a duplicate of this bug. ***
Comment 11 GNOME Infrastructure Team 2018-05-02 15:20:00 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/382.