Subject: pkg/10470: A couple of user-color fixes for xfig
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jbernard@mines.edu>
List: netbsd-bugs
Date: 06/28/2000 15:42:12
>Number: 10470
>Category: pkg
>Synopsis: A couple of user-color fixes for xfig
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Jun 28 15:43:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Jim Bernard
>Release: June 27, 2000
>Organization:
Speaking for myself
>Environment:
System: NetBSD zoo 1.4Z NetBSD 1.4Z (ZOO-$Revision: 1.53 $) #0: Sat Jun 3 20:48:32 MDT 2000 jim@zoo:/home/tmp/compile/sys/arch/i386/compile/ZOO i386
>Description:
The current version of xfig has a nasty bug that prevents saving
user-defined colors from the current session. I reported it to
the maintainer, Brian Smith, who supplied me with a couple of patches
that fixed, in his words:
Four fixes here:
1. This fixes the bug that user colors defined in the current session aren't
saved with the figure.
2. Also the background color for the "locked" buttons weren't restored properly
when the lock was turned off
3. User colors in current figure would be lost if user previewed more than one
file before cancelling file popup
4. Only allowed 511 user colors instead of 512.
>How-To-Repeat:
Define a user color, use it for an object, save the fig file, load
the saved file and note the missing color definition (or read the
saved file and note the absence of a user-color definition).
>Fix:
From Brian Smith (suggested patch-file names and $NetBSD$ id's added):
# patch-ad:
$NetBSD$
--- w_color.c.orig Mon Jan 3 11:09:46 2000
+++ w_color.c Mon Jun 12 12:18:40 2000
@@ -250,7 +250,6 @@
choice_info *choice;
XColor col;
Pixel form_fg;
- XGCValues values;
Widget below, beside, stdForm, stdLabel;
Widget sb;
char str[8];
@@ -707,7 +706,8 @@
valScroll = XtCreateManagedWidget("valScroll", scrollbarWidgetClass,
mixingForm, Args, ArgCount);
- original_background = values.foreground;
+ /* get background color of redLocked to restore background for locked sliders */
+ XtVaGetValues(redLocked, XtNbackground, &(original_background), NULL);
bars_locked = 0;
XtAddCallback(redScroll, XtNjumpProc, Thumbed, (XtPointer)S_RED);
@@ -960,6 +960,8 @@
put_msg("No more user colors allowed");
modified[edit_fill] = True;
pick_memory(current_memory);
+ colorUsed[current_memory]=True;
+
}
/* delete a color memory (current_memory) from the user colors */
@@ -1020,6 +1022,7 @@
num_usr_cols);
return;
}
+ colorUsed[indx] = True;
}
/* count the number of unique user colors actually used by Fig objects */
@@ -1212,7 +1215,7 @@
/* if not, increment num_usr_cols */
if (indx>= num_usr_cols) {
- if (num_usr_cols >= MAX_USR_COLS-1)
+ if (num_usr_cols >= MAX_USR_COLS)
return -1;
if (use_exist)
num_usr_cols = indx+1;
@@ -1233,6 +1236,8 @@
colors[NUM_STD_COLS+indx] = user_colors[indx].pixel;
colorFree[indx] = False;
+ colorUsed[indx] = False;
+
/* if the color popup has been created create the widgets */
if (pen_color_button->panel) {
@@ -1397,6 +1402,7 @@
XFreeColors(tool_d, tool_cm, pixels, 1, 0);
/* now set free flag for that cell */
colorFree[indx] = True;
+ colorUsed[indx] = False;
}
/* if any object in the figure uses the user color "color" return True */
@@ -1903,8 +1909,11 @@
}
do_change = True;
- if (current_memory >= 0)
+ if (current_memory >= 0) {
StoreMix_and_Mem();
+ if (!colorUsed[current_memory])
+ colorUsed[current_memory] = True;
+ }
update_scrl_triple((Widget)NULL, (XEvent *)NULL,
(String *)NULL, (Cardinal *)NULL);
}
@@ -2058,6 +2067,8 @@
if (do_change) {
if (current_memory >= 0) {
StoreMix_and_Mem();
+ if (!colorUsed[current_memory])
+ colorUsed[current_memory] = True;
update_scrl_triple((Widget)NULL, (XEvent *)NULL,
(String *)NULL, (Cardinal *)NULL);
}
# patch-ae:
$NetBSD$
--- w_file.c.orig Tue Jan 11 14:03:33 2000
+++ w_file.c Mon Jun 12 12:18:40 2000
@@ -1206,8 +1206,10 @@
reset_layers();
/* save user colors in case preview changes them */
- save_user_colors();
- save_nuser_colors();
+ if (!user_colors_saved) {
+ save_user_colors();
+ save_nuser_colors();
+ }
/* make the cancel button sensitive */
XtSetSensitive(preview_stop, True);
>Release-Note:
>Audit-Trail:
>Unformatted: