Accepting request 1199613 from graphics

- Add patches based on upstream commits
  * f3466c.patch
  * a038d6.patch
  * 042708.patch
  * 7e0157.patch
  https://sourceforge.net/p/mcj/tickets/179/ aka bug boo#1230298
  User defined text brakes Dimension Lines

OBS-URL: https://build.opensuse.org/request/show/1199613
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/xfig?expand=0&rev=58
This commit is contained in:
Ana Guerrero 2024-09-09 12:45:32 +00:00 committed by Git OBS Bridge
commit a84fd47c41
6 changed files with 296 additions and 0 deletions

124
042708.patch Normal file
View File

@ -0,0 +1,124 @@
From 042708a455f264e5b78d55f4df51ce3e508cc2ba Mon Sep 17 00:00:00 2001
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
Date: Mon, 2 Sep 2024 21:01:08 +0200
Subject: [PATCH] Place the dimension line text into the widget, #179
Draw the text that should appear in the example dimension line into
the dimension line widget, not onto the canvas.
---
src/w_indpanel.c | 45 +++++++++++++++++++++++++++++----------------
1 file changed, 29 insertions(+), 16 deletions(-)
diff --git src/w_indpanel.c src/w_indpanel.c
index 95218fd..bde8298 100644
--- src/w_indpanel.c
+++ src/w_indpanel.c
@@ -2499,7 +2499,6 @@ static Widget tick_thick_w;
static Widget box_thick_w, font_size_w, dimline_style_panel;
static Widget left_arrow_type_panel, right_arrow_type_panel;
static Widget font_button;
-static Pixmap dimline_examp_pixmap = (Pixmap) 0;
static Widget exampline;
static Widget fixed_chk, actual_chk;
static Widget dimline_precw;
@@ -2599,15 +2598,7 @@ void popup_dimline_panel(ind_sw_info *isw)
/* make an example line that shows current settings as a label */
- /* make a pixmap to draw it into */
- if (dimline_examp_pixmap == (Pixmap) 0)
- dimline_examp_pixmap = XCreatePixmap(tool_d, canvas_win,
- DIMLINE_PIXMAP_WIDTH, DIMLINE_PIXMAP_HEIGHT, tool_dpth);
- /* clear it */
- XFillRectangle(tool_d, dimline_examp_pixmap, ind_blank_gc, 0, 0,
- DIMLINE_PIXMAP_WIDTH, 30);
-
- /* now make the label widget to display the pixmap */
+ /* make the label widget to display the pixmap */
FirstArg(XtNfromVert, below);
NextArg(XtNborderWidth, 0);
NextArg(XtNwidth, DIMLINE_PIXMAP_WIDTH);
@@ -2619,7 +2610,9 @@ void popup_dimline_panel(ind_sw_info *isw)
NextArg(XtNinternational, False);
exampline = XtCreateManagedWidget("", labelWidgetClass,
form, Args, ArgCount);
- draw_cur_dimline(); /* this draws it into dimline_examp_pixmap */
+
+ /* draws the example dimension line into the label */
+ draw_cur_dimline();
/******************************/
/* frame for Line information */
@@ -3098,6 +3091,7 @@ void draw_cur_dimline(void)
F_compound *dimline_example;
F_point *point;
Boolean save_showlen, save_shownums;
+ static Pixmap dimline_examp_pixmap = (Pixmap)0;
/* make the a dimension line */
line = create_line();
@@ -3114,8 +3108,15 @@ void draw_cur_dimline(void)
/* make it 3-3/4 inches long */
append_point((int)((appres.INCHES? DIMLINE_IP_LENGTH*PIX_PER_INCH:
DIMLINE_SI_LENGTH*PIX_PER_CM)+75), 275, &point);
- /* make a dimension line from that line */
- dimline_example = create_dimension_line(line, False);
+
+ /*
+ * With xfig -debug, create_dimension_line() already draws the bounding
+ * boxes of some elements into the canvas. First create the pixmap to draw
+ * the dimension line into.
+ */
+ if (!dimline_examp_pixmap)
+ dimline_examp_pixmap = XCreatePixmap(tool_d, canvas_win,
+ DIMLINE_PIXMAP_WIDTH, DIMLINE_PIXMAP_HEIGHT, tool_dpth);
/* clear it */
XFillRectangle(tool_d, dimline_examp_pixmap, ind_blank_gc, 0, 0,
@@ -3127,8 +3128,19 @@ void draw_cur_dimline(void)
appres.showlengths = appres.shownums = False;
/* now draw it into our pixmap */
- canvas_win = (Window) dimline_examp_pixmap;
+ canvas_win = (Window)dimline_examp_pixmap;
+ XftDrawChange(canvas_draw, dimline_examp_pixmap);
preview_in_progress = True;
+
+ /* Now create an (empty) dimension line compound, with the side effect that
+ * under appres.DEBUG some boxes are drawn. */
+ if ((dimline_example = create_dimension_line(line, False)) == NULL) {
+ free_linestorage(line);
+ XFreePixmap(tool_d, dimline_examp_pixmap);
+ dimline_examp_pixmap = (Pixmap)0;
+ return;
+ }
+
/* locate the line components of the dimension line */
dimline_components(dimline_example, &line, &tick1, &tick2, &poly);
draw_line(line,PAINT);
@@ -3141,6 +3153,7 @@ void draw_cur_dimline(void)
/* restore the canvas */
canvas_win = main_canvas;
+ XftDrawChange(canvas_draw, main_canvas);
/* and the showlengths and shownums settings */
appres.showlengths = save_showlen;
appres.shownums = save_shownums;
@@ -3148,12 +3161,12 @@ void draw_cur_dimline(void)
/* fool the toolkit... you know the drill by now */
XtUnmanageChild(exampline);
- FirstArg(XtNbitmap, (Pixmap) 0);
+ FirstArg(XtNbitmap, (Pixmap)0);
SetValues(exampline);
FirstArg(XtNbitmap, dimline_examp_pixmap);
SetValues(exampline);
XtManageChild(exampline);
- /* finally, free the dimline */
+ /* finally, free the dimline and the pixmap*/
free_compound(&dimline_example);
}
--
2.35.3

