Menu

scrolling

daeth1
2004-08-09
2013-03-13
  • daeth1

    daeth1 - 2004-08-09

    allow scrolling with mouse wheel..new text is still displayed in bottom 1/4, but upper part of window is halted at where you scrolled to, this will make it easier to read something if you suddenly get spammed with text scroll

     
    • Anonymous

      Anonymous - 2007-01-15

      just a few thoughts about scrolling:

      would be cool if scrolling (as in zmud) would split the window in two parts and scrolling will happen in the upper stationary part while the lower part still shows what happens in the mud. There also should be a key bound to switching the splitscreen on and off. enabling the switchscreen should result in showing the newest information first...

      ahh .. well i just use the 0.5 binary version .. maybe these things have been inserted already ... sorry then

       
      • Gabriele Greco

        Gabriele Greco - 2007-01-15

        Actually you can do something similar with the TAB key, but the not scrolling part of the text is in the topmost part of the window. I don't understand exactly what do you want to do, this functionality is very similar to the zmud one (at least of the 4.x version I used a lot :) )

        Bye,
        Gabry

         
        • Anonymous

          Anonymous - 2008-10-06

          you mentioned zmud 4.x.

          in zmud 4.x you had to hit the 'scroll'-key to split the window into an upper and lower part. when you then hit the 'pg-up' or 'pg-down' keys only the upper part scrolled accordingly. the lower part always showed the actual data sent by mud or client.

          when i hit the tab-key (only works when i have focused the window itself, does not work if the curser is in the command line) ggmud splits the window in 2 parts. then using 'pg-up' or 'pg-down' keys scroll the lower part which is not very comfortable as the client scrolls immediately down to the bottom as soon as a new message by mud or client is received.

          it would be far more convenient if the 'pg-up' and 'pg-down' keys only scroll the upper part of the window (and maybe even trigger the splitting of the window if its not already split).

          Maybe you could point out, in which files this behaviour is coded. My C is rather rusty, but if i can get some time i could take a look and make a suggestion for the implementions.

          best regards,

          Ingo

           
          • Gabriele Greco

            Gabriele Greco - 2008-10-06

            That's a very intresting behaviour, I'll try to implement it in SVN as soon as possible. TAB splits the window only if you focus out the input widget because inside the widget tab is used to autocomplete words... Using pgup/down will let you activate the split without moving the focus.

             
            • Anonymous

              Anonymous - 2008-10-07

              first attempt looks great :-)

              just compiled it for linux under linux .. at least that works fine for me :-)

              just the lower part of the split window is still scrolling next to the upper part. i think it would be cool if that part would not scroll ...

              *thumbs up* :-)

              best regards,

              Ingo

               
              • Gabriele Greco

                Gabriele Greco - 2008-10-08

                > just the lower part of the split window is still scrolling next to the upper part. i think it would be cool if that part would not scroll ... 

                I'm working on this, it's a problem with default behaviour of GTK widget, I asked on the GTK mailing list without much luck...

                Please note than MSP protocol work is not completed on the SVN version.

                 
                • Anonymous

                  Anonymous - 2008-10-09

                  Hi again ..

                  in ggmud.c__line_73 i was a little confused why you put the pg-dn and pg-up check into the GDK_KEY_RELEASE as KEY_RELEASE is not even a repeatable event. Therefore I just put lines 75-105 into the GDK_KEY_PRESS put the check_macro-call as else branch to the pg-dn/pg-up-check ...

                  result is that now pg-dn/pg-up only works the upper part of the split-window and keeping those pressed also repeats scrolling. the lower window part is left alone .. i think with that slight modification that would be a perfect copy of the zmud behaviour... well at least it is like i remember it and quite a lot more fun and less troubling than before

                  old code (lines 73 - 109) ======================
                     if (event->type == GDK_KEY_RELEASE) {

                         if (event->keyval == GDK_Page_Up || event->keyval == GDK_Page_Down) {
                             if (mud && mud->review && GTK_WIDGET_VISIBLE(mud->review)) {
                                 GdkRectangle rect;
                                 GtkTextIter iter;
                                 GtkTextView *tv = GTK_TEXT_VIEW(GTK_BIN(mud->review)->child);

                                 if (!tv)
                                     return FALSE;

                                 gtk_text_view_get_visible_rect(tv, &rect);

                                 if (event->keyval == GDK_Page_Up) {
                                     int pos = rect.y - rect.height;
                                     if (pos < 0) pos = 0;

                                     gtk_text_view_get_line_at_y(tv, &iter, pos, NULL);
                                 }
                                 else
                                     gtk_text_view_get_line_at_y(tv, &iter, rect.y + rect.height, NULL);
                                
                                 gtk_text_view_scroll_to_iter(tv, &iter, 0.0, TRUE, 0.0, 0.0);
                             }
                             else  {
                                 GtkWidget *review_toggle = lookup_widget(mud->window, "togglebutton_review");

                                 gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (review_toggle), TRUE);
                                 gtk_widget_show(mud->review);
                             }

                             return TRUE;
                         }
                     }
                     else if (event->type == GDK_KEY_PRESS)
                         return check_macro(event->state ,
                                 gdk_keyval_to_upper(event->keyval));
                  =================== end old code

                  replaced by my little modification

                  new code ===========================
                     if (event->type == GDK_KEY_RELEASE) {
                      // nothing yet
                     }
                     else if (event->type == GDK_KEY_PRESS)
                         if (event->keyval == GDK_Page_Up || event->keyval == GDK_Page_Down) {
                             if (mud && mud->review && GTK_WIDGET_VISIBLE(mud->review)) {
                                 GdkRectangle rect;
                                 GtkTextIter iter;
                                 GtkTextView *tv = GTK_TEXT_VIEW(GTK_BIN(mud->review)->child);

                                 if (!tv)
                                     return FALSE;

                                 gtk_text_view_get_visible_rect(tv, &rect);

                                 if (event->keyval == GDK_Page_Up) {
                                     int pos = rect.y - rect.height;
                                     if (pos < 0) pos = 0;

                                     gtk_text_view_get_line_at_y(tv, &iter, pos, NULL);
                                 }
                                 else
                                     gtk_text_view_get_line_at_y(tv, &iter, rect.y + rect.height, NULL);
                                
                                 gtk_text_view_scroll_to_iter(tv, &iter, 0.0, TRUE, 0.0, 0.0);
                             }
                             else  {
                                 GtkWidget *review_toggle = lookup_widget(mud->window, "togglebutton_review");

                                 gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (review_toggle), TRUE);
                                 gtk_widget_show(mud->review);
                             }

                             return TRUE;
                         } else {
                             return check_macro(event->state ,
                                     gdk_keyval_to_upper(event->keyval));
                         }
                  ======================= end of new code

                  maybe you wanna try and see if the mod would be ok for you .. of course you actually wouldnt need the GDK_KEY_RELEASE-part that way

                  btw are there any recommendable english books about GTK/GDK ?

                  best regards,

                  Ingo

                   
                  • Gabriele Greco

                    Gabriele Greco - 2008-10-09

                    I've just committed to SVN a new version with a clean fix of the scrolling problem and an attempt to fix the input buffer problem, please test it cause on my mud I've not been able to make ggmud crash anymore with huge text in input (I was able to crash it before the modification).

                    I don't know good books about GTK, there are a few nice tutorials on the net and the offical documentation at gtk.org is not bad.

                    There is also a mailing list (gtk-app-devel)  where GTK core developers usually answer to most problems with the toolkit!

                     
                    • Anonymous

                      Anonymous - 2008-10-09

                      yup .. scrolling works great *cheers*

                      and yup again .. huge data input doesnt crash ggmud anymore

                      lovely guess you can soon go 1.0 then *snicker*

                      best regards,

                      Ingo

                       
                    • Anonymous

                      Anonymous - 2008-10-10

                      one more idea ... umm a kind of fine-tuning one

                      when you open review (backscroll) i think one would usually prefer to start from the bottom of the backscroll history instead of from the beginning as one usually would look for latest things that happened ... so what would you think about adding "scroll down to the bottom of mud->review" at the end of the else statement (after ggmud.c__line_73)

                      *whisper: no need for "if (event->type==GDK_KEY_PRESS) in line 78 btw as thats already checked in line 45 *blush* *scuffle* *

                      best regards,

                      Ingo

                       
    • Anonymous

      Anonymous - 2007-01-16

      Ahh the tab-key is a good start :-)

      I think when i use pg-up and pd-down buttons the scrolling should happen only in to topmost part of the window. The mainpart is not very convenient for scrolling, since as soon as the mud sends new data the window scrolls back to the bottom.

      In zmud when you scrolled using pg-up or pg-down only the topmost part of the window scrolled, meaning if then the mud sends data the view of the topmost part stays as it is. That way you have always the most actual data in the lower part of the window and the scrollable history in the upper part. (if split-view is enabled via tab... may be a bit buggy -> next paragraph)

      The tab-key works fine, but only if i hit the window with a mouse key first. Then i can hit tab and the split-view is enabled. When i then hit tab again, nothing happens. In order to use tab to disable the split-view i have to mouseclick the window first. I think the tab-key should work wherever you are in the window not just on window-in-focus-state. I think when the tab-key triggers the split-view the code sets the gui focus to the commandline .. as soon as the focus left the Window and rests on the commandline another hit on tab doesnt work. umm i hope my english was good enough to explain what i mean.

      (btw: i am using ubuntu linux and 0.5 binary for linux)

      incase you need assistance coding, i think i would love to join such a project ... well after i finished my exams end of april that is.

      CU

       

Log in to post a comment.