GNOME Bugzilla – Bug 669542
Adding a feature to write vertically
Last modified: 2018-05-02 15:20:00 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 :)
Created attachment 206957 [details] test application for gtktextview widget
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.
Created attachment 206960 [details] [review] fixed the code style from Andre's comment thanks Andre Klapper!
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.
(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 ?
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)
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.
Created attachment 207079 [details] [review] fixed arrow keypress keypresses of arrow buttons are handled correctly in write-vertical mode
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 :)
*** Bug 746831 has been marked as a duplicate of this bug. ***
-- 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.