mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-23 16:49:10 -07:00
app-office/dia: move 0.98 patches to devspace
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
DIST dia-0.97.3.tar.xz 5548500 BLAKE2B ab476ce48e57c1def01095a8d6d92208c11817580cfca1cfcf38af12943153116b31149ca187c65e5121ef9fb281bacc4c3e7f1726ed23b46ba14902faaaa34f SHA512 34298980be930b87cb4a636344e4cb2a7e43eedc00b0969a5e446cee9b74b616fdc8c798efcb9a5832b98741f2e20632a44037b2bcb436f59591d531ef441efa
|
||||
DIST dia-0.98-patches.tar.xz 7132 BLAKE2B 739e0b53254f457b3043cc1dd37afcf3862ed4301de017ffa10cf5a94d92c05cd48276bf7930347e04c803637dc233acbe36d739864b5808bdac743b02c59f8b SHA512 3812f9014564db39bacf945ef240445e45681a33f56e8bbaa4bf177ba3c8056f33656bec8b75de4fddbfd4f0f923ffe2e4f0af76673cb418226b868b57266ee0
|
||||
DIST dia-22534d16c317ee11714ef7221f9b635df233be9b.tar.bz2 9446286 BLAKE2B 17fa7c243c51d5ecf33156b77600d155f4245db958c1a434f4faca6387a10ff85786d68f0065c1f430cf35583141282a84ba0181bc31f8489c9309753156763a SHA512 6b2791d0127a86455de78767124d4564e7ea5bd318d84b1a830d07e571e398565527e9f41748cb1cddbee738cd28a670f107caad13958cac3a576e2a6a9c8726
|
||||
|
||||
@@ -11,6 +11,7 @@ MAN_DATE="2004-11-26"
|
||||
DESCRIPTION="Diagram/flowchart creation program"
|
||||
HOMEPAGE="https://wiki.gnome.org/Apps/Dia"
|
||||
SRC_URI="https://gitlab.gnome.org/GNOME/${PN}/-/archive/${COMMIT_HASH}/${PN}-${COMMIT_HASH}.tar.bz2"
|
||||
SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/dia-0.98-patches.tar.xz"
|
||||
S="${WORKDIR}/${PN}-${COMMIT_HASH}"
|
||||
|
||||
LICENSE="GPL-2+"
|
||||
@@ -49,9 +50,9 @@ BDEPEND="
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${PN}-0.98-revert_xpm_replacement.patch
|
||||
"${FILESDIR}"/${PN}-0.98-use_gtkfontbutton.patch
|
||||
"${FILESDIR}"/${PN}-0.98-deps_optional.patch
|
||||
"${WORKDIR}"/dia-0.98-patches/${PN}-0.98-revert_xpm_replacement.patch
|
||||
"${WORKDIR}"/dia-0.98-patches/${PN}-0.98-use_gtkfontbutton.patch
|
||||
"${WORKDIR}"/dia-0.98-patches/${PN}-0.98-deps_optional.patch
|
||||
)
|
||||
|
||||
pkg_setup() {
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
make the plugins w/ deps conditional
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -47,14 +47,14 @@ if xsltproc.found()
|
||||
endif
|
||||
|
||||
# Optional deps
|
||||
-libpoppler_dep = dependency('poppler', version: '> 21.03.0', required: false)
|
||||
-libpopplercpp_dep = dependency('poppler-cpp', required: false)
|
||||
+libpoppler_dep = dependency('poppler', version: '> 21.03.0', required: get_option('pdf'))
|
||||
+libpopplercpp_dep = dependency('poppler-cpp', required: get_option('pdf'))
|
||||
conf.set('HAVE_POPPLER', libpoppler_dep.found() and libpopplercpp_dep.found())
|
||||
-libemf_dep = cc.find_library('EMF', required: false)
|
||||
+libemf_dep = cc.find_library('EMF', required: get_option('wmf'))
|
||||
conf.set('HAVE_LIBEMF', libemf_dep.found())
|
||||
libogdf_dep = cc.find_library('ogdf', required: false)
|
||||
conf.set('HAVE_OGDF', libogdf_dep.found())
|
||||
-libxslt_dep = dependency('libxslt', required: false)
|
||||
+libxslt_dep = dependency('libxslt', required: get_option('xslt'))
|
||||
conf.set('HAVE_XSLT', libxslt_dep.found())
|
||||
# TODO: Why does Win32 break without this
|
||||
conf.set('ENABLE_NLS', true)
|
||||
--- a/meson_options.txt
|
||||
+++ b/meson_options.txt
|
||||
@@ -4,6 +4,18 @@ option('gtk_doc',
|
||||
option('doc',
|
||||
type: 'feature', deprecated: {'true': 'enabled', 'false': 'disabled'},
|
||||
description: 'Whether to generate the doc')
|
||||
+option('pdf',
|
||||
+ type: 'boolean', value: true,
|
||||
+ description: 'Whether to compile with pdf plugin')
|
||||
+option('python',
|
||||
+ type: 'boolean', value: true,
|
||||
+ description: 'Whether to compile with python plugin')
|
||||
option('tests',
|
||||
type: 'boolean', value: true,
|
||||
description: 'Whether to compile unit tests')
|
||||
+option('wmf',
|
||||
+ type: 'boolean', value: true,
|
||||
+ description: 'Whether to compile with wmf plugin')
|
||||
+option('xslt',
|
||||
+ type: 'boolean', value: true,
|
||||
+ description: 'Whether to compile with xslt plugin')
|
||||
--- a/plug-ins/meson.build
|
||||
+++ b/plug-ins/meson.build
|
||||
@@ -17,20 +17,26 @@ subdir('shape')
|
||||
subdir('pixbuf')
|
||||
subdir('layout') # Non-standard: shared_module
|
||||
subdir('metapost')
|
||||
-subdir('pdf')
|
||||
+if get_option('pdf')
|
||||
+ subdir('pdf')
|
||||
+endif
|
||||
subdir('pgf')
|
||||
subdir('pstricks')
|
||||
-subdir('python') # Non-standard: shared_module
|
||||
+if get_option('python')
|
||||
+ subdir('python') # Non-standard: shared_module
|
||||
+endif
|
||||
subdir('stress')
|
||||
subdir('svg')
|
||||
subdir('vdx')
|
||||
# TODO: Port to Windows.
|
||||
-if host_machine.system() != 'windows'
|
||||
+if host_machine.system() != 'windows' and get_option('wmf')
|
||||
subdir('wmf') # Non-standard: Only installs if libemf present.
|
||||
endif
|
||||
subdir('wpg')
|
||||
subdir('xfig')
|
||||
-subdir('xslt')
|
||||
+if get_option('xslt')
|
||||
+ subdir('xslt')
|
||||
+endif
|
||||
|
||||
foreach p : install_plugins_desc
|
||||
message(p.get('name'))
|
||||
@@ -1,193 +0,0 @@
|
||||
https://salsa.debian.org/debian/dia/-/blob/debian/0.98+git20250827-2/debian/patches/revert_xpm_loader_replacement.patch
|
||||
See https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/merge_requests/169
|
||||
This patch reverts upstream commit 1ba72d126055130474b4ce589b1f3002972ba490
|
||||
"general: use xpm-pixbuf to load xpms".
|
||||
Use loader from GdkPixbuf as long as available, instead of the fork xpm-pixbuf
|
||||
--- a/app/dia-colour-area.c
|
||||
+++ b/app/dia-colour-area.c
|
||||
@@ -22,8 +22,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
-#include <xpm-pixbuf.h>
|
||||
-
|
||||
#include "attributes.h"
|
||||
#include "persistence.h"
|
||||
|
||||
@@ -297,8 +295,8 @@ dia_colour_area_class_init (DiaColourAreaClass *class)
|
||||
static void
|
||||
dia_colour_area_init (DiaColourArea *self)
|
||||
{
|
||||
- self->reset = xpm_pixbuf_load (default_xpm);
|
||||
- self->swap = xpm_pixbuf_load (swap_xpm);
|
||||
+ self->reset = gdk_pixbuf_new_from_xpm_data (default_xpm);
|
||||
+ self->swap = gdk_pixbuf_new_from_xpm_data (swap_xpm);
|
||||
|
||||
gtk_widget_set_events (GTK_WIDGET (self), GDK_BUTTON_PRESS_MASK);
|
||||
}
|
||||
--- a/app/dia-page-layout.c
|
||||
+++ b/app/dia-page-layout.c
|
||||
@@ -25,8 +25,6 @@
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
-#include <xpm-pixbuf.h>
|
||||
-
|
||||
#include "dia-page-layout.h"
|
||||
|
||||
#include "pixmaps/portrait.xpm"
|
||||
@@ -148,7 +146,7 @@ dia_page_layout_init (DiaPageLayout *self)
|
||||
|
||||
self->orient_portrait = gtk_radio_button_new (NULL);
|
||||
|
||||
- wid = gtk_image_new_from_pixbuf (xpm_pixbuf_load (portrait_xpm));
|
||||
+ wid = gtk_image_new_from_pixbuf (gdk_pixbuf_new_from_xpm_data (portrait_xpm));
|
||||
gtk_container_add (GTK_CONTAINER (self->orient_portrait), wid);
|
||||
gtk_widget_show (wid);
|
||||
|
||||
@@ -157,7 +155,7 @@ dia_page_layout_init (DiaPageLayout *self)
|
||||
|
||||
self->orient_landscape = gtk_radio_button_new (
|
||||
gtk_radio_button_get_group (GTK_RADIO_BUTTON (self->orient_portrait)));
|
||||
- wid = gtk_image_new_from_pixbuf (xpm_pixbuf_load (landscape_xpm));
|
||||
+ wid = gtk_image_new_from_pixbuf (gdk_pixbuf_new_from_xpm_data (landscape_xpm));
|
||||
gtk_container_add (GTK_CONTAINER (self->orient_landscape), wid);
|
||||
gtk_widget_show (wid);
|
||||
|
||||
--- a/app/navigation.c
|
||||
+++ b/app/navigation.c
|
||||
@@ -24,8 +24,6 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
-#include <xpm-pixbuf.h>
|
||||
-
|
||||
#include "diagram.h"
|
||||
#include "display.h"
|
||||
#include "renderer/diacairo.h"
|
||||
@@ -489,7 +487,7 @@ navigation_popup_new (DDisplay *ddisp)
|
||||
"released", G_CALLBACK (on_button_navigation_popup_released),
|
||||
NULL);
|
||||
|
||||
- pixbuf = xpm_pixbuf_load (nav_xpm);
|
||||
+ pixbuf = gdk_pixbuf_new_from_xpm_data (nav_xpm);
|
||||
|
||||
image = gtk_image_new_from_pixbuf (pixbuf);
|
||||
|
||||
--- a/app/sheet-editor/sheet-editor-button.c
|
||||
+++ b/app/sheet-editor/sheet-editor-button.c
|
||||
@@ -24,8 +24,6 @@
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
-#include <xpm-pixbuf.h>
|
||||
-
|
||||
#include "sheet-editor-button.h"
|
||||
#include "widgets.h"
|
||||
#include "message.h"
|
||||
@@ -79,7 +77,7 @@ get_object_pixbuf (SheetObject *so)
|
||||
if (g_str_has_prefix ((char *) so->pixmap, "res:")) {
|
||||
pixbuf = pixbuf_from_resource (((char *) so->pixmap) + 4);
|
||||
} else {
|
||||
- pixbuf = xpm_pixbuf_load (so->pixmap);
|
||||
+ pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) so->pixmap);
|
||||
}
|
||||
} else {
|
||||
if (so->pixmap_file != NULL) {
|
||||
--- a/app/toolbox.c
|
||||
+++ b/app/toolbox.c
|
||||
@@ -21,9 +21,6 @@
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
-
|
||||
-#include <xpm-pixbuf.h>
|
||||
-
|
||||
#include "gtkwrapbox.h"
|
||||
#include "gtkhwrapbox.h"
|
||||
|
||||
@@ -305,7 +302,7 @@ fill_sheet_wbox(Sheet *sheet)
|
||||
if (g_str_has_prefix ((const char *) sheet_obj->pixmap, "res:")) {
|
||||
pixbuf = pixbuf_from_resource ((const char *) sheet_obj->pixmap + 4);
|
||||
} else {
|
||||
- pixbuf = xpm_pixbuf_load (sheet_obj->pixmap);
|
||||
+ pixbuf = gdk_pixbuf_new_from_xpm_data (sheet_obj->pixmap);
|
||||
if (pixbuf == NULL) {
|
||||
g_warning ("Problem loading icon for ‘%s’", sheet_obj->description);
|
||||
pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
|
||||
@@ -334,7 +331,7 @@ fill_sheet_wbox(Sheet *sheet)
|
||||
pixbuf = cropped;
|
||||
}
|
||||
} else {
|
||||
- pixbuf = xpm_pixbuf_load (missing);
|
||||
+ pixbuf = gdk_pixbuf_new_from_xpm_data (missing);
|
||||
|
||||
message_warning ("failed to load icon for file\n %s\n cause=%s",
|
||||
sheet_obj->pixmap_file,
|
||||
@@ -342,8 +339,8 @@ fill_sheet_wbox(Sheet *sheet)
|
||||
}
|
||||
} else {
|
||||
DiaObjectType *type;
|
||||
- type = object_get_type (sheet_obj->object_type);
|
||||
- pixbuf = dia_object_type_get_icon (type);
|
||||
+ type = object_get_type(sheet_obj->object_type);
|
||||
+ pixbuf = gdk_pixbuf_new_from_xpm_data (type->pixmap);
|
||||
}
|
||||
|
||||
if (pixbuf) {
|
||||
--- a/lib/meson.build
|
||||
+++ b/lib/meson.build
|
||||
@@ -230,7 +230,6 @@ libdia_deps = [
|
||||
libm_dep,
|
||||
gmodule_dep,
|
||||
graphene_dep,
|
||||
- xpm_dep,
|
||||
]
|
||||
|
||||
libdia_inc = include_directories('.')
|
||||
--- a/lib/object.c
|
||||
+++ b/lib/object.c
|
||||
@@ -23,8 +23,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
-#include <xpm-pixbuf.h>
|
||||
-
|
||||
#define _DIA_OBJECT_BUILD 1
|
||||
#include "object.h"
|
||||
#include "diagramdata.h" /* for Layer */
|
||||
@@ -1425,6 +1423,14 @@ dia_object_type_get_icon (const DiaObjectType *type)
|
||||
|
||||
if (g_str_has_prefix ((char *) icon_data, "res:")) {
|
||||
pixbuf = pixbuf_from_resource (((char *) icon_data) + 4);
|
||||
+ } else if (icon_data && strncmp ((char *) icon_data, "GdkP", 4) == 0) {
|
||||
+ /* GTK3: We will remove this in Dia 2.0 but is retained to maintain
|
||||
+ * compatability with 0.97.3 objects */
|
||||
+ g_warning ("Object '%s' has an inline icon, this is deprecated",
|
||||
+ type->name);
|
||||
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
+ pixbuf = gdk_pixbuf_new_from_inline (-1, (guint8 *) icon_data, TRUE, NULL);
|
||||
+ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
} else if (type->pixmap_file != NULL) {
|
||||
GError *error = NULL;
|
||||
pixbuf = gdk_pixbuf_new_from_file (type->pixmap_file, &error);
|
||||
@@ -1433,7 +1439,8 @@ dia_object_type_get_icon (const DiaObjectType *type)
|
||||
g_clear_error (&error);
|
||||
}
|
||||
} else {
|
||||
- pixbuf = xpm_pixbuf_load (icon_data);
|
||||
+ const char **pixmap_data = icon_data;
|
||||
+ pixbuf = gdk_pixbuf_new_from_xpm_data (pixmap_data);
|
||||
}
|
||||
|
||||
return pixbuf;
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -22,7 +22,6 @@ libxml_dep = dependency('libxml-2.0', version: '>= 2.14.0')
|
||||
gmodule_dep = dependency('gmodule-2.0')
|
||||
libcairo_dep = dependency('cairo')
|
||||
graphene_dep = dependency('graphene-1.0', version: '>= 1.10')
|
||||
-xpm_dep = dependency('xpm-pixbuf')
|
||||
|
||||
# Not required since not all platforms ship a separate libm.
|
||||
libm_dep = cc.find_library('m', required: false)
|
||||
@@ -1,496 +0,0 @@
|
||||
https://salsa.debian.org/debian/dia/-/blob/debian/0.98+git20250827-2/debian/patches/use-gtkfontbutton.patch
|
||||
Origin: https://gitlab.gnome.org/GNOME/dia/-/merge_requests/114
|
||||
This patch changes the custom font-selector window by a GtkFontButton widget.
|
||||
Fix the custom font-selector window which is very long to load.
|
||||
--- a/lib/font.c
|
||||
+++ b/lib/font.c
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "font.h"
|
||||
#include "message.h"
|
||||
#include "textline.h"
|
||||
+#include "units.h"
|
||||
|
||||
static PangoContext *pango_context = NULL;
|
||||
|
||||
@@ -53,13 +54,6 @@ struct _DiaFont {
|
||||
PangoFontDescription *pfd;
|
||||
/* mutable */ char *legacy_name;
|
||||
|
||||
- /* there is a difference between Pango's font size and Dia's font height */
|
||||
- /* Calculated font_size is to make 'font_height = ascent + descent */
|
||||
- /* The font_height is used as default line height, there used to be a hard-coded size = 0.7 * height */
|
||||
- /* before using pango_set_absolute_size() to overcome font size differences between renderers */
|
||||
- double height;
|
||||
- /* Need to load a font to query it's metrics */
|
||||
- PangoFont *loaded;
|
||||
PangoFontMetrics *metrics;
|
||||
};
|
||||
|
||||
@@ -136,8 +130,6 @@ dia_font_finalize (GObject *object)
|
||||
g_clear_pointer (&font->pfd, pango_font_description_free);
|
||||
g_clear_pointer (&font->metrics, pango_font_metrics_unref);
|
||||
|
||||
- g_clear_object (&font->loaded);
|
||||
-
|
||||
G_OBJECT_CLASS (dia_font_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@@ -166,33 +158,17 @@ dia_pfd_set_height(PangoFontDescription *pfd, double height)
|
||||
}
|
||||
|
||||
|
||||
-/*!
|
||||
- * In Dia a font is usually referred to by it's (line-) height, not it's size.
|
||||
- *
|
||||
- * This methods "calculates" the latter from the former. This used to be some magic factor of 0.7 which did not
|
||||
- * solve the resolution dependencance of the former calculation. In fact there is new magic factor now because
|
||||
- * really calculating the font size from the height would involve two font loads which seem to be two expensive.
|
||||
- */
|
||||
static void
|
||||
-_dia_font_adjust_size (DiaFont *font, double height, gboolean recalc_alwways)
|
||||
+dia_font_update_metrics (DiaFont *font)
|
||||
{
|
||||
+ PangoFont *loaded;
|
||||
|
||||
- if (font->height != height || !font->metrics || recalc_alwways) {
|
||||
- PangoFont *loaded;
|
||||
-
|
||||
- dia_pfd_set_height (font->pfd, height);
|
||||
- /* need to load a font to get it's metrics */
|
||||
- loaded = font->loaded;
|
||||
- font->loaded = pango_context_load_font (dia_font_get_context (), font->pfd);
|
||||
-
|
||||
- g_clear_object (&loaded);
|
||||
-
|
||||
- g_clear_pointer (&font->metrics, pango_font_metrics_unref);
|
||||
+ g_clear_pointer (&font->metrics, pango_font_metrics_unref);
|
||||
|
||||
- /* caching metrics */
|
||||
- font->metrics = pango_font_get_metrics (font->loaded, NULL);
|
||||
- font->height = height;
|
||||
- }
|
||||
+ /* need to load a font to get its metrics */
|
||||
+ loaded = pango_context_load_font (dia_font_get_context (), font->pfd);
|
||||
+ font->metrics = pango_font_get_metrics (loaded, NULL);
|
||||
+ g_clear_object (&loaded);
|
||||
}
|
||||
|
||||
|
||||
@@ -205,15 +181,8 @@ DiaFont *
|
||||
dia_font_new (const char *family, DiaFontStyle style, double height)
|
||||
{
|
||||
DiaFont* font = dia_font_new_from_style(style, height);
|
||||
- gboolean changed;
|
||||
-
|
||||
- changed = family != NULL && g_strcmp0 (pango_font_description_get_family (font->pfd), family) != 0;
|
||||
pango_font_description_set_family(font->pfd, family);
|
||||
|
||||
- if (changed) {
|
||||
- _dia_font_adjust_size (font, font->height, TRUE);
|
||||
- }
|
||||
-
|
||||
return font;
|
||||
}
|
||||
|
||||
@@ -316,9 +285,31 @@ dia_font_new_from_style (DiaFontStyle style, double height)
|
||||
|
||||
retval = g_object_new (DIA_TYPE_FONT, NULL);
|
||||
retval->pfd = pfd;
|
||||
- _dia_font_adjust_size (retval, height, FALSE);
|
||||
retval->legacy_name = NULL;
|
||||
|
||||
+ dia_font_update_metrics (retval);
|
||||
+
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+DiaFont *
|
||||
+dia_font_new_from_description (const char *desc)
|
||||
+{
|
||||
+ DiaFont *retval;
|
||||
+ PangoFontDescription *pfd = pango_font_description_from_string (desc);
|
||||
+
|
||||
+ if (!pango_font_description_get_size_is_absolute (pfd)) {
|
||||
+ double size = pango_font_description_get_size (pfd);
|
||||
+ pango_font_description_set_absolute_size(pfd, size * global_zoom_factor * 72.0);
|
||||
+ }
|
||||
+
|
||||
+ retval = g_object_new (DIA_TYPE_FONT, NULL);
|
||||
+ retval->pfd = pfd;
|
||||
+ retval->legacy_name = NULL;
|
||||
+
|
||||
+ dia_font_update_metrics (retval);
|
||||
+
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -407,8 +398,9 @@ double
|
||||
dia_font_get_height (DiaFont *font)
|
||||
{
|
||||
g_return_val_if_fail (font != NULL, 0.0);
|
||||
+ g_return_val_if_fail (pango_font_description_get_size_is_absolute (font->pfd), 0.0);
|
||||
|
||||
- return font->height;
|
||||
+ return pdu_to_dcm(pango_font_description_get_size(font->pfd)) / 0.8;
|
||||
}
|
||||
|
||||
|
||||
@@ -430,6 +422,23 @@ dia_font_get_size (DiaFont *font)
|
||||
}
|
||||
|
||||
|
||||
+/**
|
||||
+ * dia_font_set_size:
|
||||
+ * @font: The font to modify.
|
||||
+ * @size: The new size in centimetres.
|
||||
+ *
|
||||
+ * Sets the size of font to the provided (positive) size.
|
||||
+ */
|
||||
+void
|
||||
+dia_font_set_size (DiaFont *font, double size)
|
||||
+{
|
||||
+ g_return_if_fail (size >= 0);
|
||||
+
|
||||
+ pango_font_description_set_absolute_size (font->pfd, dcm_to_pdu (size));
|
||||
+ dia_font_update_metrics (font);
|
||||
+}
|
||||
+
|
||||
+
|
||||
/**
|
||||
* dia_font_set_height:
|
||||
*
|
||||
@@ -438,7 +447,8 @@ dia_font_get_size (DiaFont *font)
|
||||
void
|
||||
dia_font_set_height (DiaFont* font, double height)
|
||||
{
|
||||
- _dia_font_adjust_size (font, height, FALSE);
|
||||
+ /* FIXME For now, assume height is 80% of size. */
|
||||
+ dia_font_set_size (font, height / 0.8);
|
||||
}
|
||||
|
||||
|
||||
@@ -493,7 +503,7 @@ dia_font_set_any_family (DiaFont *font, const char *family)
|
||||
pango_font_description_set_family (font->pfd, family);
|
||||
if (changed) {
|
||||
/* force recalculation on name change */
|
||||
- _dia_font_adjust_size (font, font->height, TRUE);
|
||||
+ dia_font_update_metrics (font);
|
||||
}
|
||||
|
||||
g_clear_pointer (&font->legacy_name, g_free);
|
||||
@@ -531,7 +541,7 @@ dia_font_set_weight (DiaFont *font, DiaFontWeight weight)
|
||||
dia_pfd_set_weight(font->pfd,weight);
|
||||
|
||||
if (old_weight != weight) {
|
||||
- _dia_font_adjust_size (font, font->height, TRUE);
|
||||
+ dia_font_update_metrics (font);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,7 +558,7 @@ dia_font_set_slant (DiaFont *font, DiaFontSlant slant)
|
||||
g_return_if_fail(font != NULL);
|
||||
dia_pfd_set_slant(font->pfd,slant);
|
||||
if (slant != old_slant)
|
||||
- _dia_font_adjust_size (font, font->height, TRUE);
|
||||
+ dia_font_update_metrics (font);
|
||||
}
|
||||
|
||||
|
||||
@@ -702,7 +712,8 @@ dia_font_ascent (const char *string, DiaFont *font, double height)
|
||||
{
|
||||
if (font->metrics) {
|
||||
double ascent = pdu_to_dcm (pango_font_metrics_get_ascent (font->metrics));
|
||||
- return ascent * (height / font->height);
|
||||
+ double factor = height / dia_font_get_height (font);
|
||||
+ return ascent * factor;
|
||||
} else {
|
||||
/* previous, _expensive_ but string specific way */
|
||||
TextLine *text_line = text_line_new (string, font, height);
|
||||
@@ -723,7 +734,8 @@ dia_font_descent (const char *string, DiaFont *font, double height)
|
||||
{
|
||||
if (font->metrics) {
|
||||
double descent = pdu_to_dcm (pango_font_metrics_get_descent (font->metrics));
|
||||
- return descent * (height / font->height);
|
||||
+ double factor = height / dia_font_get_height (font);
|
||||
+ return descent * factor;
|
||||
} else {
|
||||
/* previous, _expensive_ but string specific way */
|
||||
TextLine *text_line = text_line_new (string, font, height);
|
||||
--- a/lib/font.h
|
||||
+++ b/lib/font.h
|
||||
@@ -95,6 +95,7 @@ DiaFont *dia_font_new (const char *f
|
||||
DiaFont *dia_font_new_from_style (DiaFontStyle style,
|
||||
double height);
|
||||
DiaFont *dia_font_new_from_legacy_name (const char *name);
|
||||
+DiaFont *dia_font_new_from_description (const char *description);
|
||||
const char *dia_font_get_legacy_name (DiaFont *font);
|
||||
DiaFont *dia_font_copy (DiaFont *font);
|
||||
DiaFontStyle dia_font_get_style (DiaFont *font);
|
||||
@@ -103,6 +104,8 @@ const PangoFontDescription *dia_font_get_description (DiaFont *f
|
||||
double dia_font_get_height (DiaFont *font);
|
||||
void dia_font_set_height (DiaFont *font,
|
||||
double height);
|
||||
+void dia_font_set_size (DiaFont *font,
|
||||
+ double size);
|
||||
double dia_font_get_size (DiaFont *font);
|
||||
void dia_font_set_slant (DiaFont *font,
|
||||
DiaFontSlant slant);
|
||||
--- a/lib/libdia.def
|
||||
+++ b/lib/libdia.def
|
||||
@@ -241,8 +241,10 @@ EXPORTS
|
||||
dia_font_new
|
||||
dia_font_new_from_legacy_name
|
||||
dia_font_new_from_style
|
||||
+ dia_font_new_from_description
|
||||
dia_font_set_any_family
|
||||
dia_font_set_height
|
||||
+ dia_font_set_size
|
||||
dia_font_set_slant
|
||||
dia_font_set_slant_from_string
|
||||
dia_font_set_weight
|
||||
@@ -250,11 +252,6 @@ EXPORTS
|
||||
dia_font_copy
|
||||
dia_font_string_width
|
||||
|
||||
- dia_font_selector_get_font
|
||||
- dia_font_selector_get_type
|
||||
- dia_font_selector_new
|
||||
- dia_font_selector_set_font
|
||||
-
|
||||
dia_guide_new
|
||||
dia_guide_copy
|
||||
dia_guide_free
|
||||
--- a/lib/meson.build
|
||||
+++ b/lib/meson.build
|
||||
@@ -167,8 +167,6 @@ libdia_sources = stdprop_sources + [
|
||||
'dia-colour-cell-renderer.h',
|
||||
'dia-colour-selector.c',
|
||||
'dia-colour-selector.h',
|
||||
- 'dia-font-selector.c',
|
||||
- 'dia-font-selector.h',
|
||||
'dia-graphene.h',
|
||||
'dia-guide.c',
|
||||
'dia-guide.h',
|
||||
--- a/lib/prop_attr.c
|
||||
+++ b/lib/prop_attr.c
|
||||
@@ -29,11 +29,11 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "dia_xml.h"
|
||||
+#include "font.h"
|
||||
#include "properties.h"
|
||||
#include "propinternals.h"
|
||||
#include "dia-arrow-selector.h"
|
||||
#include "dia-colour-selector.h"
|
||||
-#include "dia-font-selector.h"
|
||||
#include "dia-line-style-selector.h"
|
||||
|
||||
/***************************/
|
||||
@@ -421,22 +421,27 @@ fontprop_copy(FontProperty *src)
|
||||
static WIDGET *
|
||||
fontprop_get_widget(FontProperty *prop, PropDialog *dialog)
|
||||
{
|
||||
- GtkWidget *ret = dia_font_selector_new();
|
||||
- prophandler_connect(&prop->common, G_OBJECT(ret), "value-changed");
|
||||
+ GtkWidget *ret = gtk_font_button_new();
|
||||
+ gtk_font_chooser_set_level (GTK_FONT_CHOOSER (ret), GTK_FONT_CHOOSER_LEVEL_FAMILY | GTK_FONT_CHOOSER_LEVEL_STYLE);
|
||||
+ prophandler_connect(&prop->common, G_OBJECT(ret), "font-set");
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
fontprop_reset_widget(FontProperty *prop, WIDGET *widget)
|
||||
{
|
||||
- dia_font_selector_set_font (DIA_FONT_SELECTOR (widget),
|
||||
- prop->font_data);
|
||||
+ const PangoFontDescription *desc = dia_font_get_description (prop->font_data);
|
||||
+ gtk_font_chooser_set_font_desc (GTK_FONT_CHOOSER (widget), desc);
|
||||
}
|
||||
|
||||
static void
|
||||
fontprop_set_from_widget(FontProperty *prop, WIDGET *widget)
|
||||
{
|
||||
- prop->font_data = dia_font_selector_get_font (DIA_FONT_SELECTOR (widget));
|
||||
+ char *desc = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (widget));
|
||||
+ DiaFont *new_font = dia_font_new_from_description (desc);
|
||||
+
|
||||
+ g_clear_pointer (&desc, g_free);
|
||||
+ g_set_object (&prop->font_data, new_font);
|
||||
}
|
||||
|
||||
static void
|
||||
--- a/lib/prop_text.c
|
||||
+++ b/lib/prop_text.c
|
||||
@@ -125,6 +125,7 @@ multistringprop_get_widget(StringProperty *prop, PropDialog *dialog)
|
||||
GtkWidget *ret = gtk_text_view_new();
|
||||
GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ret));
|
||||
GtkWidget *frame = gtk_frame_new(NULL);
|
||||
+ gtk_text_view_set_accepts_tab (GTK_TEXT_VIEW (ret), FALSE);
|
||||
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
|
||||
gtk_container_add(GTK_CONTAINER(frame), ret);
|
||||
g_signal_connect(G_OBJECT(ret), "key-release-event",
|
||||
--- a/objects/UML/class_attributes_dialog.c
|
||||
+++ b/objects/UML/class_attributes_dialog.c
|
||||
@@ -729,6 +729,7 @@ _attributes_create_page (GtkNotebook *notebook, UMLClass *umlclass)
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwindow), entry);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (entry), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (entry), TRUE);
|
||||
+ gtk_text_view_set_accepts_tab (GTK_TEXT_VIEW (entry), FALSE);
|
||||
gtk_widget_show (entry);
|
||||
#if 0 /* while the GtkEntry has a "activate" signal, GtkTextView does not.
|
||||
* Maybe we should connect to "set-focus-child" instead?
|
||||
--- a/objects/UML/class_dialog.c
|
||||
+++ b/objects/UML/class_dialog.c
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
+#include "font.h"
|
||||
#include "object.h"
|
||||
#include "class.h"
|
||||
#include "diaoptionmenu.h"
|
||||
@@ -196,6 +197,28 @@ _class_set_comment (GtkTextView *view, gchar *text)
|
||||
}
|
||||
|
||||
|
||||
+static DiaFont *
|
||||
+_font_from_button (GtkFontButton *btn)
|
||||
+{
|
||||
+ char *font_desc;
|
||||
+ DiaFont *ret;
|
||||
+
|
||||
+ font_desc = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (btn));
|
||||
+ ret = dia_font_new_from_description (font_desc);
|
||||
+ g_clear_pointer (&font_desc, g_free);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void
|
||||
+_set_selector_font (GtkFontButton *btn, DiaFont *font)
|
||||
+{
|
||||
+ gtk_font_chooser_set_font_desc (GTK_FONT_CHOOSER (btn),
|
||||
+ dia_font_get_description (font));
|
||||
+}
|
||||
+
|
||||
+
|
||||
static void
|
||||
class_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog)
|
||||
{
|
||||
@@ -243,12 +266,12 @@ class_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog)
|
||||
dia_colour_selector_get_colour (DIA_COLOUR_SELECTOR (prop_dialog->fill_color),
|
||||
¨class->fill_color);
|
||||
|
||||
- umlclass->normal_font = dia_font_selector_get_font (prop_dialog->normal_font);
|
||||
- umlclass->polymorphic_font = dia_font_selector_get_font (prop_dialog->polymorphic_font);
|
||||
- umlclass->abstract_font = dia_font_selector_get_font (prop_dialog->abstract_font);
|
||||
- umlclass->classname_font = dia_font_selector_get_font (prop_dialog->classname_font);
|
||||
- umlclass->abstract_classname_font = dia_font_selector_get_font (prop_dialog->abstract_classname_font);
|
||||
- umlclass->comment_font = dia_font_selector_get_font (prop_dialog->comment_font);
|
||||
+ umlclass->normal_font = _font_from_button(prop_dialog->normal_font);
|
||||
+ umlclass->polymorphic_font = _font_from_button(prop_dialog->polymorphic_font);
|
||||
+ umlclass->abstract_font = _font_from_button(prop_dialog->abstract_font);
|
||||
+ umlclass->classname_font = _font_from_button (prop_dialog->classname_font);
|
||||
+ umlclass->abstract_classname_font = _font_from_button (prop_dialog->abstract_classname_font);
|
||||
+ umlclass->comment_font = _font_from_button (prop_dialog->comment_font);
|
||||
|
||||
umlclass->font_height = gtk_spin_button_get_value (prop_dialog->normal_font_height);
|
||||
umlclass->abstract_font_height = gtk_spin_button_get_value (prop_dialog->abstract_font_height);
|
||||
@@ -291,12 +314,12 @@ class_fill_in_dialog(UMLClass *umlclass)
|
||||
dia_colour_selector_set_colour (prop_dialog->text_color, ¨class->text_color);
|
||||
dia_colour_selector_set_colour (prop_dialog->line_color, ¨class->line_color);
|
||||
dia_colour_selector_set_colour (prop_dialog->fill_color, ¨class->fill_color);
|
||||
- dia_font_selector_set_font (prop_dialog->normal_font, umlclass->normal_font);
|
||||
- dia_font_selector_set_font (prop_dialog->polymorphic_font, umlclass->polymorphic_font);
|
||||
- dia_font_selector_set_font (prop_dialog->abstract_font, umlclass->abstract_font);
|
||||
- dia_font_selector_set_font (prop_dialog->classname_font, umlclass->classname_font);
|
||||
- dia_font_selector_set_font (prop_dialog->abstract_classname_font, umlclass->abstract_classname_font);
|
||||
- dia_font_selector_set_font (prop_dialog->comment_font, umlclass->comment_font);
|
||||
+ _set_selector_font (prop_dialog->normal_font, umlclass->normal_font);
|
||||
+ _set_selector_font (prop_dialog->polymorphic_font, umlclass->polymorphic_font);
|
||||
+ _set_selector_font (prop_dialog->abstract_font, umlclass->abstract_font);
|
||||
+ _set_selector_font (prop_dialog->classname_font, umlclass->classname_font);
|
||||
+ _set_selector_font (prop_dialog->abstract_classname_font, umlclass->abstract_classname_font);
|
||||
+ _set_selector_font (prop_dialog->comment_font, umlclass->comment_font);
|
||||
gtk_spin_button_set_value (prop_dialog->normal_font_height, umlclass->font_height);
|
||||
gtk_spin_button_set_value (prop_dialog->polymorphic_font_height, umlclass->polymorphic_font_height);
|
||||
gtk_spin_button_set_value (prop_dialog->abstract_font_height, umlclass->abstract_font_height);
|
||||
@@ -311,7 +334,7 @@ create_font_props_row (GtkGrid *grid,
|
||||
gint row,
|
||||
DiaFont *font,
|
||||
real height,
|
||||
- DiaFontSelector **fontsel,
|
||||
+ GtkFontButton **fontsel,
|
||||
GtkSpinButton **heightsel)
|
||||
{
|
||||
GtkWidget *label;
|
||||
@@ -320,9 +343,10 @@ create_font_props_row (GtkGrid *grid,
|
||||
label = gtk_label_new (kind);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_grid_attach (grid, label, 0, row, 1, 1);
|
||||
- *fontsel = DIA_FONT_SELECTOR (dia_font_selector_new ());
|
||||
+ *fontsel = GTK_FONT_BUTTON (gtk_font_button_new ());
|
||||
gtk_widget_set_hexpand (GTK_WIDGET (*fontsel), TRUE);
|
||||
- dia_font_selector_set_font (DIA_FONT_SELECTOR (*fontsel), font);
|
||||
+ gtk_font_chooser_set_font_desc (GTK_FONT_CHOOSER (*fontsel), dia_font_get_description (font));
|
||||
+ gtk_font_chooser_set_level (GTK_FONT_CHOOSER (*fontsel), GTK_FONT_CHOOSER_LEVEL_FAMILY | GTK_FONT_CHOOSER_LEVEL_STYLE);
|
||||
gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET(*fontsel), 1, row, 1, 1);
|
||||
|
||||
adj = GTK_ADJUSTMENT (gtk_adjustment_new (height, 0.1, 10.0, 0.1, 1.0, 0));
|
||||
@@ -382,6 +406,7 @@ class_create_page(GtkNotebook *notebook, UMLClass *umlclass)
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow),
|
||||
GTK_SHADOW_IN);
|
||||
entry = gtk_text_view_new ();
|
||||
+ gtk_text_view_set_accepts_tab (GTK_TEXT_VIEW (entry), FALSE);
|
||||
prop_dialog->comment = GTK_TEXT_VIEW(entry);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (entry), GTK_WRAP_WORD);
|
||||
|
||||
--- a/objects/UML/class_dialog.h
|
||||
+++ b/objects/UML/class_dialog.h
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "dia-colour-selector.h"
|
||||
-#include "dia-font-selector.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -32,12 +31,12 @@ struct _UMLClassDialog {
|
||||
GtkToggleButton *op_supp;
|
||||
GtkToggleButton *comments_vis;
|
||||
GtkToggleButton *op_wrap;
|
||||
- DiaFontSelector *normal_font;
|
||||
- DiaFontSelector *abstract_font;
|
||||
- DiaFontSelector *polymorphic_font;
|
||||
- DiaFontSelector *classname_font;
|
||||
- DiaFontSelector *abstract_classname_font;
|
||||
- DiaFontSelector *comment_font;
|
||||
+ GtkFontButton *normal_font;
|
||||
+ GtkFontButton *abstract_font;
|
||||
+ GtkFontButton *polymorphic_font;
|
||||
+ GtkFontButton *classname_font;
|
||||
+ GtkFontButton *abstract_classname_font;
|
||||
+ GtkFontButton *comment_font;
|
||||
GtkSpinButton *normal_font_height;
|
||||
GtkSpinButton *abstract_font_height;
|
||||
GtkSpinButton *polymorphic_font_height;
|
||||
--- a/objects/UML/class_operations_dialog.c
|
||||
+++ b/objects/UML/class_operations_dialog.c
|
||||
@@ -982,6 +982,7 @@ operations_data_create_hbox (UMLClass *umlclass)
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwindow), entry);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (entry), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (entry),TRUE);
|
||||
+ gtk_text_view_set_accepts_tab (GTK_TEXT_VIEW (entry), FALSE);
|
||||
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid), label, 4, 0, 1, 1);
|
||||
@@ -1340,6 +1341,7 @@ operations_parameters_data_create_vbox (UMLClass *umlclass)
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwindow), entry);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (entry), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (entry),TRUE);
|
||||
+ gtk_text_view_set_accepts_tab (GTK_TEXT_VIEW (entry), FALSE);
|
||||
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_grid_attach (GTK_GRID (grid), label, 2, 1, 1, 1);
|
||||
Reference in New Issue
Block a user