Internal viewer no longer "jumps" when dragging the scrollbar.

Miguel.
This commit is contained in:
Miguel de Icaza 1999-02-26 07:26:40 +00:00
parent 8578ca5e2e
commit 9a938c3ae9
5 changed files with 44 additions and 33 deletions

View File

@ -1,5 +1,8 @@
1999-02-26 Miguel de Icaza <miguel@nuclecu.unam.mx> 1999-02-26 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gview.c (scrollbar_moved): Call view update here, with
update_gui = FALSE.
* gdesktop.c (desktop_icon_info_open): Add needs terminal support. * gdesktop.c (desktop_icon_info_open): Add needs terminal support.
* gnome-file-property-dialog.c (create_settings_pane): Add Needs * gnome-file-property-dialog.c (create_settings_pane): Add Needs

View File

@ -76,11 +76,11 @@ scrollbar_moved (GtkAdjustment *adj, WView *view)
/* To force a display */ /* To force a display */
view->dirty = max_dirt_limit + 1; view->dirty = max_dirt_limit + 1;
view_update (view); view_update (view, 0);
} }
void void
view_percent (WView *view, int p, int w) view_percent (WView *view, int p, int w, gboolean update_gui)
{ {
int percent; int percent;
char buffer [40]; char buffer [40];
@ -94,6 +94,9 @@ view_percent (WView *view, int p, int w)
if (strcmp (buffer, GTK_LABEL (view->gtk_percent)->label)) if (strcmp (buffer, GTK_LABEL (view->gtk_percent)->label))
gtk_label_set (GTK_LABEL (view->gtk_percent), buffer); gtk_label_set (GTK_LABEL (view->gtk_percent), buffer);
if (!update_gui)
return;
if (view->sadj){ if (view->sadj){
GtkAdjustment *adj = GTK_ADJUSTMENT (view->sadj); GtkAdjustment *adj = GTK_ADJUSTMENT (view->sadj);
@ -105,14 +108,13 @@ view_percent (WView *view, int p, int w)
gtk_signal_emit_by_name (GTK_OBJECT (adj), "changed"); gtk_signal_emit_by_name (GTK_OBJECT (adj), "changed");
} }
if ((int) adj->value != view->start_display){ if ((int) adj->value != view->start_display){
printf ("Value=%g s=%d\n", adj->value, view->start_display);
gtk_adjustment_set_value (adj, view->start_display); gtk_adjustment_set_value (adj, view->start_display);
} }
} }
} }
void void
view_status (WView *view) view_status (WView *view, gboolean update_gui)
{ {
char buffer [80]; char buffer [80];
@ -128,9 +130,9 @@ view_status (WView *view)
gtk_label_set (GTK_LABEL (view->gtk_bytes), buffer); gtk_label_set (GTK_LABEL (view->gtk_bytes), buffer);
if (view->hex_mode) if (view->hex_mode)
view_percent (view, view->edit_cursor - view->first, 0); view_percent (view, view->edit_cursor - view->first, 0, update_gui);
else else
view_percent (view, view->start_display - view->first, 0); view_percent (view, view->start_display - view->first, 0, update_gui);
} }
void void

View File

@ -1,3 +1,9 @@
1999-02-26 Miguel de Icaza <miguel@nuclecu.unam.mx>
* view.c (view_percent, view_update): Take an extra argument:
update_gui, which controls whether we want to update the displayed
region in the GUI version.
1999-02-25 Owen Taylor <otaylor@redhat.com> 1999-02-25 Owen Taylor <otaylor@redhat.com>
* fileopctx.h file.c: Moved recursive delete query * fileopctx.h file.c: Moved recursive delete query

View File

@ -352,7 +352,7 @@ put_editkey (WView *view, unsigned char key)
node->value = byte_val; node->value = byte_val;
} }
view->dirty++; view->dirty++;
view_update (view); view_update (view, TRUE);
move_right (view); move_right (view);
} }
@ -645,7 +645,7 @@ view_init (WView *view, char *_command, char *_file, int start_line)
#ifndef HAVE_X #ifndef HAVE_X
void void
view_percent (WView *view, int p, int w) view_percent (WView *view, int p, int w, gboolean update_gui)
{ {
int percent; int percent;
@ -665,7 +665,7 @@ view_percent (WView *view, int p, int w)
} }
void void
view_status (WView *view) view_status (WView *view, gboolean update_gui)
{ {
int w = view->widget.cols - (view->have_frame * 2); int w = view->widget.cols - (view->have_frame * 2);
int i; int i;
@ -695,9 +695,9 @@ view_status (WView *view)
} }
if (w - i > 4) if (w - i > 4)
if (view->hex_mode) if (view->hex_mode)
view_percent (view, view->edit_cursor - view->first, w); view_percent (view, view->edit_cursor - view->first, w, update_gui);
else else
view_percent (view, view->start_display - view->first, w); view_percent (view, view->start_display - view->first, w, update_gui);
} }
attrset (SELECTED_COLOR); attrset (SELECTED_COLOR);
} }
@ -1010,14 +1010,14 @@ view_place_cursor (WView *view)
} }
void void
view_update (WView *view) view_update (WView *view, gboolean update_gui)
{ {
static int dirt_limit = 1; static int dirt_limit = 1;
if (view->dirty > dirt_limit){ if (view->dirty > dirt_limit){
/* Too many updates skipped -> force a update */ /* Too many updates skipped -> force a update */
display (view); display (view);
view_status (view); view_status (view, update_gui);
view->dirty = 0; view->dirty = 0;
/* Raise the update skipping limit */ /* Raise the update skipping limit */
dirt_limit++; dirt_limit++;
@ -1028,14 +1028,14 @@ view_update (WView *view)
if (is_idle ()){ if (is_idle ()){
/* We have time to update the screen properly */ /* We have time to update the screen properly */
display (view); display (view);
view_status (view); view_status (view, update_gui);
view->dirty = 0; view->dirty = 0;
if (dirt_limit > 1) if (dirt_limit > 1)
dirt_limit--; dirt_limit--;
} else { } else {
/* We are busy -> skipping full update, /* We are busy -> skipping full update,
only the status line is updated */ only the status line is updated */
view_status (view); view_status (view, update_gui);
} }
/* Here we had a refresh, if fast scrolling does not work /* Here we had a refresh, if fast scrolling does not work
restore the refresh, although this should not happen */ restore the refresh, although this should not happen */
@ -1499,7 +1499,7 @@ search (WView *view, char *text, int (*search)(WView *, char *, char *, int))
if (p >= update_activate){ if (p >= update_activate){
update_activate += update_steps; update_activate += update_steps;
if (verbose){ if (verbose){
view_percent (view, p, w); view_percent (view, p, w, TRUE);
mc_refresh (); mc_refresh ();
} }
if (got_interrupt ()) if (got_interrupt ())
@ -1587,7 +1587,7 @@ block_search (WView *view, char *buffer, int len)
if (e >= update_activate){ if (e >= update_activate){
update_activate += update_steps; update_activate += update_steps;
if (verbose){ if (verbose){
view_percent (view, e, w); view_percent (view, e, w, TRUE);
mc_refresh (); mc_refresh ();
} }
if (got_interrupt ()) if (got_interrupt ())
@ -1743,7 +1743,7 @@ static void do_regexp_search (void *xview, char *regexp)
search (view, regexp, regexp_view_search); search (view, regexp, regexp_view_search);
/* Had a refresh here */ /* Had a refresh here */
view->dirty++; view->dirty++;
view_update (view); view_update (view, TRUE);
} }
static void do_normal_search (void *xview, char *text) static void do_normal_search (void *xview, char *text)
@ -1757,7 +1757,7 @@ static void do_normal_search (void *xview, char *text)
search (view, text, icase_search_p); search (view, text, icase_search_p);
/* Had a refresh here */ /* Had a refresh here */
view->dirty++; view->dirty++;
view_update (view); view_update (view, TRUE);
} }
/* }}} */ /* }}} */
@ -1789,7 +1789,7 @@ void toggle_wrap_mode (WView *view)
} }
view_labels (view); view_labels (view);
view->dirty++; view->dirty++;
view_update (view); view_update (view, TRUE);
return; return;
} }
view->wrap_mode = 1 - view->wrap_mode; view->wrap_mode = 1 - view->wrap_mode;
@ -1805,7 +1805,7 @@ void toggle_wrap_mode (WView *view)
} }
view_labels (view); view_labels (view);
view->dirty++; view->dirty++;
view_update (view); view_update (view, TRUE);
} }
/* Both views */ /* Both views */
@ -1830,7 +1830,7 @@ toggle_hex_mode (WView *view)
get_bottom_first (view, 1, 1); get_bottom_first (view, 1, 1);
view_labels (view); view_labels (view);
view->dirty++; view->dirty++;
view_update (view); view_update (view, TRUE);
} }
/* Both views */ /* Both views */
@ -1864,7 +1864,7 @@ goto_line (WView *view)
} }
view->dirty++; view->dirty++;
view->wrap_mode = saved_wrap_mode; view->wrap_mode = saved_wrap_mode;
view_update (view); view_update (view, TRUE);
} }
/* Both views */ /* Both views */
@ -1956,7 +1956,7 @@ change_viewer (WView *view)
g_free (t); g_free (t);
view_labels (view); view_labels (view);
view->dirty++; view->dirty++;
view_update (view); view_update (view, TRUE);
} }
} }
@ -1967,7 +1967,7 @@ change_nroff (WView *view)
altered_nroff_flag = 1; altered_nroff_flag = 1;
view_labels (view); view_labels (view);
view->dirty++; view->dirty++;
view_update (view); view_update (view, TRUE);
} }
/* Real view only */ /* Real view only */
@ -2286,7 +2286,7 @@ real_view_event (Gpm_Event *event, void *x)
int result; int result;
if (view_event ((WView *) x, event, &result)) if (view_event ((WView *) x, event, &result))
view_update ((WView *) x); view_update ((WView *) x, TRUE);
return result; return result;
} }
@ -2397,7 +2397,7 @@ view_hook (void *v)
view_init (view, 0, panel->dir.list [panel->selected].fname, 0); view_init (view, 0, panel->dir.list [panel->selected].fname, 0);
display (view); display (view);
view_status (view); view_status (view, TRUE);
} }
static int static int
@ -2417,7 +2417,7 @@ view_callback (Dlg_head *h, WView *v, int msg, int par)
case WIDGET_DRAW: case WIDGET_DRAW:
display (view); display (view);
view_status (view); view_status (view, TRUE);
break; break;
case WIDGET_CURSOR: case WIDGET_CURSOR:
@ -2430,7 +2430,7 @@ view_callback (Dlg_head *h, WView *v, int msg, int par)
if (view->view_quit) if (view->view_quit)
dlg_stop (h); dlg_stop (h);
else { else {
view_update (view); view_update (view, TRUE);
} }
return i; return i;
@ -2439,7 +2439,7 @@ view_callback (Dlg_head *h, WView *v, int msg, int par)
view->bottom_first = -1; view->bottom_first = -1;
move_to_bottom (view); move_to_bottom (view);
display (view); display (view);
view_status (view); view_status (view, TRUE);
sleep (1); sleep (1);
return 1; return 1;

View File

@ -117,9 +117,9 @@ int view_init (WView *view, char *_command, char *_file, int start_line);
int view_file (char *filename, int normal, int internal); int view_file (char *filename, int normal, int internal);
/* Internal view routines */ /* Internal view routines */
void view_status (WView *); void view_status (WView *, gboolean update_gui);
void view_percent (WView *, int, int); void view_percent (WView *, int p, int w, gboolean update_gui);
void view_update (WView *view); void view_update (WView *view, gboolean update_gui);
void view_labels (WView *view); void view_labels (WView *view);
int view_event (WView *view, Gpm_Event *event,int *result); int view_event (WView *view, Gpm_Event *event,int *result);
void toggle_wrap_mode (WView *); void toggle_wrap_mode (WView *);