56
7e0157.patch Normal file
View File

@ -0,0 +1,56 @@
From 7e0157b422b696d848c312aace78c89f3f914192 Mon Sep 17 00:00:00 2001
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
Date: Mon, 2 Sep 2024 21:30:00 +0200
Subject: [PATCH] Correctly scale the example dimension line in the widget
Draw the example dimension line into the correct position into its
widget. Before, moving the canvas, probably changing the zoom, then
entering line drawing mode and clicking on the dimension line widget in
the indicator panel would not render the example line correctly.
---
src/w_indpanel.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git src/w_indpanel.c src/w_indpanel.c
index bde8298..5ab33f6 100644
--- src/w_indpanel.c
+++ src/w_indpanel.c
@@ -3091,6 +3091,9 @@ void draw_cur_dimline(void)
F_compound *dimline_example;
F_point *point;
Boolean save_showlen, save_shownums;
+ int save_zoomxoff, save_zoomyoff;
+ float save_zoomscale;
+ float save_display_zoomscale;
static Pixmap dimline_examp_pixmap = (Pixmap)0;
/* make the a dimension line */
@@ -3126,6 +3129,14 @@ void draw_cur_dimline(void)
save_showlen = appres.showlengths;
save_shownums = appres.shownums;
appres.showlengths = appres.shownums = False;
+ /* and draw at scale 1 into the correct position */
+ save_zoomxoff = zoomxoff;
+ save_zoomyoff = zoomyoff;
+ save_zoomscale = zoomscale;
+ save_display_zoomscale = display_zoomscale;
+ zoomxoff = zoomyoff = 0;
+ display_zoomscale = 1.0f;
+ zoomscale = display_zoomscale / ZOOM_FACTOR;
/* now draw it into our pixmap */
canvas_win = (Window)dimline_examp_pixmap;
@@ -3157,6 +3168,10 @@ void draw_cur_dimline(void)
/* and the showlengths and shownums settings */
appres.showlengths = save_showlen;
appres.shownums = save_shownums;
+ zoomxoff = save_zoomxoff;
+ zoomyoff = save_zoomyoff;
+ zoomscale = save_zoomscale;
+ display_zoomscale = save_display_zoomscale;
preview_in_progress = False;
/* fool the toolkit... you know the drill by now */
--
2.35.3

33
a038d6.patch Normal file
View File

@ -0,0 +1,33 @@
From a038d6624eb0bb4479d11f5b2bf472714c200365 Mon Sep 17 00:00:00 2001
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
Date: Sun, 1 Sep 2024 23:00:42 +0200
Subject: [PATCH] Do not lose input in xfig -debug mode
Starting with xfig -debug, entering line drawing mode and clicking on
the dimension line attributes in the indicator panel (below the canvas)
would lose the input, one has to quit xfig from the window manager or by
signal.
---
src/w_indpanel.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git src/w_indpanel.c src/w_indpanel.c
index 5ab33f6..9e4755b 100644
--- src/w_indpanel.c
+++ src/w_indpanel.c
@@ -2995,10 +2995,8 @@ void popup_dimline_panel(ind_sw_info *isw)
actions_added = True;
}
- if (appres.DEBUG)
- XtPopup(choice_popup, XtGrabNone); /* makes debugging easier */
- else
- XtPopup(choice_popup, XtGrabExclusive);
+ XtPopup(choice_popup, XtGrabExclusive);
+
/* if the file message window is up add it to the grab */
file_msg_add_grab();
(void) XSetWMProtocols(tool_d, XtWindow(choice_popup), &wm_delete_window, 1);
--
2.35.3

