1 /* gEDA - GPL Electronic Design Automation
2 * gschem - gEDA Schematic Capture
3 * Copyright (C) 1998-2010 Ales Hvezda
4 * Copyright (C) 1998-2020 gEDA Contributors (see ChangeLog for details)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 * \file gschem_object_properties_dockable.c
23 * \brief A dialog box for editing object properties.
37 #include <gdk/gdkkeysyms.h>
39 #include "../include/gschem_object_properties_dockable.h"
43 class_init (GschemObjectPropertiesDockableClass
*klass
);
46 create_fill_property_widget (GschemObjectPropertiesDockable
*dialog
);
49 create_general_property_widget (GschemObjectPropertiesDockable
*dialog
);
52 create_line_property_widget (GschemObjectPropertiesDockable
*dialog
);
55 create_pin_property_widget (GschemObjectPropertiesDockable
*dialog
);
58 dispose (GObject
*object
);
61 create_widget (GschemDockable
*parent
);
64 set_selection_adapter (GschemObjectPropertiesDockable
*dialog
, GschemSelectionAdapter
*adapter
);
67 update_cap_style_model (GtkWidget
*widget
, GschemObjectPropertiesDockable
*dialog
);
70 update_cap_style_widget (GschemObjectPropertiesDockable
*dialog
);
73 update_fill_type_model (GtkWidget
*widget
, GschemObjectPropertiesDockable
*dialog
);
76 update_fill_type_widget (GschemObjectPropertiesDockable
*dialog
);
79 update_line_type_model (GtkWidget
*widget
, GschemObjectPropertiesDockable
*dialog
);
82 update_line_type_widget (GschemObjectPropertiesDockable
*dialog
);
85 update_object_color_model (GtkWidget
*widget
, GschemObjectPropertiesDockable
*dialog
);
88 update_object_color_widget (GschemObjectPropertiesDockable
*dialog
);
91 update_pin_type_model (GtkWidget
*widget
, GschemObjectPropertiesDockable
*dialog
);
94 update_pin_type_widget (GschemObjectPropertiesDockable
*dialog
);
97 /*! \brief Get/register GschemObjectPropertiesDockable type.
100 gschem_object_properties_dockable_get_type()
102 static GType type
= 0;
105 static const GTypeInfo info
= {
106 sizeof(GschemObjectPropertiesDockableClass
),
107 NULL
, /* base_init */
108 NULL
, /* base_finalize */
109 (GClassInitFunc
) class_init
,
110 NULL
, /* class_finalize */
111 NULL
, /* class_data */
112 sizeof(GschemObjectPropertiesDockable
),
114 NULL
, /* instance_init */
117 type
= g_type_register_static (GSCHEM_TYPE_DOCKABLE
, "GschemObjectPropertiesDockable", &info
, 0);
126 * \brief Initialize GschemObjectPropertiesDockable class
128 * \par Function Description
130 * GType class initialiser for Multiattrib. We override our parent
131 * virtual class methods as needed and register our GObject properties.
136 class_init (GschemObjectPropertiesDockableClass
*klass
)
138 GObjectClass
*object_class
;
140 g_return_if_fail (klass
!= NULL
);
142 GSCHEM_DOCKABLE_CLASS (klass
)->create_widget
= create_widget
;
144 object_class
= G_OBJECT_CLASS (klass
);
146 g_return_if_fail (object_class
!= NULL
);
148 object_class
->dispose
= dispose
;
154 * \brief Create a fill property section widget
157 * \return A new fill property section widget
160 create_fill_property_widget (GschemObjectPropertiesDockable
*dialog
)
164 GtkWidget
*widget
[6];
166 label
[0] = gschem_dialog_misc_create_property_label (_("Fill Type:"));
167 label
[1] = gschem_dialog_misc_create_property_label (_("Line Width:"));
168 label
[2] = gschem_dialog_misc_create_property_label (_("Angle 1:"));
169 label
[3] = gschem_dialog_misc_create_property_label (_("Pitch 1:"));
170 label
[4] = gschem_dialog_misc_create_property_label (_("Angle 2:"));
171 label
[5] = gschem_dialog_misc_create_property_label (_("Pitch 2:"));
173 widget
[0] = dialog
->fstylecb
= x_fstylecb_new ();
174 widget
[1] = dialog
->widthe
= gschem_integer_combo_box_new ();
175 widget
[2] = dialog
->angle1e
= gschem_integer_combo_box_new ();
176 widget
[3] = dialog
->pitch1e
= gschem_integer_combo_box_new ();
177 widget
[4] = dialog
->angle2e
= gschem_integer_combo_box_new ();
178 widget
[5] = dialog
->pitch2e
= gschem_integer_combo_box_new ();
180 table
= gschem_dialog_misc_create_property_table (label
, widget
, 6);
182 dialog
->bindings
= g_slist_append (dialog
->bindings
,
183 gschem_binding_integer_new ("fill-width",
186 dialog
->bindings
= g_slist_append (dialog
->bindings
,
187 gschem_binding_integer_new ("fill-angle1",
190 dialog
->bindings
= g_slist_append (dialog
->bindings
,
191 gschem_binding_integer_new ("fill-pitch1",
194 dialog
->bindings
= g_slist_append (dialog
->bindings
,
195 gschem_binding_integer_new ("fill-angle2",
198 dialog
->bindings
= g_slist_append (dialog
->bindings
,
199 gschem_binding_integer_new ("fill-pitch2",
202 g_signal_connect (G_OBJECT (dialog
->fstylecb
), "changed",
203 G_CALLBACK (update_fill_type_model
),
206 g_signal_connect (G_OBJECT (gschem_integer_combo_box_get_entry (dialog
->widthe
)),
208 G_CALLBACK (gschem_dialog_misc_entry_activate
),
211 g_signal_connect (G_OBJECT (gschem_integer_combo_box_get_entry (dialog
->angle1e
)),
213 G_CALLBACK (gschem_dialog_misc_entry_activate
),
216 g_signal_connect (G_OBJECT (gschem_integer_combo_box_get_entry (dialog
->pitch1e
)),
218 G_CALLBACK (gschem_dialog_misc_entry_activate
),
221 g_signal_connect (G_OBJECT (gschem_integer_combo_box_get_entry (dialog
->angle2e
)),
223 G_CALLBACK (gschem_dialog_misc_entry_activate
),
226 g_signal_connect (G_OBJECT (gschem_integer_combo_box_get_entry (dialog
->pitch2e
)),
228 G_CALLBACK (gschem_dialog_misc_entry_activate
),
231 return gschem_dialog_misc_create_section_widget (_("<b>Fill Properties</b>"), table
);
237 * \brief Create a general property section widget
240 * \return A new general property section widget
243 create_general_property_widget (GschemObjectPropertiesDockable
*dialog
)
247 GtkWidget
*widget
[1];
249 label
[0] = gschem_dialog_misc_create_property_label (_("Color:"));
251 widget
[0] = dialog
->colorcb
= x_colorcb_new ();
253 table
= gschem_dialog_misc_create_property_table (label
, widget
, 1);
255 g_signal_connect(G_OBJECT (dialog
->colorcb
),
257 G_CALLBACK (update_object_color_model
),
260 return gschem_dialog_misc_create_section_widget (_("<b>General Properties</b>"), table
);
266 * \brief Create a line property section widget
269 * \return A new line property section widget
272 create_line_property_widget (GschemObjectPropertiesDockable
*dialog
)
276 GtkWidget
*widget
[5];
278 label
[0] = gschem_dialog_misc_create_property_label (_("Type:"));
279 label
[1] = gschem_dialog_misc_create_property_label (_("Width:"));
280 label
[2] = gschem_dialog_misc_create_property_label (_("Dash Length:"));
281 label
[3] = gschem_dialog_misc_create_property_label (_("Dash Space:"));
282 label
[4] = gschem_dialog_misc_create_property_label (_("Cap style:"));
284 widget
[0] = dialog
->line_type
= x_linetypecb_new ();
285 widget
[1] = dialog
->width_entry
= gschem_integer_combo_box_new ();
286 widget
[2] = dialog
->length_entry
= gschem_integer_combo_box_new ();
287 widget
[3] = dialog
->space_entry
= gschem_integer_combo_box_new ();
288 widget
[4] = dialog
->line_end
= x_linecapcb_new ();
290 table
= gschem_dialog_misc_create_property_table (label
, widget
, 5);
292 dialog
->bindings
= g_slist_append (dialog
->bindings
,
293 gschem_binding_integer_new ("line-width",
296 dialog
->bindings
= g_slist_append (dialog
->bindings
,
297 gschem_binding_integer_new ("dash-length",
300 dialog
->bindings
= g_slist_append (dialog
->bindings
,
301 gschem_binding_integer_new ("dash-space",
304 g_signal_connect (G_OBJECT (dialog
->line_type
), "changed",
305 G_CALLBACK (update_line_type_model
),
308 g_signal_connect (G_OBJECT (dialog
->line_end
), "changed",
309 G_CALLBACK (update_cap_style_model
),
312 g_signal_connect (G_OBJECT (gschem_integer_combo_box_get_entry (dialog
->width_entry
)),
314 G_CALLBACK (gschem_dialog_misc_entry_activate
),
317 g_signal_connect (G_OBJECT (gschem_integer_combo_box_get_entry (dialog
->length_entry
)),
319 G_CALLBACK (gschem_dialog_misc_entry_activate
),
322 g_signal_connect (G_OBJECT (gschem_integer_combo_box_get_entry (dialog
->space_entry
)),
324 G_CALLBACK (gschem_dialog_misc_entry_activate
),
327 return gschem_dialog_misc_create_section_widget (_("<b>Line Properties</b>"), table
);
333 * \brief Create a pin property section widget
336 * \return A new pin property section widget
339 create_pin_property_widget (GschemObjectPropertiesDockable
*dialog
)
343 GtkWidget
*widget
[1];
345 label
[0] = gschem_dialog_misc_create_property_label (_("Pin Type:"));
347 widget
[0] = dialog
->pin_type
= gschem_pin_type_combo_new ();
349 table
= gschem_dialog_misc_create_property_table (label
, widget
, 1);
351 g_signal_connect (G_OBJECT (dialog
->pin_type
),
353 G_CALLBACK (update_pin_type_model
),
356 return gschem_dialog_misc_create_section_widget (_("<b>Pin Properties</b>"), table
);
363 * \param [in,out] object This object
366 dispose (GObject
*object
)
368 GschemObjectPropertiesDockable
*dialog
;
369 GschemObjectPropertiesDockableClass
*klass
;
370 GObjectClass
*parent_class
;
372 g_return_if_fail (object
!= NULL
);
374 dialog
= GSCHEM_OBJECT_PROPERTIES_DOCKABLE (object
);
376 set_selection_adapter (dialog
, NULL
);
378 g_slist_foreach (dialog
->bindings
, (GFunc
) g_object_unref
, NULL
);
379 g_slist_free (dialog
->bindings
);
380 dialog
->bindings
= NULL
;
382 /* lastly, chain up to the parent dispose */
384 klass
= GSCHEM_OBJECT_PROPERTIES_DOCKABLE_GET_CLASS (object
);
385 g_return_if_fail (klass
!= NULL
);
386 parent_class
= g_type_class_peek_parent (klass
);
387 g_return_if_fail (parent_class
!= NULL
);
388 parent_class
->dispose (object
);
393 * \brief Create GschemObjectPropertiesDockable widgets and set up
394 * property change notifications
396 * \param [in,out] parent This dockable
399 create_widget (GschemDockable
*parent
)
401 GschemObjectPropertiesDockable
*dialog
=
402 GSCHEM_OBJECT_PROPERTIES_DOCKABLE (parent
);
403 GschemToplevel
*w_current
= parent
->w_current
;
409 scrolled
= gtk_scrolled_window_new (NULL
, NULL
);
411 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled
),
413 GTK_POLICY_AUTOMATIC
);
415 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled
),
418 viewport
= gtk_viewport_new (NULL
, NULL
);
419 gtk_container_add (GTK_CONTAINER (scrolled
), viewport
);
421 gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport
),
424 vbox
= gtk_vbox_new (FALSE
, DIALOG_V_SPACING
);
425 gtk_container_set_border_width (GTK_CONTAINER (vbox
), DIALOG_BORDER_SPACING
);
426 gtk_container_add (GTK_CONTAINER (viewport
), vbox
);
428 dialog
->general_section_widget
= create_general_property_widget (dialog
);
429 dialog
->line_section_widget
= create_line_property_widget (dialog
);
430 dialog
->fill_section_widget
= create_fill_property_widget (dialog
);
431 dialog
->pin_section_widget
= create_pin_property_widget (dialog
);
433 gtk_box_pack_start (GTK_BOX (vbox
), /* box */
434 dialog
->general_section_widget
, /* child */
439 gtk_box_pack_start (GTK_BOX (vbox
), /* box */
440 dialog
->line_section_widget
, /* child */
445 gtk_box_pack_start (GTK_BOX (vbox
), /* box */
446 dialog
->fill_section_widget
, /* child */
451 gtk_box_pack_start (GTK_BOX (vbox
), /* box */
452 dialog
->pin_section_widget
, /* child */
458 gschem_integer_combo_box_set_model (dialog
->width_entry
,
459 gschem_toplevel_get_line_width_list_store (w_current
));
461 gschem_integer_combo_box_set_model (dialog
->length_entry
,
462 gschem_toplevel_get_dash_length_list_store (w_current
));
464 gschem_integer_combo_box_set_model (dialog
->space_entry
,
465 gschem_toplevel_get_dash_space_list_store (w_current
));
467 gschem_integer_combo_box_set_model (dialog
->widthe
,
468 gschem_toplevel_get_fill_width_list_store (w_current
));
470 gschem_integer_combo_box_set_model (dialog
->angle1e
,
471 gschem_toplevel_get_fill_angle_list_store (w_current
));
473 gschem_integer_combo_box_set_model (dialog
->pitch1e
,
474 gschem_toplevel_get_fill_pitch_list_store (w_current
));
476 gschem_integer_combo_box_set_model (dialog
->angle2e
,
477 gschem_toplevel_get_fill_angle_list_store (w_current
));
479 gschem_integer_combo_box_set_model (dialog
->pitch2e
,
480 gschem_toplevel_get_fill_pitch_list_store (w_current
));
482 set_selection_adapter (dialog
,
483 gschem_toplevel_get_selection_adapter (w_current
));
486 gtk_widget_show_all (scrolled
);
493 * \brief Set the selection that this dialog manipulates
495 * \param [in,out] dialog This dialog
496 * \param [in] selection The selection to manipulate
499 set_selection_adapter (GschemObjectPropertiesDockable
*dialog
, GschemSelectionAdapter
*adapter
)
501 g_return_if_fail (dialog
!= NULL
);
503 if (dialog
->adapter
!= NULL
) {
504 g_signal_handlers_disconnect_by_func (dialog
->adapter
,
505 G_CALLBACK (update_pin_type_widget
),
508 g_signal_handlers_disconnect_by_func (dialog
->adapter
,
509 G_CALLBACK (update_object_color_widget
),
512 g_signal_handlers_disconnect_by_func (dialog
->adapter
,
513 G_CALLBACK (update_line_type_widget
),
516 g_signal_handlers_disconnect_by_func (dialog
->adapter
,
517 G_CALLBACK (update_fill_type_widget
),
520 g_signal_handlers_disconnect_by_func (dialog
->adapter
,
521 G_CALLBACK (update_cap_style_widget
),
524 g_object_unref (dialog
->adapter
);
527 dialog
->adapter
= adapter
;
529 g_slist_foreach (dialog
->bindings
,
530 (GFunc
) gschem_binding_set_model_object
,
533 if (dialog
->adapter
!= NULL
) {
534 g_object_ref (dialog
->adapter
);
536 g_signal_connect_swapped (dialog
->adapter
,
538 G_CALLBACK (update_cap_style_widget
),
541 g_signal_connect_swapped (dialog
->adapter
,
543 G_CALLBACK (update_fill_type_widget
),
546 g_signal_connect_swapped (dialog
->adapter
,
548 G_CALLBACK (update_line_type_widget
),
551 g_signal_connect_swapped (dialog
->adapter
,
552 "notify::object-color",
553 G_CALLBACK (update_object_color_widget
),
556 g_signal_connect_swapped (dialog
->adapter
,
558 G_CALLBACK (update_pin_type_widget
),
561 update_cap_style_widget (dialog
);
562 update_fill_type_widget (dialog
);
563 update_line_type_widget (dialog
);
564 update_object_color_widget (dialog
);
565 update_pin_type_widget (dialog
);
571 /*! \brief Update the cap style value in the model
573 * \param [in] widget The widget emitting the event
574 * \param [in] dialog The line properties dialog box
577 update_cap_style_model (GtkWidget
*widget
, GschemObjectPropertiesDockable
*dialog
)
580 GschemToplevel
*w_current
;
582 g_return_if_fail (dialog
!= NULL
);
583 g_return_if_fail (widget
!= NULL
);
585 w_current
= dialog
->parent
.w_current
;
586 g_return_if_fail (w_current
!= NULL
);
588 toplevel
= gschem_toplevel_get_toplevel (w_current
);
589 g_return_if_fail (toplevel
!= NULL
);
591 if ((dialog
->adapter
!= NULL
) && (dialog
->line_end
!= NULL
)) {
594 g_return_if_fail (widget
== dialog
->line_end
);
596 cap_style
= x_linecapcb_get_index (dialog
->line_end
);
598 if (cap_style
>= 0) {
599 gschem_selection_adapter_set_cap_style (dialog
->adapter
, cap_style
);
607 * \brief Update the value in the cap style widget
609 * \param [in,out] dialog This dialog
612 update_cap_style_widget (GschemObjectPropertiesDockable
*dialog
)
614 g_return_if_fail (dialog
!= NULL
);
615 g_return_if_fail (dialog
->line_end
!= NULL
);
617 if (dialog
->adapter
!= NULL
) {
618 int end
= gschem_selection_adapter_get_cap_style (dialog
->adapter
);
620 g_signal_handlers_block_by_func (G_OBJECT (dialog
->line_end
),
621 G_CALLBACK (update_cap_style_model
),
624 x_linecapcb_set_index (dialog
->line_end
, end
);
626 g_signal_handlers_unblock_by_func (G_OBJECT (dialog
->line_end
),
627 G_CALLBACK (update_cap_style_model
),
630 gtk_widget_set_sensitive (GTK_WIDGET (dialog
->line_end
), (end
!= NO_SELECTION
));
637 * \brief Update the cap style value in the model
639 * \param [in] widget The widget emitting the event
640 * \param [in] dialog The line properties dialog box
643 update_fill_type_model (GtkWidget
*widget
, GschemObjectPropertiesDockable
*dialog
)
646 GschemToplevel
*w_current
;
648 g_return_if_fail (dialog
!= NULL
);
649 g_return_if_fail (widget
!= NULL
);
651 w_current
= dialog
->parent
.w_current
;
652 g_return_if_fail (w_current
!= NULL
);
654 toplevel
= gschem_toplevel_get_toplevel (w_current
);
655 g_return_if_fail (toplevel
!= NULL
);
657 if ((dialog
->adapter
!= NULL
) && (dialog
->fstylecb
!= NULL
)) {
660 g_return_if_fail (widget
== dialog
->fstylecb
);
662 fill_type
= x_fstylecb_get_index (dialog
->fstylecb
);
664 if (fill_type
>= 0) {
665 gschem_selection_adapter_set_fill_type (dialog
->adapter
, fill_type
);
673 * \brief Update the value in the fill type widget
675 * \param [in,out] dialog This dialog
678 update_fill_type_widget (GschemObjectPropertiesDockable
*dialog
)
680 g_return_if_fail (dialog
!= NULL
);
681 g_return_if_fail (dialog
->fstylecb
!= NULL
);
683 if (dialog
->adapter
!= NULL
) {
684 int index
= gschem_selection_adapter_get_fill_type (dialog
->adapter
);
686 g_signal_handlers_block_by_func (G_OBJECT (dialog
->fstylecb
),
687 G_CALLBACK (update_fill_type_model
),
690 x_fstylecb_set_index (dialog
->fstylecb
, index
);
692 g_signal_handlers_unblock_by_func (G_OBJECT (dialog
->fstylecb
),
693 G_CALLBACK (update_fill_type_model
),
696 gtk_widget_set_sensitive (GTK_WIDGET (dialog
->fstylecb
), (index
!= NO_SELECTION
));
702 /*! \brief Update the line type value in the model
704 * \param [in] widget The widget emitting the event
705 * \param [in] dialog The line properties dialog box
708 update_line_type_model (GtkWidget
*widget
, GschemObjectPropertiesDockable
*dialog
)
711 GschemToplevel
*w_current
;
713 g_return_if_fail (dialog
!= NULL
);
714 g_return_if_fail (widget
!= NULL
);
716 w_current
= dialog
->parent
.w_current
;
717 g_return_if_fail (w_current
!= NULL
);
719 toplevel
= gschem_toplevel_get_toplevel (w_current
);
720 g_return_if_fail (toplevel
!= NULL
);
722 if ((dialog
->adapter
!= NULL
) && (dialog
->line_type
!= NULL
)) {
725 g_return_if_fail (widget
== dialog
->line_type
);
727 line_type
= x_linetypecb_get_index (dialog
->line_type
);
729 if (line_type
>= 0) {
730 gschem_selection_adapter_set_line_type (dialog
->adapter
, line_type
);
738 * \brief Update the value in the line type widget
740 * \param [in,out] dialog This dialog
743 update_line_type_widget (GschemObjectPropertiesDockable
*dialog
)
745 g_return_if_fail (dialog
!= NULL
);
746 g_return_if_fail (dialog
->line_type
!= NULL
);
748 if (dialog
->adapter
!= NULL
) {
749 int type
= gschem_selection_adapter_get_line_type (dialog
->adapter
);
751 g_signal_handlers_block_by_func (G_OBJECT (dialog
->line_type
),
752 G_CALLBACK (update_line_type_model
),
755 x_linetypecb_set_index (dialog
->line_type
, type
);
757 g_signal_handlers_unblock_by_func (G_OBJECT (dialog
->line_type
),
758 G_CALLBACK (update_line_type_model
),
761 gtk_widget_set_sensitive (GTK_WIDGET (dialog
->line_type
), (type
!= NO_SELECTION
));
767 /*! \brief Update the object color value in the model
769 * \param [in] widget The widget emitting the event
770 * \param [in] dialog The line properties dialog box
773 update_object_color_model (GtkWidget
*widget
, GschemObjectPropertiesDockable
*dialog
)
776 GschemToplevel
*w_current
;
778 g_return_if_fail (dialog
!= NULL
);
779 g_return_if_fail (widget
!= NULL
);
781 w_current
= dialog
->parent
.w_current
;
782 g_return_if_fail (w_current
!= NULL
);
784 toplevel
= gschem_toplevel_get_toplevel (w_current
);
785 g_return_if_fail (toplevel
!= NULL
);
787 if ((dialog
->adapter
!= NULL
) && (dialog
->colorcb
!= NULL
)) {
790 g_return_if_fail (widget
== dialog
->colorcb
);
792 color
= x_colorcb_get_index (dialog
->colorcb
);
795 gschem_selection_adapter_set_object_color (dialog
->adapter
, color
);
803 * \brief Update the value in the object color widget
805 * \param [in,out] dialog This dialog
808 update_object_color_widget (GschemObjectPropertiesDockable
*dialog
)
810 g_return_if_fail (dialog
!= NULL
);
811 g_return_if_fail (dialog
->colorcb
!= NULL
);
813 if (dialog
->adapter
!= NULL
) {
814 int color
= gschem_selection_adapter_get_object_color (dialog
->adapter
);
816 g_signal_handlers_block_by_func (G_OBJECT (dialog
->colorcb
),
817 G_CALLBACK (update_object_color_model
),
820 x_colorcb_set_index (dialog
->colorcb
, color
);
822 g_signal_handlers_unblock_by_func (G_OBJECT (dialog
->colorcb
),
823 G_CALLBACK (update_object_color_model
),
826 gtk_widget_set_sensitive (GTK_WIDGET (dialog
->colorcb
), (color
!= NO_SELECTION
));
831 /*! \brief Update the pin type value in the model
833 * \param [in] widget The widget emitting the event
834 * \param [in] dialog The line properties dialog box
837 update_pin_type_model (GtkWidget
*widget
, GschemObjectPropertiesDockable
*dialog
)
840 GschemToplevel
*w_current
;
842 g_return_if_fail (dialog
!= NULL
);
843 g_return_if_fail (widget
!= NULL
);
845 w_current
= dialog
->parent
.w_current
;
846 g_return_if_fail (w_current
!= NULL
);
848 toplevel
= gschem_toplevel_get_toplevel (w_current
);
849 g_return_if_fail (toplevel
!= NULL
);
851 if ((dialog
->adapter
!= NULL
) && (dialog
->pin_type
!= NULL
)) {
854 g_return_if_fail (widget
== dialog
->pin_type
);
856 pin_type
= gschem_pin_type_combo_get_index (dialog
->pin_type
);
859 gschem_selection_adapter_set_pin_type (dialog
->adapter
, pin_type
);
867 * \brief Update the value in the pin type widget
869 * \param [in,out] dialog This dialog
872 update_pin_type_widget (GschemObjectPropertiesDockable
*dialog
)
874 g_return_if_fail (dialog
!= NULL
);
875 g_return_if_fail (dialog
->pin_type
!= NULL
);
877 if (dialog
->adapter
!= NULL
) {
878 int type
= gschem_selection_adapter_get_pin_type (dialog
->adapter
);
880 g_signal_handlers_block_by_func (G_OBJECT (dialog
->pin_type
),
881 G_CALLBACK (update_pin_type_model
),
884 gschem_pin_type_combo_set_index (dialog
->pin_type
, type
);
886 g_signal_handlers_unblock_by_func (G_OBJECT (dialog
->pin_type
),
887 G_CALLBACK (update_pin_type_model
),
890 gtk_widget_set_sensitive (GTK_WIDGET (dialog
->pin_type
), (type
!= NO_SELECTION
));