[dia/dia-next: 19/59] Further Gtk3 tweaks
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia/dia-next: 19/59] Further Gtk3 tweaks
- Date: Wed, 9 Jan 2019 18:35:53 +0000 (UTC)
commit 0fd08ade73e798ad1583613f5ab8dafc2676aba7
Author: Zander Brown <zbrown gnome org>
Date: Sun Dec 23 19:47:34 2018 +0000
Further Gtk3 tweaks
xlst dialog should be somewhat broken, if only i could find how to launch it
bindings/dia-renderer.cpp | 34 ++++++++++++++--------------
data/sheets-main-dialog.xml | 4 ++--
plug-ins/xslt/xsltdialog.c | 54 ++++++++++++++++++---------------------------
3 files changed, 41 insertions(+), 51 deletions(-)
---
diff --git a/bindings/dia-renderer.cpp b/bindings/dia-renderer.cpp
index a3461b9a..2dc46d9a 100644
--- a/bindings/dia-renderer.cpp
+++ b/bindings/dia-renderer.cpp
@@ -105,14 +105,14 @@ dia::Renderer::set_font (Font* font, double height)
}
// Draw a line from start to end, using color and the current line style
void
-dia::Renderer::draw_line (Point *start, Point *end, Color *color)
+dia::Renderer::draw_line (Point *start, Point *end, GdkRGBA *color)
{
assert (self);
DIA_RENDERER_GET_CLASS(self)->draw_line (self, start, end, color);
}
// Fill and/or stroke a rectangle, given its upper-left and lower-right corners
void
-dia::Renderer::draw_rect (Point *ul_corner, Point *lr_corner, Color *fill, Color *stroke)
+dia::Renderer::draw_rect (Point *ul_corner, Point *lr_corner, GdkRGBA *fill, GdkRGBA *stroke)
{
assert (self);
DIA_RENDERER_GET_CLASS(self)->draw_rect (self, ul_corner, lr_corner, fill, stroke);
@@ -121,7 +121,7 @@ dia::Renderer::draw_rect (Point *ul_corner, Point *lr_corner, Color *fill, Color
void
dia::Renderer::draw_arc (Point *center, double width, double height,
double angle1, double angle2,
- Color *color)
+ GdkRGBA *color)
{
assert (self);
DIA_RENDERER_GET_CLASS(self)->draw_arc (self, center, width, height, angle1, angle2, color);
@@ -130,21 +130,21 @@ dia::Renderer::draw_arc (Point *center, double width, double height,
void
dia::Renderer::fill_arc (Point *center, double width, double height,
double angle1, double angle2,
- Color *color)
+ GdkRGBA *color)
{
assert (self);
DIA_RENDERER_GET_CLASS(self)->fill_arc (self, center, width, height, angle1, angle2, color);
}
// Draw an ellipse, given its center and the bounding box
void
-dia::Renderer::draw_ellipse (Point *center, double width, double height, Color *fill, Color *stroke)
+dia::Renderer::draw_ellipse (Point *center, double width, double height, GdkRGBA *fill, GdkRGBA *stroke)
{
assert (self);
DIA_RENDERER_GET_CLASS(self)->draw_ellipse (self, center, width, height, fill, stroke);
}
// Print a string at pos, using the current font
void
-dia::Renderer::draw_string (const gchar *text, Point *pos, Alignment alignment, Color *color)
+dia::Renderer::draw_string (const gchar *text, Point *pos, Alignment alignment, GdkRGBA *color)
{
assert (self);
DIA_RENDERER_GET_CLASS(self)->draw_string (self, text, pos, alignment, color);
@@ -159,28 +159,28 @@ dia::Renderer::draw_image (Point *point, double width, double height, Image* ima
// draw a bezier line - possibly as approximation consisting of straight lines
void
-dia::Renderer::draw_bezier (BezPoint *points, int numpoints, Color *color)
+dia::Renderer::draw_bezier (BezPoint *points, int numpoints, GdkRGBA *color)
{
assert (self);
DIA_RENDERER_GET_CLASS(self)->draw_bezier (self, points, numpoints, color);
}
// fill a bezier line - possibly as approximation consisting of a polygon
void
-dia::Renderer::draw_beziergon (BezPoint *points, int numpoints, Color *fill, Color *stroke)
+dia::Renderer::draw_beziergon (BezPoint *points, int numpoints, GdkRGBA *fill, GdkRGBA *stroke)
{
assert (self);
DIA_RENDERER_GET_CLASS(self)->draw_beziergon (self, points, numpoints, fill, stroke);
}
// drawing a polyline - or fallback to single line segments
void
-dia::Renderer::draw_polyline (Point *points, int num_points, Color *color)
+dia::Renderer::draw_polyline (Point *points, int num_points, GdkRGBA *color)
{
assert (self);
DIA_RENDERER_GET_CLASS(self)->draw_polyline (self, points, num_points, color);
}
// Draw a polygon, using the current line and/or fill style
void
-dia::Renderer::draw_polygon (Point *points, int num_points, Color *fill, Color *stroke)
+dia::Renderer::draw_polygon (Point *points, int num_points, GdkRGBA *fill, GdkRGBA *stroke)
{
assert (self);
DIA_RENDERER_GET_CLASS(self)->draw_polygon (self, points, num_points, fill, stroke);
@@ -194,7 +194,7 @@ dia::Renderer::draw_text (Text* text)
}
// Draw a polyline with round corners
void
-dia::Renderer::draw_rounded_polyline (Point *points, int num_points, Color *color, double radius )
+dia::Renderer::draw_rounded_polyline (Point *points, int num_points, GdkRGBA *color, double radius )
{
assert (self);
DIA_RENDERER_GET_CLASS(self)->draw_rounded_polyline (self, points, num_points, color, radius);
@@ -202,14 +202,14 @@ dia::Renderer::draw_rounded_polyline (Point *points, int num_points, Color *colo
// specialized draw_rect() with round corners
void
dia::Renderer::draw_rounded_rect (Point *ul_corner, Point *lr_corner,
- Color *fill, Color *stroke, real radius)
+ GdkRGBA *fill, GdkRGBA *stroke, real radius)
{
assert (self);
DIA_RENDERER_GET_CLASS(self)->draw_rounded_rect (self, ul_corner, lr_corner, fill, stroke, radius);
}
// specialized draw_line() for renderers with an own concept of Arrow
void
-dia::Renderer::draw_line_with_arrows (Point *start, Point *end, real line_width, Color *line_color,
+dia::Renderer::draw_line_with_arrows (Point *start, Point *end, real line_width, GdkRGBA *line_color,
Arrow *start_arrow, Arrow *end_arrow)
{
assert (self);
@@ -217,7 +217,7 @@ dia::Renderer::draw_line_with_arrows (Point *start, Point *end, real line_width
}
// specialized draw_line() for renderers with an own concept of Arrow
void
-dia::Renderer::draw_arc_with_arrows (Point *start, Point *end, Point *midpoint, real line_width, Color
*color,
+dia::Renderer::draw_arc_with_arrows (Point *start, Point *end, Point *midpoint, real line_width, GdkRGBA
*color,
Arrow *start_arrow, Arrow *end_arrow)
{
assert (self);
@@ -225,7 +225,7 @@ dia::Renderer::draw_arc_with_arrows (Point *start, Point *end, Point *midpoint,
}
// specialized draw_polyline() for renderers with an own concept of Arrow
void
-dia::Renderer::draw_polyline_with_arrows (Point *points, int num_points, real line_width, Color *color,
+dia::Renderer::draw_polyline_with_arrows (Point *points, int num_points, real line_width, GdkRGBA *color,
Arrow *start_arrow, Arrow *end_arrow)
{
assert (self);
@@ -233,7 +233,7 @@ dia::Renderer::draw_polyline_with_arrows (Point *points, int num_points, real li
}
// specialized draw_rounded_polyline() for renderers with an own concept of Arrow
void
-dia::Renderer::draw_rounded_polyline_with_arrows (Point *points, int num_points, real line_width, Color
*color,
+dia::Renderer::draw_rounded_polyline_with_arrows (Point *points, int num_points, real line_width, GdkRGBA
*color,
Arrow *start_arrow, Arrow *end_arrow, real radius)
{
assert (self);
@@ -241,7 +241,7 @@ dia::Renderer::draw_rounded_polyline_with_arrows (Point *points, int num_points,
}
// specialized draw_bezier() for renderers with an own concept of Arrow
void
-dia::Renderer::draw_bezier_with_arrows (BezPoint *points, int num_points, real line_width, Color *color,
+dia::Renderer::draw_bezier_with_arrows (BezPoint *points, int num_points, real line_width, GdkRGBA *color,
Arrow *start_arrow, Arrow *end_arrow)
{
assert (self);
diff --git a/data/sheets-main-dialog.xml b/data/sheets-main-dialog.xml
index 8fd7bb18..454edb6d 100644
--- a/data/sheets-main-dialog.xml
+++ b/data/sheets-main-dialog.xml
@@ -172,7 +172,7 @@
</packing>
</child>
<child>
- <object class="GtkOptionMenu" id="optionmenu_right">
+ <object class="GtkComboBoxText" id="optionmenu_right">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -201,7 +201,7 @@
</packing>
</child>
<child>
- <object class="GtkOptionMenu" id="optionmenu_left">
+ <object class="GtkComboBoxText" id="optionmenu_left">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
diff --git a/plug-ins/xslt/xsltdialog.c b/plug-ins/xslt/xsltdialog.c
index 3b03f305..5b5ecfb4 100644
--- a/plug-ins/xslt/xsltdialog.c
+++ b/plug-ins/xslt/xsltdialog.c
@@ -26,7 +26,6 @@
* Opens a dialog for export options
*/
-#undef GTK_DISABLE_DEPRECATED /* GTK_OPTION_MENU, ... */
#include "xslt.h"
#include <stdio.h>
@@ -40,19 +39,18 @@ from_deactivate(fromxsl_t *xsls);
static void
from_activate(GtkWidget *widget, fromxsl_t *xsls)
{
- toxsl_t *to_f = xsls->xsls;
+ toxsl_t *to_f;
+
+ while(xsls != NULL && xsls->name != gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (widget)))
{
+ xsls = xsls->next;
+ }
+
+ to_f = xsls->xsls;
from_deactivate(xsl_from);
xsl_from = xsls;
xsl_to = to_f;
-
- gtk_menu_item_activate(GTK_MENU_ITEM(to_f->item));
- while(to_f != NULL)
- {
- gtk_widget_set_sensitive(to_f->item, 1);
- to_f = to_f->next;
- }
}
static void
@@ -71,6 +69,9 @@ from_deactivate(fromxsl_t *xsls)
static void
to_update(GtkWidget *widget, toxsl_t *lng)
{
+ while(lng != NULL && lng->name != gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (widget))) {
+ lng = lng->next;
+ }
/* printf("To: %s\n", lng->name); */
xsl_to = lng;
}
@@ -86,7 +87,7 @@ void
xslt_dialog_create(void) {
GtkWidget *box, *vbox;
- GtkWidget *omenu, *menu, *menuitem;
+ GtkWidget *omenu;
GSList *group;
GtkWidget *label;
@@ -113,24 +114,19 @@ xslt_dialog_create(void) {
label = gtk_label_new(_("From:"));
- omenu = gtk_option_menu_new ();
- menu = gtk_menu_new ();
+ omenu = gtk_combo_box_text_new ();
group = NULL;
-
+
+ g_signal_connect (G_OBJECT (omenu), "changed",
+ G_CALLBACK (from_activate), cur_f);
+
while(cur_f != NULL)
{
- menuitem = gtk_radio_menu_item_new_with_label (group, cur_f->name);
- g_signal_connect (G_OBJECT (menuitem), "activate",
- G_CALLBACK (from_activate), cur_f);
- group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem));
- gtk_menu_append (GTK_MENU (menu), menuitem);
- gtk_widget_show (menuitem);
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (omenu), cur_f->name, cur_f->name);
cur_f = cur_f->next;
}
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
- gtk_widget_show(menu);
gtk_widget_show(omenu);
gtk_widget_show(label);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
@@ -148,29 +144,23 @@ xslt_dialog_create(void) {
label = gtk_label_new(_("To:"));
- omenu = gtk_option_menu_new ();
- menu = gtk_menu_new ();
+ omenu = gtk_combo_box_text_new ();
group = NULL;
+
+ g_signal_connect (G_OBJECT (omenu), "changed",
+ G_CALLBACK (to_update), cur_to );
while(cur_f != NULL)
{
cur_to = cur_f->xsls;
while(cur_to != NULL)
{
- menuitem = gtk_radio_menu_item_new_with_label (group, cur_to->name);
- g_signal_connect (G_OBJECT (menuitem), "activate",
- G_CALLBACK (to_update), cur_to );
- group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem));
- gtk_menu_append (GTK_MENU (menu), menuitem);
- gtk_widget_show (menuitem);
- cur_to->item = menuitem;
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (omenu), cur_to->name, cur_to->name);
cur_to = cur_to->next;
}
cur_f = cur_f->next;
}
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
- gtk_widget_show(menu);
gtk_widget_show(omenu);
gtk_widget_show(label);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]