63
f3466c.patch Normal file
View File

@ -0,0 +1,63 @@
Based on f3466c988d67b90d8767c8173d9fae1b64211759 Mon Sep 17 00:00:00 2001
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
Date: Mon, 2 Sep 2024 21:57:04 +0200
Subject: [PATCH] With xfig -debug, do not draw bounding boxes into widgets
Do not draw bounding boxes into the example libraries and
example dimension line.
---
src/u_draw.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git src/u_draw.c src/u_draw.c
index 71edbab..22740db 100644
--- src/u_draw.c
+++ src/u_draw.c
@@ -3,7 +3,7 @@
* Copyright (c) 1985-1988 by Supoj Sutanthavibul
* Parts Copyright (c) 1989-2015 by Brian V. Smith
* Parts Copyright (c) 1991 by Paul King
- * Parts Copyright (c) 2016-2023 by Thomas Loimer
+ * Parts Copyright (c) 2016-2024 by Thomas Loimer
*
* Parts Copyright (c) 1992 by James Tough
* Parts Copyright (c) 1998 by Georg Stemmer
@@ -1336,7 +1336,7 @@ void draw_text(F_text *text, int op)
return;
/* outline the text bounds in red if debug resource is set */
- if (appres.DEBUG) {
+ if (appres.DEBUG && !preview_in_progress) {
pw_vector(canvas_win, x1, y1, x2, y2, op, 1, RUBBER_LINE, 0.0, RED);
pw_vector(canvas_win, x2, y2, x3, y3, op, 1, RUBBER_LINE, 0.0, RED);
pw_vector(canvas_win, x3, y3, x4, y4, op, 1, RUBBER_LINE, 0.0, RED);
@@ -1593,7 +1593,7 @@ void clip_arrows(F_line *obj, int objtype, int op, int skip)
}
n = i;
/* draw the clipping area for debugging */
- if (appres.DEBUG) {
+ if (appres.DEBUG && !preview_in_progress) {
for (i=0; i<n; i++) {
if (i==n-1)
j=0;
@@ -1632,7 +1632,7 @@ void clip_arrows(F_line *obj, int objtype, int op, int skip)
}
n = i;
/* draw the clipping area for debugging */
- if (appres.DEBUG) {
+ if (appres.DEBUG && !preview_in_progress) {
int j;
for (i=0; i<n; i++) {
if (i==n-1)
@@ -2127,7 +2127,7 @@ void debug_depth(int depth, int x, int y)
char str[10];
PR_SIZE size;
- if (appres.DEBUG) {
+ if (appres.DEBUG && !preview_in_progress) {
sprintf(str,"%d",depth);
size = textsize(roman_font, strlen(str), str);
pw_text(canvas_win, x-size.length-round(3.0/zoomscale), round(y-3.0/zoomscale),
--
2.35.3

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Mon Sep 9 08:00:03 UTC 2024 - Dr. Werner Fink <werner@suse.de>
- Add patches based on upstream commits
* f3466c.patch
* a038d6.patch
* 042708.patch
* 7e0157.patch
https://sourceforge.net/p/mcj/tickets/179/ aka bug boo#1230298
User defined text brakes Dimension Lines
-------------------------------------------------------------------
Wed Aug 28 07:01:39 UTC 2024 - Dr. Werner Fink <werner@suse.de>

View File

@ -46,6 +46,11 @@ Patch8: Sanitize-a-call-to-realloc-ticket-165.patch
Patch9: Fix-exporting-only-active-layers-ticket-163.patch
# PATCH-FIX-UPSTREAM
Patch10: xfig-3.2.9-gcc14.patch
# PATCH-FIX-UPSTREAM for boo#1230298 / upstream bug report #179
Patch11: 042708.patch
Patch12: 7e0157.patch
Patch13: a038d6.patch
Patch14: f3466c.patch
BuildRequires: dos2unix
BuildRequires: fdupes
BuildRequires: flex
@ -112,6 +117,10 @@ set -x
%patch -P8 -p1
%patch -P9 -p1
%patch -P10
%patch -P11
%patch -P12
%patch -P13
%patch -P14
cp %{SOURCE1} .
test ! -e Libraries/Examples/aircraft.fig || { echo forbidden file found 1>&2; exit 1; }