From: Jim Evins Date: Sun, 22 Sep 2002 04:42:33 +0000 (+0000) Subject: HIG applied to more dialogs. X-Git-Tag: glabels-2_3_0~755 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ffda9a42e2bc020470ddd824f3ae041c2ce9daa3;p=glabels HIG applied to more dialogs. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@130 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels2/src/file.c b/glabels2/src/file.c index 8ab64d8f..bea137a4 100644 --- a/glabels2/src/file.c +++ b/glabels2/src/file.c @@ -96,6 +96,7 @@ gl_file_new (void) g_signal_connect (G_OBJECT(dlg), "response", G_CALLBACK (new_response), dlg); + gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE); gtk_widget_show_all (GTK_WIDGET (dlg)); gl_debug (DEBUG_FILE, "END"); diff --git a/glabels2/src/merge-properties.c b/glabels2/src/merge-properties.c index 0ade9e48..a97ce502 100644 --- a/glabels2/src/merge-properties.c +++ b/glabels2/src/merge-properties.c @@ -195,6 +195,8 @@ create_merge_dialog_widgets (glHigDialog * dialog, G_CALLBACK (src_changed_cb), data); gl_merge_free (&merge); + + gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); } /*--------------------------------------------------------------------------*/ diff --git a/glabels2/src/view-box.c b/glabels2/src/view-box.c index b956d9bd..dba80c2e 100644 --- a/glabels2/src/view-box.c +++ b/glabels2/src/view-box.c @@ -265,12 +265,13 @@ update_view_box_cb (glLabelObject *object, static GtkWidget * construct_properties_dialog (glViewBox *view_box) { - GtkWidget *dialog, *notebook, *wvbox; + GtkWidget *dialog, *wsection; BonoboWindow *win = glabels_get_active_window (); glLabelObject *object; gdouble line_width; guint line_color, fill_color; gdouble x, y, w, h, label_width, label_height; + GtkSizeGroup *label_size_group; gl_debug (DEBUG_VIEW, "START"); @@ -287,74 +288,78 @@ construct_properties_dialog (glViewBox *view_box) /*-----------------------------------------------------------------*/ /* Build dialog with notebook. */ /*-----------------------------------------------------------------*/ - dialog = gtk_dialog_new_with_buttons ( _("Edit box object properties"), - GTK_WINDOW (win), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CLOSE, + dialog = gl_hig_dialog_new_with_buttons ( _("Edit box object properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, - NULL ); + NULL ); + gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (response_cb), view_box); - notebook = gtk_notebook_new (); - gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), - notebook, TRUE, TRUE, 0); + label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + /*---------------------------*/ - /* Appearance Notebook Tab */ + /* Outline section */ /*---------------------------*/ - wvbox = gtk_vbox_new (FALSE, GNOME_PAD); - gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, - gtk_label_new (_("Appearance"))); - - /* ------ Line box ------ */ + wsection = gl_hig_category_new (_("Outline")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); view_box->private->line = gl_wdgt_line_new (); + gl_wdgt_line_set_label_size_group (GL_WDGT_LINE(view_box->private->line), + label_size_group); gl_wdgt_line_set_params (GL_WDGT_LINE (view_box->private->line), line_width, line_color); - gtk_box_pack_start (GTK_BOX (wvbox), view_box->private->line, - FALSE, FALSE, 0); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_box->private->line); g_signal_connect (G_OBJECT (view_box->private->line), "changed", G_CALLBACK(line_changed_cb), view_box); - /* ------ Fill box ------ */ + /*---------------------------*/ + /* Fill section */ + /*---------------------------*/ + wsection = gl_hig_category_new (_("Fill")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); view_box->private->fill = gl_wdgt_fill_new (); + gl_wdgt_fill_set_label_size_group (GL_WDGT_FILL(view_box->private->fill), + label_size_group); gl_wdgt_fill_set_params (GL_WDGT_FILL (view_box->private->fill), fill_color); - gtk_box_pack_start (GTK_BOX (wvbox), view_box->private->fill, - FALSE, FALSE, 0); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_box->private->fill); g_signal_connect (G_OBJECT (view_box->private->fill), "changed", G_CALLBACK(fill_changed_cb), view_box); - /*----------------------------*/ - /* Position/Size Notebook Tab */ - /*----------------------------*/ - wvbox = gtk_vbox_new (FALSE, GNOME_PAD); - gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, - gtk_label_new (_("Position/Size"))); - - /* ------ Position Frame ------ */ + /*---------------------------*/ + /* Position section */ + /*---------------------------*/ + wsection = gl_hig_category_new (_("Position")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); view_box->private->position = gl_wdgt_position_new (); + gl_wdgt_position_set_label_size_group (GL_WDGT_POSITION(view_box->private->position), + label_size_group); gl_wdgt_position_set_params (GL_WDGT_POSITION (view_box->private->position), - x, y, - label_width, label_height); - gtk_box_pack_start (GTK_BOX (wvbox), view_box->private->position, - FALSE, FALSE, 0); + x, y, label_width, label_height); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_box->private->position); g_signal_connect (G_OBJECT (view_box->private->position), "changed", G_CALLBACK(position_changed_cb), view_box); - - /* ------ Size Frame ------ */ - view_box->private->size = gl_wdgt_size_new (_("Size")); + /*---------------------------*/ + /* Size section */ + /*---------------------------*/ + wsection = gl_hig_category_new (_("Size")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); + view_box->private->size = gl_wdgt_size_new (); + gl_wdgt_size_set_label_size_group (GL_WDGT_SIZE(view_box->private->size), + label_size_group); gl_wdgt_size_set_params (GL_WDGT_SIZE (view_box->private->size), - w, h, - TRUE, - label_width, label_height); - gtk_box_pack_start (GTK_BOX (wvbox), view_box->private->size, - FALSE, FALSE, 0); + w, h, TRUE, label_width, label_height); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_box->private->size); g_signal_connect (G_OBJECT (view_box->private->size), "changed", G_CALLBACK(size_changed_cb), view_box); diff --git a/glabels2/src/view-ellipse.c b/glabels2/src/view-ellipse.c index ae030f26..09b6cf2d 100644 --- a/glabels2/src/view-ellipse.c +++ b/glabels2/src/view-ellipse.c @@ -265,12 +265,13 @@ update_view_ellipse_cb (glLabelObject *object, static GtkWidget * construct_properties_dialog (glViewEllipse *view_ellipse) { - GtkWidget *dialog, *notebook, *wvbox; + GtkWidget *dialog, *wsection; BonoboWindow *win = glabels_get_active_window (); glLabelObject *object; gdouble line_width; guint line_color, fill_color; gdouble x, y, w, h, label_width, label_height; + GtkSizeGroup *label_size_group; gl_debug (DEBUG_VIEW, "START"); @@ -287,76 +288,78 @@ construct_properties_dialog (glViewEllipse *view_ellipse) /*-----------------------------------------------------------------*/ /* Build dialog with notebook. */ /*-----------------------------------------------------------------*/ - dialog = gtk_dialog_new_with_buttons ( _("Edit ellipse object properties"), - GTK_WINDOW (win), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CLOSE, + dialog = gl_hig_dialog_new_with_buttons ( _("Edit ellipse object properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, - NULL ); + NULL ); + gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (response_cb), view_ellipse); - notebook = gtk_notebook_new (); - gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), - notebook, TRUE, TRUE, 0); + label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + /*---------------------------*/ - /* Appearance Notebook Tab */ + /* Outline section */ /*---------------------------*/ - wvbox = gtk_vbox_new (FALSE, GNOME_PAD); - gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, - gtk_label_new (_("Appearance"))); - - /* ------ Line ellipse ------ */ + wsection = gl_hig_category_new (_("Outline")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); view_ellipse->private->line = gl_wdgt_line_new (); + gl_wdgt_line_set_label_size_group (GL_WDGT_LINE(view_ellipse->private->line), + label_size_group); gl_wdgt_line_set_params (GL_WDGT_LINE (view_ellipse->private->line), line_width, line_color); - gtk_box_pack_start (GTK_BOX (wvbox), view_ellipse->private->line, - FALSE, FALSE, 0); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_ellipse->private->line); g_signal_connect (G_OBJECT (view_ellipse->private->line), "changed", G_CALLBACK(line_changed_cb), view_ellipse); - /* ------ Fill ellipse ------ */ + /*---------------------------*/ + /* Fill section */ + /*---------------------------*/ + wsection = gl_hig_category_new (_("Fill")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); view_ellipse->private->fill = gl_wdgt_fill_new (); + gl_wdgt_fill_set_label_size_group (GL_WDGT_FILL(view_ellipse->private->fill), + label_size_group); gl_wdgt_fill_set_params (GL_WDGT_FILL (view_ellipse->private->fill), fill_color); - gtk_box_pack_start (GTK_BOX (wvbox), view_ellipse->private->fill, - FALSE, FALSE, 0); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_ellipse->private->fill); g_signal_connect (G_OBJECT (view_ellipse->private->fill), "changed", G_CALLBACK(fill_changed_cb), view_ellipse); - /*----------------------------*/ - /* Position/Size Notebook Tab */ - /*----------------------------*/ - wvbox = gtk_vbox_new (FALSE, GNOME_PAD); - gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, - gtk_label_new (_("Position/Size"))); - - /* ------ Position Frame ------ */ + /*---------------------------*/ + /* Position section */ + /*---------------------------*/ + wsection = gl_hig_category_new (_("Position")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); view_ellipse->private->position = gl_wdgt_position_new (); + gl_wdgt_position_set_label_size_group (GL_WDGT_POSITION(view_ellipse->private->position), + label_size_group); gl_wdgt_position_set_params (GL_WDGT_POSITION (view_ellipse->private->position), - x, y, - label_width, label_height); - gtk_box_pack_start (GTK_BOX (wvbox), - view_ellipse->private->position, - FALSE, FALSE, 0); - g_signal_connect (G_OBJECT (view_ellipse->private->position), - "changed", + x, y, label_width, label_height); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_ellipse->private->position); + g_signal_connect (G_OBJECT (view_ellipse->private->position), "changed", G_CALLBACK(position_changed_cb), view_ellipse); - - /* ------ Size Frame ------ */ - view_ellipse->private->size = gl_wdgt_size_new (_("Size")); + /*---------------------------*/ + /* Size section */ + /*---------------------------*/ + wsection = gl_hig_category_new (_("Size")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); + view_ellipse->private->size = gl_wdgt_size_new (); + gl_wdgt_size_set_label_size_group (GL_WDGT_SIZE(view_ellipse->private->size), + label_size_group); gl_wdgt_size_set_params (GL_WDGT_SIZE (view_ellipse->private->size), - w, h, - TRUE, - label_width, label_height); - gtk_box_pack_start (GTK_BOX (wvbox), view_ellipse->private->size, - FALSE, FALSE, 0); + w, h, TRUE, label_width, label_height); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_ellipse->private->size); g_signal_connect (G_OBJECT (view_ellipse->private->size), "changed", G_CALLBACK(size_changed_cb), view_ellipse); diff --git a/glabels2/src/view-image.c b/glabels2/src/view-image.c index 152aa6cf..3f58ec46 100644 --- a/glabels2/src/view-image.c +++ b/glabels2/src/view-image.c @@ -259,11 +259,12 @@ update_view_image_cb (glLabelObject *object, static GtkWidget * construct_properties_dialog (glViewImage *view_image) { - GtkWidget *dialog, *notebook, *wvbox, *wbutton; + GtkWidget *dialog, *wsection, *wbutton; BonoboWindow *win = glabels_get_active_window (); glLabelObject *object; gdouble x, y, w, h, label_width, label_height; gchar *filename; + GtkSizeGroup *label_size_group; gl_debug (DEBUG_VIEW, "START"); @@ -278,28 +279,23 @@ construct_properties_dialog (glViewImage *view_image) /*-----------------------------------------------------------------*/ /* Build dialog with notebook. */ /*-----------------------------------------------------------------*/ - dialog = gtk_dialog_new_with_buttons ( _("Edit image object properties"), - GTK_WINDOW (win), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CLOSE, + dialog = gl_hig_dialog_new_with_buttons ( _("Edit image object properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, - NULL ); + NULL ); + gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (response_cb), view_image); - notebook = gtk_notebook_new (); - gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), - notebook, TRUE, TRUE, 0); + label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); /*---------------------------*/ - /* Image Notebook Tab */ + /* Image section */ /*---------------------------*/ - wvbox = gtk_vbox_new (FALSE, GNOME_PAD); - gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, - gtk_label_new (_("Image"))); - - /* image entry */ + wsection = gl_hig_category_new (_("Image")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); view_image->private->pixmap_entry = gnome_pixmap_entry_new ("image", "Load image", TRUE); gnome_pixmap_entry_set_preview_size (GNOME_PIXMAP_ENTRY @@ -320,8 +316,8 @@ construct_properties_dialog (glViewImage *view_image) image_path = g_get_current_dir (); } - gtk_box_pack_start (GTK_BOX (wvbox), view_image->private->pixmap_entry, - FALSE, FALSE, 0); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_image->private->pixmap_entry); g_signal_connect ( G_OBJECT(gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (view_image->private->pixmap_entry))), "changed", G_CALLBACK (file_changed_cb), @@ -329,40 +325,40 @@ construct_properties_dialog (glViewImage *view_image) /*----------------------------*/ - /* Position/Size Notebook Tab */ + /* Position section */ /*----------------------------*/ - wvbox = gtk_vbox_new (FALSE, GNOME_PAD); - gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, - gtk_label_new (_("Position/Size"))); - - /* ------ Position Frame ------ */ + wsection = gl_hig_category_new (_("Position")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); view_image->private->position = gl_wdgt_position_new (); + gl_wdgt_position_set_label_size_group (GL_WDGT_POSITION(view_image->private->position), + label_size_group); gl_wdgt_position_set_params (GL_WDGT_POSITION (view_image->private->position), - x, y, - label_width, label_height); - gtk_box_pack_start (GTK_BOX (wvbox), - view_image->private->position, - FALSE, FALSE, 0); + x, y, label_width, label_height); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_image->private->position); g_signal_connect (G_OBJECT (view_image->private->position), "changed", G_CALLBACK(position_changed_cb), view_image); - /* ------ Size Frame ------ */ - view_image->private->size = gl_wdgt_size_new (_("Size")); + /*----------------------------*/ + /* Size section */ + /*----------------------------*/ + wsection = gl_hig_category_new (_("Size")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); + view_image->private->size = gl_wdgt_size_new (); + gl_wdgt_size_set_label_size_group (GL_WDGT_SIZE(view_image->private->size), + label_size_group); gl_wdgt_size_set_params (GL_WDGT_SIZE (view_image->private->size), - w, h, - TRUE, - label_width, label_height); - gtk_box_pack_start (GTK_BOX (wvbox), view_image->private->size, - FALSE, FALSE, 0); + w, h, TRUE, label_width, label_height); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_image->private->size); g_signal_connect (G_OBJECT (view_image->private->size), "changed", G_CALLBACK(size_changed_cb), view_image); /* ------ Size Reset Button ------ */ wbutton = gtk_button_new_with_label (_("Reset image size")); - gtk_box_pack_start (GTK_BOX (wvbox), wbutton, FALSE, FALSE, 0); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), wbutton); g_signal_connect (G_OBJECT (wbutton), "clicked", G_CALLBACK (size_reset_cb), view_image); diff --git a/glabels2/src/view-line.c b/glabels2/src/view-line.c index b6242b4c..2ec83848 100644 --- a/glabels2/src/view-line.c +++ b/glabels2/src/view-line.c @@ -265,12 +265,13 @@ update_view_line_cb (glLabelObject *object, static GtkWidget * construct_properties_dialog (glViewLine *view_line) { - GtkWidget *dialog, *notebook, *wvbox; + GtkWidget *dialog, *wsection; BonoboWindow *win = glabels_get_active_window (); glLabelObject *object; gdouble line_width; guint line_color; gdouble x, y, w, h, label_width, label_height; + GtkSizeGroup *label_size_group; gl_debug (DEBUG_VIEW, "START"); @@ -286,66 +287,65 @@ construct_properties_dialog (glViewLine *view_line) /*-----------------------------------------------------------------*/ /* Build dialog with notebook. */ /*-----------------------------------------------------------------*/ - dialog = gtk_dialog_new_with_buttons ( _("Edit line object properties"), - GTK_WINDOW (win), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CLOSE, + dialog = gl_hig_dialog_new_with_buttons ( _("Edit line object properties"), + GTK_WINDOW (win), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, - NULL ); + NULL ); + gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (response_cb), view_line); - notebook = gtk_notebook_new (); - gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), - notebook, TRUE, TRUE, 0); + label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); /*---------------------------*/ - /* Appearance Notebook Tab */ + /* Line section */ /*---------------------------*/ - wvbox = gtk_vbox_new (FALSE, GNOME_PAD); - gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, - gtk_label_new (_("Appearance"))); - - /* ------ Line line ------ */ + wsection = gl_hig_category_new (_("Line")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); view_line->private->line = gl_wdgt_line_new (); + gl_wdgt_line_set_label_size_group (GL_WDGT_LINE(view_line->private->line), + label_size_group); gl_wdgt_line_set_params (GL_WDGT_LINE (view_line->private->line), line_width, line_color); - gtk_box_pack_start (GTK_BOX (wvbox), view_line->private->line, - FALSE, FALSE, 0); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_line->private->line); g_signal_connect (G_OBJECT (view_line->private->line), "changed", G_CALLBACK(line_changed_cb), view_line); - - /*----------------------------*/ - /* Position/Size Notebook Tab */ - /*----------------------------*/ - wvbox = gtk_vbox_new (FALSE, GNOME_PAD); - gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, - gtk_label_new (_("Position/Size"))); - - /* ------ Position Frame ------ */ + /*---------------------------*/ + /* Position section */ + /*---------------------------*/ + wsection = gl_hig_category_new (_("Position")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); view_line->private->position = gl_wdgt_position_new (); + gl_wdgt_position_set_label_size_group (GL_WDGT_POSITION(view_line->private->position), + label_size_group); gl_wdgt_position_set_params (GL_WDGT_POSITION (view_line->private->position), x, y, label_width, label_height); - gtk_box_pack_start (GTK_BOX (wvbox), - view_line->private->position, - FALSE, FALSE, 0); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_line->private->position); g_signal_connect (G_OBJECT (view_line->private->position), "changed", G_CALLBACK(position_changed_cb), view_line); - /* ------ Size Frame ------ */ - view_line->private->vector = gl_wdgt_vector_new (_("Size")); + /*---------------------------*/ + /* Size section */ + /*---------------------------*/ + wsection = gl_hig_category_new (_("Size")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); + view_line->private->vector = gl_wdgt_vector_new (); + gl_wdgt_vector_set_label_size_group (GL_WDGT_VECTOR(view_line->private->vector), + label_size_group); gl_wdgt_vector_set_params (GL_WDGT_VECTOR (view_line->private->vector), w, h, label_width, label_height); - gtk_box_pack_start (GTK_BOX (wvbox), view_line->private->vector, - FALSE, FALSE, 0); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_line->private->vector); g_signal_connect (G_OBJECT (view_line->private->vector), "changed", G_CALLBACK(vector_changed_cb), view_line); diff --git a/glabels2/src/view-text.c b/glabels2/src/view-text.c index b72183ad..2d5ba759 100644 --- a/glabels2/src/view-text.c +++ b/glabels2/src/view-text.c @@ -232,7 +232,7 @@ update_view_text_cb (glLabelObject *object, static GtkWidget * construct_properties_dialog (glViewText *view_text) { - GtkWidget *dialog, *notebook, *wvbox, *wbutton; + GtkWidget *dialog, *wsection, *wbutton; BonoboWindow *win = glabels_get_active_window (); glLabelObject *object; gdouble x, y, w, h, label_width, label_height; @@ -261,85 +261,70 @@ construct_properties_dialog (glViewText *view_text) merge = gl_label_get_merge (GL_LABEL(object->parent)); /*-----------------------------------------------------------------*/ - /* Build dialog with notebook. */ + /* Build dialog. */ /*-----------------------------------------------------------------*/ - gl_debug (DEBUG_VIEW, "Creating dialog..."); dialog = gl_hig_dialog_new_with_buttons ( _("Edit text object properties"), GTK_WINDOW (win), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL ); + gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (response_cb), view_text); - notebook = gtk_notebook_new (); - gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), notebook); label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); /*---------------------------*/ - /* Text Notebook Tab */ + /* Text Section */ /*---------------------------*/ - gl_debug (DEBUG_VIEW, "Creating text tab..."); - wvbox = gl_hig_vbox_new (GL_HIG_VBOX_OUTER); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, - gtk_label_new (_("Text"))); - - /* text entry */ - gl_debug (DEBUG_VIEW, "Creating text entry..."); + wsection = gl_hig_category_new (_("Text")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); view_text->private->text_entry = gl_wdgt_text_entry_new (merge->field_defs); + gl_wdgt_text_entry_set_label_size_group (GL_WDGT_TEXT_ENTRY(view_text->private->text_entry), + label_size_group); gl_wdgt_text_entry_set_text (GL_WDGT_TEXT_ENTRY(view_text->private->text_entry), (merge->type != GL_MERGE_NONE), lines); - gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), - view_text->private->text_entry); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_text->private->text_entry); g_signal_connect ( G_OBJECT(view_text->private->text_entry), "changed", G_CALLBACK (text_entry_changed_cb), view_text); /*---------------------------*/ - /* Text Props Notebook Tab */ + /* Text Properties section */ /*---------------------------*/ - gl_debug (DEBUG_VIEW, "Creating props tab..."); - wvbox = gl_hig_vbox_new (GL_HIG_VBOX_OUTER); - gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, - gtk_label_new (_("Appearance"))); - - /* text props entry */ - gl_debug (DEBUG_VIEW, "Creating props entry..."); + wsection = gl_hig_category_new (_("Properties")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); view_text->private->text_props = gl_wdgt_text_props_new (); gl_wdgt_text_props_set_label_size_group (GL_WDGT_TEXT_PROPS(view_text->private->text_props), label_size_group); gl_wdgt_text_props_set_params (GL_WDGT_TEXT_PROPS(view_text->private->text_props), font_family, font_size, font_weight, font_italic_flag, color, just); - gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), - view_text->private->text_props); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_text->private->text_props); g_signal_connect ( G_OBJECT(view_text->private->text_props), "changed", G_CALLBACK (text_props_changed_cb), view_text); /*----------------------------*/ - /* Position/Size Notebook Tab */ + /* Position section */ /*----------------------------*/ - gl_debug (DEBUG_VIEW, "Creating position tab..."); - wvbox = gl_hig_vbox_new (GL_HIG_VBOX_OUTER); - gtk_container_set_border_width (GTK_CONTAINER (wvbox), 10); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), wvbox, - gtk_label_new (_("Position"))); - - /* ------ Position Frame ------ */ - gl_debug (DEBUG_VIEW, "Creating position entry..."); + wsection = gl_hig_category_new (_("Position")); + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection); view_text->private->position = gl_wdgt_position_new (); + gl_wdgt_position_set_label_size_group (GL_WDGT_POSITION(view_text->private->position), + label_size_group); gl_wdgt_position_set_params (GL_WDGT_POSITION (view_text->private->position), x, y, label_width, label_height); - gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), - view_text->private->position); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), + view_text->private->position); g_signal_connect (G_OBJECT (view_text->private->position), "changed", G_CALLBACK(position_changed_cb), view_text); diff --git a/glabels2/src/wdgt-position.c b/glabels2/src/wdgt-position.c index 179ca559..a010a143 100644 --- a/glabels2/src/wdgt-position.c +++ b/glabels2/src/wdgt-position.c @@ -114,8 +114,13 @@ gl_wdgt_position_class_init (glWdgtPositionClass * class) static void gl_wdgt_position_instance_init (glWdgtPosition * position) { - position->x_spin = NULL; - position->y_spin = NULL; + position->x_label = NULL; + position->x_spin = NULL; + + position->y_label = NULL; + position->y_spin = NULL; + + position->units_label = NULL; } static void diff --git a/glabels2/src/wdgt-size.c b/glabels2/src/wdgt-size.c index 50352e02..5e7f291d 100644 --- a/glabels2/src/wdgt-size.c +++ b/glabels2/src/wdgt-size.c @@ -43,7 +43,7 @@ typedef void (*glWdgtSizeSignal) (GObject * object, gpointer data); /* Private globals */ /*===========================================*/ -static GObjectClass *parent_class; +static glHigVBoxClass *parent_class; static gint wdgt_size_signals[LAST_SIGNAL] = { 0 }; @@ -51,19 +51,22 @@ static gint wdgt_size_signals[LAST_SIGNAL] = { 0 }; /* Local function prototypes */ /*===========================================*/ -static void gl_wdgt_size_class_init (glWdgtSizeClass * class); -static void gl_wdgt_size_instance_init (glWdgtSize * size); -static void gl_wdgt_size_finalize (GObject * object); -static void gl_wdgt_size_construct (glWdgtSize * size, gchar * label); +static void gl_wdgt_size_class_init (glWdgtSizeClass *class); +static void gl_wdgt_size_instance_init (glWdgtSize *size); +static void gl_wdgt_size_finalize (GObject *object); +static void gl_wdgt_size_construct (glWdgtSize *size); -static void aspect_toggle_cb (GtkToggleButton * togglebutton, - gpointer user_data); -static void w_spin_cb (GtkSpinButton * spinbutton, gpointer user_data); -static void h_spin_cb (GtkSpinButton * spinbutton, gpointer user_data); +static void aspect_toggle_cb (GtkToggleButton *togglebutton, + gpointer user_data); + +static void w_spin_cb (GtkSpinButton *spinbutton, + gpointer user_data); +static void h_spin_cb (GtkSpinButton *spinbutton, + gpointer user_data); -/*================================================================*/ -/* Boilerplate Object stuff. */ -/*================================================================*/ +/***************************************************************************/ +/* Boilerplate Object stuff. */ +/***************************************************************************/ guint gl_wdgt_size_get_type (void) { @@ -83,21 +86,22 @@ gl_wdgt_size_get_type (void) }; wdgt_size_type = - g_type_register_static (gtk_vbox_get_type (), - "glWdgtSize", &wdgt_size_info, 0); + g_type_register_static (gl_hig_vbox_get_type (), + "glWdgtSize", + &wdgt_size_info, 0); } return wdgt_size_type; } static void -gl_wdgt_size_class_init (glWdgtSizeClass * class) +gl_wdgt_size_class_init (glWdgtSizeClass *class) { GObjectClass *object_class; object_class = (GObjectClass *) class; - parent_class = gtk_type_class (gtk_vbox_get_type ()); + parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_wdgt_size_finalize; @@ -113,11 +117,13 @@ gl_wdgt_size_class_init (glWdgtSizeClass * class) } static void -gl_wdgt_size_instance_init (glWdgtSize * size) +gl_wdgt_size_instance_init (glWdgtSize *size) { size->aspect_ratio = 1.0; + size->w_label = NULL; size->w_spin = NULL; + size->h_label = NULL; size->h_spin = NULL; size->units_label = NULL; @@ -126,7 +132,7 @@ gl_wdgt_size_instance_init (glWdgtSize * size) } static void -gl_wdgt_size_finalize (GObject * object) +gl_wdgt_size_finalize (GObject *object) { glWdgtSize *size; glWdgtSizeClass *class; @@ -139,26 +145,28 @@ gl_wdgt_size_finalize (GObject * object) G_OBJECT_CLASS (parent_class)->finalize (object); } +/***************************************************************************/ +/* New widget. */ +/***************************************************************************/ GtkWidget * -gl_wdgt_size_new (gchar * label) +gl_wdgt_size_new (void) { glWdgtSize *size; size = g_object_new (gl_wdgt_size_get_type (), NULL); - gl_wdgt_size_construct (size, label); + gl_wdgt_size_construct (size); return GTK_WIDGET (size); } - -/*============================================================*/ -/* Construct composite widget. */ -/*============================================================*/ + +/*-------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*-------------------------------------------------------------------------*/ static void -gl_wdgt_size_construct (glWdgtSize * size, - gchar * label) +gl_wdgt_size_construct (glWdgtSize *size) { - GtkWidget *wvbox, *wframe, *wtable, *wlabel; + GtkWidget *wvbox, *whbox; GtkObject *w_adjust, *h_adjust; const gchar *units_string; gdouble units_per_point, climb_rate; @@ -171,20 +179,15 @@ gl_wdgt_size_construct (glWdgtSize * size, wvbox = GTK_WIDGET (size); - wframe = gtk_frame_new (label); - gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); - - wtable = gtk_table_new (3, 3, TRUE); - gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); - gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); - gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); - gtk_container_add (GTK_CONTAINER (wframe), wtable); + /* ---- W line ---- */ + whbox = gl_hig_hbox_new (); + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox); /* W Label */ - wlabel = gtk_label_new (_("Width:")); - gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); - gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); - gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + size->w_label = gtk_label_new (_("Width:")); + gtk_misc_set_alignment (GTK_MISC (size->w_label), 0, 0.5); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), size->w_label); + /* W spin */ w_adjust = gtk_adjustment_new (climb_rate, climb_rate, 100.0, climb_rate, 10.0, 10.0); @@ -193,14 +196,17 @@ gl_wdgt_size_construct (glWdgtSize * size, gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (size->w_spin), TRUE); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (size->w_spin), TRUE); - gtk_table_attach_defaults (GTK_TABLE (wtable), size->w_spin, - 1, 2, 0, 1); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), size->w_spin); + + /* ---- H line ---- */ + whbox = gl_hig_hbox_new (); + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox); /* H label */ - wlabel = gtk_label_new (_("Height:")); - gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); - gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); - gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + size->h_label = gtk_label_new (_("Height:")); + gtk_misc_set_alignment (GTK_MISC (size->h_label), 0, 0.5); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), size->h_label); + /* H spin */ h_adjust = gtk_adjustment_new (climb_rate, climb_rate, 100.0, climb_rate, 10.0, 10.0); @@ -209,21 +215,18 @@ gl_wdgt_size_construct (glWdgtSize * size, gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (size->h_spin), TRUE); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (size->h_spin), TRUE); - gtk_table_attach_defaults (GTK_TABLE (wtable), size->h_spin, - 1, 2, 1, 2); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), size->h_spin); /* Units */ size->units_label = gtk_label_new (units_string); gtk_misc_set_alignment (GTK_MISC (size->units_label), 0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (wtable), - size->units_label, 2, 3, 1, 2); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), size->units_label); /* Maintain aspect ratio checkbox */ size->aspect_checkbox = gtk_check_button_new_with_label (_ ("Maintain current aspect ratio")); - gtk_table_attach_defaults (GTK_TABLE (wtable), size->aspect_checkbox, 0, - 3, 2, 3); + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), size->aspect_checkbox); /* Connect signals to controls */ g_signal_connect (G_OBJECT (size->aspect_checkbox), "toggled", @@ -233,13 +236,13 @@ gl_wdgt_size_construct (glWdgtSize * size, g_signal_connect (G_OBJECT (size->h_spin), "changed", G_CALLBACK (h_spin_cb), size); } - + /*--------------------------------------------------------------------------*/ /* PRIVATE. Maintain aspect ratio checkbox callback. */ /*--------------------------------------------------------------------------*/ static void -aspect_toggle_cb (GtkToggleButton * togglebutton, - gpointer user_data) +aspect_toggle_cb (GtkToggleButton *togglebutton, + gpointer user_data) { glWdgtSize *size = GL_WDGT_SIZE (user_data); GtkAdjustment *w_adjust, *h_adjust; @@ -295,13 +298,13 @@ aspect_toggle_cb (GtkToggleButton * togglebutton, g_signal_emit (G_OBJECT (size), wdgt_size_signals[CHANGED], 0); } - + /*--------------------------------------------------------------------------*/ /* PRIVATE. W spin button changed callback. */ /*--------------------------------------------------------------------------*/ static void -w_spin_cb (GtkSpinButton * spinbutton, - gpointer user_data) +w_spin_cb (GtkSpinButton *spinbutton, + gpointer user_data) { glWdgtSize *size = GL_WDGT_SIZE (user_data); GtkToggleButton *toggle = GTK_TOGGLE_BUTTON (size->aspect_checkbox); @@ -333,8 +336,8 @@ w_spin_cb (GtkSpinButton * spinbutton, /* PRIVATE. H spin button changed callback. */ /*--------------------------------------------------------------------------*/ static void -h_spin_cb (GtkSpinButton * spinbutton, - gpointer user_data) +h_spin_cb (GtkSpinButton *spinbutton, + gpointer user_data) { glWdgtSize *size = GL_WDGT_SIZE (user_data); GtkToggleButton *toggle = GTK_TOGGLE_BUTTON (size->aspect_checkbox); @@ -361,15 +364,15 @@ h_spin_cb (GtkSpinButton * spinbutton, g_signal_emit (G_OBJECT (size), wdgt_size_signals[CHANGED], 0); } - -/*====================================================================*/ -/* query values from controls. */ -/*====================================================================*/ + +/***************************************************************************/ +/* query values from controls. */ +/***************************************************************************/ void -gl_wdgt_size_get_size (glWdgtSize * size, - gdouble * w, - gdouble * h, - gboolean * keep_aspect_ratio_flag) +gl_wdgt_size_get_size (glWdgtSize *size, + gdouble *w, + gdouble *h, + gboolean *keep_aspect_ratio_flag) { gdouble units_per_point; @@ -387,16 +390,16 @@ gl_wdgt_size_get_size (glWdgtSize * size, *h /= units_per_point; } -/*====================================================================*/ -/* set values and ranges for controls. */ -/*====================================================================*/ +/***************************************************************************/ +/* set values and ranges for controls. */ +/***************************************************************************/ void -gl_wdgt_size_set_params (glWdgtSize * size, - gdouble w, - gdouble h, - gboolean keep_aspect_ratio_flag, - gdouble w_max, - gdouble h_max) +gl_wdgt_size_set_params (glWdgtSize *size, + gdouble w, + gdouble h, + gboolean keep_aspect_ratio_flag, + gdouble w_max, + gdouble h_max) { GtkObject *w_adjust, *h_adjust; const gchar *units_string; @@ -456,13 +459,13 @@ gl_wdgt_size_set_params (glWdgtSize * size, } -/*====================================================================*/ -/* set size only. */ -/*====================================================================*/ +/***************************************************************************/ +/* set size only. */ +/***************************************************************************/ void -gl_wdgt_size_set_size (glWdgtSize * size, - gdouble w, - gdouble h) +gl_wdgt_size_set_size (glWdgtSize *size, + gdouble w, + gdouble h) { gdouble units_per_point; @@ -491,3 +494,14 @@ gl_wdgt_size_set_size (glWdgtSize * size, G_CALLBACK (h_spin_cb), size); } + +/****************************************************************************/ +/* Set size group for internal labels */ +/****************************************************************************/ +void +gl_wdgt_size_set_label_size_group (glWdgtSize *size, + GtkSizeGroup *label_size_group) +{ + gtk_size_group_add_widget (label_size_group, size->w_label); + gtk_size_group_add_widget (label_size_group, size->h_label); +} diff --git a/glabels2/src/wdgt-size.h b/glabels2/src/wdgt-size.h index 3e53e550..3b3723d2 100644 --- a/glabels2/src/wdgt-size.h +++ b/glabels2/src/wdgt-size.h @@ -25,6 +25,9 @@ #include #include "label.h" +#include "hig.h" + +G_BEGIN_DECLS #define GL_TYPE_WDGT_SIZE (gl_wdgt_size_get_type ()) #define GL_WDGT_SIZE(obj) \ @@ -40,39 +43,53 @@ typedef struct _glWdgtSize glWdgtSize; typedef struct _glWdgtSizeClass glWdgtSizeClass; struct _glWdgtSize { - GtkVBox parent_widget; + glHigVBox parent_widget; - gdouble w, h; - gdouble aspect_ratio; - gdouble w_max, h_max; - gdouble w_max_orig, h_max_orig; + gdouble w, h; + gdouble aspect_ratio; + gdouble w_max, h_max; + gdouble w_max_orig, h_max_orig; + GtkWidget *w_label; GtkWidget *w_spin; + + GtkWidget *h_label; GtkWidget *h_spin; GtkWidget *units_label; + GtkWidget *aspect_checkbox; }; struct _glWdgtSizeClass { - GtkVBoxClass parent_class; + glHigVBoxClass parent_class; void (*changed) (glWdgtSize * size, gpointer user_data); }; -extern guint gl_wdgt_size_get_type (void); +guint gl_wdgt_size_get_type (void); + +GtkWidget *gl_wdgt_size_new (void); + +void gl_wdgt_size_get_size (glWdgtSize *size, + gdouble *w, + gdouble *h, + gboolean *keep_aspect_ratio_flag); + +void gl_wdgt_size_set_params (glWdgtSize *size, + gdouble w, + gdouble h, + gboolean keep_aspect_ratio_flag, + gdouble w_max, + gdouble h_max); -extern GtkWidget *gl_wdgt_size_new (gchar * label); +void gl_wdgt_size_set_size (glWdgtSize *size, + gdouble w, + gdouble h); -extern void gl_wdgt_size_get_size (glWdgtSize * size, - gdouble * w, gdouble * h, - gboolean * keep_aspect_ratio_flag); +void gl_wdgt_size_set_label_size_group (glWdgtSize *size, + GtkSizeGroup *label_size_group); -extern void gl_wdgt_size_set_params (glWdgtSize * size, - gdouble w, gdouble h, - gboolean keep_aspect_ratio_flag, - gdouble w_max, gdouble h_max); -extern void gl_wdgt_size_set_size (glWdgtSize * size, - gdouble w, gdouble h); +G_END_DECLS #endif diff --git a/glabels2/src/wdgt-text-entry.c b/glabels2/src/wdgt-text-entry.c index cd915f10..679f1503 100644 --- a/glabels2/src/wdgt-text-entry.c +++ b/glabels2/src/wdgt-text-entry.c @@ -171,17 +171,21 @@ static void gl_wdgt_text_entry_construct (glWdgtTextEntry *text_entry, GList *field_defs) { - GtkWidget *wvbox, *whbox, *wlabel, *wscroll, *wcombo; + GtkWidget *wvbox, *whbox, *wscroll, *wcombo; GList *keys; gl_debug (DEBUG_WDGT, "START"); wvbox = GTK_WIDGET (text_entry); + /* ---- Entry line ---- */ + whbox = gl_hig_hbox_new (); + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox); + /* Text Label */ - wlabel = gtk_label_new (_("Edit text:")); - gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); - gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), wlabel); + text_entry->edit_label = gtk_label_new (_("Edit text:")); + gtk_misc_set_alignment (GTK_MISC (text_entry->edit_label), 0, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text_entry->edit_label); /* Actual text entry widget */ wscroll = gtk_scrolled_window_new (NULL, NULL); @@ -189,7 +193,7 @@ gl_wdgt_text_entry_construct (glWdgtTextEntry *text_entry, gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wscroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), wscroll); + gl_hig_hbox_add_widget_justify (GL_HIG_HBOX(whbox), wscroll); text_entry->text_entry = gtk_text_view_new (); text_entry->text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_entry->text_entry)); @@ -204,8 +208,9 @@ gl_wdgt_text_entry_construct (glWdgtTextEntry *text_entry, gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox); /* Insert merge field label */ - wlabel = gtk_label_new (_("Key:")); - gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), wlabel); + text_entry->key_label = gtk_label_new (_("Key:")); + gtk_misc_set_alignment (GTK_MISC (text_entry->key_label), 0, 0.5); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text_entry->key_label); /* Key entry widget */ wcombo = gtk_combo_new (); @@ -233,7 +238,7 @@ gl_wdgt_text_entry_construct (glWdgtTextEntry *text_entry, /* PRIVATE. Callback for when text has changed. */ /*--------------------------------------------------------------------------*/ static void -changed_cb (glWdgtTextEntry * text_entry) +changed_cb (glWdgtTextEntry *text_entry) { gl_debug (DEBUG_WDGT, "START"); @@ -248,7 +253,7 @@ changed_cb (glWdgtTextEntry * text_entry) /* PRIVATE. Callback to insert field into text buffer. */ /*--------------------------------------------------------------------------*/ static void -insert_cb (glWdgtTextEntry * text_entry) +insert_cb (glWdgtTextEntry *text_entry) { GtkTextBuffer *buffer; gchar *key, *field; @@ -274,7 +279,7 @@ insert_cb (glWdgtTextEntry * text_entry) /* Get widget data. */ /****************************************************************************/ GList * -gl_wdgt_text_entry_get_text (glWdgtTextEntry * text_entry) +gl_wdgt_text_entry_get_text (glWdgtTextEntry *text_entry) { GtkTextBuffer *buffer; gchar *text; @@ -302,9 +307,9 @@ gl_wdgt_text_entry_get_text (glWdgtTextEntry * text_entry) /* Set widget data. */ /****************************************************************************/ void -gl_wdgt_text_entry_set_text (glWdgtTextEntry * text_entry, - gboolean merge_flag, - GList * lines) +gl_wdgt_text_entry_set_text (glWdgtTextEntry *text_entry, + gboolean merge_flag, + GList *lines) { GtkTextBuffer *buffer; gchar *text; @@ -324,3 +329,15 @@ gl_wdgt_text_entry_set_text (glWdgtTextEntry * text_entry, gl_debug (DEBUG_WDGT, "END"); } + +/*****************************************************************************/ +/* Set size group for internal labels */ +/*****************************************************************************/ +void +gl_wdgt_text_entry_set_label_size_group (glWdgtTextEntry *text_entry, + GtkSizeGroup *label_size_group) +{ + gtk_size_group_add_widget (label_size_group, text_entry->edit_label); + gtk_size_group_add_widget (label_size_group, text_entry->key_label); +} + diff --git a/glabels2/src/wdgt-text-entry.h b/glabels2/src/wdgt-text-entry.h index a5bbe67d..5be2242a 100644 --- a/glabels2/src/wdgt-text-entry.h +++ b/glabels2/src/wdgt-text-entry.h @@ -45,7 +45,10 @@ typedef struct _glWdgtTextEntryClass glWdgtTextEntryClass; struct _glWdgtTextEntry { glHigVBox parent_widget; + GtkWidget *edit_label; GtkWidget *text_entry; + + GtkWidget *key_label; GtkWidget *key_entry; GtkWidget *insert_button; @@ -68,6 +71,9 @@ void gl_wdgt_text_entry_set_text (glWdgtTextEntry *text_entry, gboolean merge_flag, GList *lines); +void gl_wdgt_text_entry_set_label_size_group (glWdgtTextEntry *text_entry, + GtkSizeGroup *label_size_group); + G_END_DECLS #endif diff --git a/glabels2/src/wdgt-vector.c b/glabels2/src/wdgt-vector.c index c8f81c14..b67919d2 100644 --- a/glabels2/src/wdgt-vector.c +++ b/glabels2/src/wdgt-vector.c @@ -54,23 +54,24 @@ typedef void (*glWdgtVectorSignal) (GObject * object, gpointer data); /* Private globals */ /*===========================================*/ -static GtkContainerClass *parent_class; +static glHigVBoxClass *parent_class; static gint wdgt_vector_signals[LAST_SIGNAL] = { 0 }; - + /*===========================================*/ /* Local function prototypes */ /*===========================================*/ -static void gl_wdgt_vector_class_init (glWdgtVectorClass * class); -static void gl_wdgt_vector_instance_init (glWdgtVector * vector); -static void gl_wdgt_vector_finalize (GObject * object); -static void gl_wdgt_vector_construct (glWdgtVector * vector, gchar * label); -static void changed_cb (glWdgtVector * vector); - -/*================================================================*/ -/* Boilerplate Object stuff. */ -/*================================================================*/ +static void gl_wdgt_vector_class_init (glWdgtVectorClass *class); +static void gl_wdgt_vector_instance_init (glWdgtVector *vector); +static void gl_wdgt_vector_finalize (GObject *object); +static void gl_wdgt_vector_construct (glWdgtVector *vector); + +static void changed_cb (glWdgtVector *vector); + +/****************************************************************************/ +/* Boilerplate Object stuff. */ +/****************************************************************************/ guint gl_wdgt_vector_get_type (void) { @@ -90,7 +91,7 @@ gl_wdgt_vector_get_type (void) }; wdgt_vector_type = - g_type_register_static (gtk_vbox_get_type (), + g_type_register_static (gl_hig_vbox_get_type (), "glWdgtVector", &wdgt_vector_info, 0); } @@ -99,13 +100,13 @@ gl_wdgt_vector_get_type (void) } static void -gl_wdgt_vector_class_init (glWdgtVectorClass * class) +gl_wdgt_vector_class_init (glWdgtVectorClass *class) { GObjectClass *object_class; object_class = (GObjectClass *) class; - parent_class = gtk_type_class (gtk_vbox_get_type ()); + parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_wdgt_vector_finalize; @@ -121,14 +122,19 @@ gl_wdgt_vector_class_init (glWdgtVectorClass * class) } static void -gl_wdgt_vector_instance_init (glWdgtVector * vector) +gl_wdgt_vector_instance_init (glWdgtVector *vector) { - vector->len_spin = NULL; - vector->angle_spin = NULL; + vector->len_label = NULL; + vector->len_spin = NULL; + vector->len_units_label = NULL; + + vector->angle_label = NULL; + vector->angle_spin = NULL; + vector->angle_units_label = NULL; } static void -gl_wdgt_vector_finalize (GObject * object) +gl_wdgt_vector_finalize (GObject *object) { glWdgtVector *vector; glWdgtVectorClass *class; @@ -141,26 +147,28 @@ gl_wdgt_vector_finalize (GObject * object) G_OBJECT_CLASS (parent_class)->finalize (object); } +/****************************************************************************/ +/* New widget. */ +/****************************************************************************/ GtkWidget * -gl_wdgt_vector_new (gchar * label) +gl_wdgt_vector_new (void) { glWdgtVector *vector; vector = g_object_new (gl_wdgt_vector_get_type (), NULL); - gl_wdgt_vector_construct (vector, label); + gl_wdgt_vector_construct (vector); return GTK_WIDGET (vector); } - -/*============================================================*/ -/* Construct composite widget. */ -/*============================================================*/ + +/*-------------------------------------------------------------------------*/ +/* PRIVATE. Construct composite widget. */ +/*-------------------------------------------------------------------------*/ static void -gl_wdgt_vector_construct (glWdgtVector * vector, - gchar * label) +gl_wdgt_vector_construct (glWdgtVector *vector) { - GtkWidget *wvbox, *wframe, *wtable, *wlabel; + GtkWidget *wvbox, *whbox; GtkObject *adjust; const gchar *units_string; gdouble units_per_point, climb_rate; @@ -173,20 +181,15 @@ gl_wdgt_vector_construct (glWdgtVector * vector, wvbox = GTK_WIDGET (vector); - wframe = gtk_frame_new (label); - gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); - - wtable = gtk_table_new (2, 3, TRUE); - gtk_container_set_border_width (GTK_CONTAINER (wtable), 10); - gtk_table_set_row_spacings (GTK_TABLE (wtable), 5); - gtk_table_set_col_spacings (GTK_TABLE (wtable), 5); - gtk_container_add (GTK_CONTAINER (wframe), wtable); + /* ---- Length line ---- */ + whbox = gl_hig_hbox_new (); + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox); /* Length label */ - wlabel = gtk_label_new (_("Length:")); - gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); - gtk_label_set_justify (GTK_LABEL (wlabel), GTK_JUSTIFY_RIGHT); - gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 0, 1); + vector->len_label = gtk_label_new (_("Length:")); + gtk_misc_set_alignment (GTK_MISC (vector->len_label), 0, 0.5); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), vector->len_label); + /* Length spin */ adjust = gtk_adjustment_new (climb_rate, climb_rate, 100.0, climb_rate, 10.0, 10.0); @@ -198,18 +201,22 @@ gl_wdgt_vector_construct (glWdgtVector * vector, g_signal_connect_swapped (G_OBJECT (vector->len_spin), "changed", G_CALLBACK (changed_cb), G_OBJECT (vector)); - gtk_table_attach_defaults (GTK_TABLE (wtable), vector->len_spin, 1, 2, - 0, 1); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), vector->len_spin); + /* Length units label */ vector->len_units_label = gtk_label_new (units_string); gtk_misc_set_alignment (GTK_MISC (vector->len_units_label), 0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (wtable), vector->len_units_label, - 2, 3, 0, 1); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), vector->len_units_label); + + /* ---- Angle line ---- */ + whbox = gl_hig_hbox_new (); + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox); /* Angle label */ - wlabel = gtk_label_new (_("Angle:")); - gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (wtable), wlabel, 0, 1, 1, 2); + vector->angle_label = gtk_label_new (_("Angle:")); + gtk_misc_set_alignment (GTK_MISC (vector->angle_label), 0, 0.5); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), vector->angle_label); + /* Angle spin */ adjust = gtk_adjustment_new (0.0, -180.0, +180.0, 1.0, 10.0, 10.0); vector->angle_spin = @@ -221,14 +228,12 @@ gl_wdgt_vector_construct (glWdgtVector * vector, g_signal_connect_swapped (G_OBJECT (vector->angle_spin), "changed", G_CALLBACK (changed_cb), G_OBJECT (vector)); - gtk_table_attach_defaults (GTK_TABLE (wtable), vector->angle_spin, 1, 2, - 1, 2); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), vector->angle_spin); + /* Angle units label */ vector->angle_units_label = gtk_label_new (_("degrees")); gtk_misc_set_alignment (GTK_MISC (vector->angle_units_label), 0, 0.5); - gtk_table_attach_defaults (GTK_TABLE (wtable), - vector->angle_units_label, 2, 3, 1, 2); - + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), vector->angle_units_label); } /*--------------------------------------------------------------------------*/ @@ -240,14 +245,14 @@ changed_cb (glWdgtVector * vector) /* Emit our "changed" signal */ g_signal_emit (G_OBJECT (vector), wdgt_vector_signals[CHANGED], 0); } - -/*====================================================================*/ -/* query values from controls. */ -/*====================================================================*/ + +/****************************************************************************/ +/* query values from controls. */ +/****************************************************************************/ void -gl_wdgt_vector_get_params (glWdgtVector * vector, - gdouble * dx, - gdouble * dy) +gl_wdgt_vector_get_params (glWdgtVector *vector, + gdouble *dx, + gdouble *dy) { gdouble length, angle; gdouble units_per_point; @@ -265,15 +270,15 @@ gl_wdgt_vector_get_params (glWdgtVector * vector, *dy = COMP_Y (length, angle); } -/*====================================================================*/ -/* set values and ranges for controls. */ -/*====================================================================*/ +/****************************************************************************/ +/* set values and ranges for controls. */ +/****************************************************************************/ void -gl_wdgt_vector_set_params (glWdgtVector * vector, - gdouble dx, - gdouble dy, - gdouble x_max, - gdouble y_max) +gl_wdgt_vector_set_params (glWdgtVector *vector, + gdouble dx, + gdouble dy, + gdouble x_max, + gdouble y_max) { GtkObject *length_adjust; gdouble length, angle; @@ -304,3 +309,14 @@ gl_wdgt_vector_set_params (glWdgtVector * vector, gtk_spin_button_set_value (GTK_SPIN_BUTTON (vector->angle_spin), angle); } + +/****************************************************************************/ +/* Set size group for internal labels */ +/****************************************************************************/ +void +gl_wdgt_vector_set_label_size_group (glWdgtVector *vector, + GtkSizeGroup *label_size_group) +{ + gtk_size_group_add_widget (label_size_group, vector->len_label); + gtk_size_group_add_widget (label_size_group, vector->angle_label); +} diff --git a/glabels2/src/wdgt-vector.h b/glabels2/src/wdgt-vector.h index b3d57ad9..1e99f22a 100644 --- a/glabels2/src/wdgt-vector.h +++ b/glabels2/src/wdgt-vector.h @@ -25,6 +25,9 @@ #include #include "label.h" +#include "hig.h" + +G_BEGIN_DECLS #define GL_TYPE_WDGT_VECTOR (gl_wdgt_vector_get_type ()) #define GL_WDGT_VECTOR(obj) \ @@ -40,29 +43,40 @@ typedef struct _glWdgtVector glWdgtVector; typedef struct _glWdgtVectorClass glWdgtVectorClass; struct _glWdgtVector { - GtkVBox parent_widget; + glHigVBox parent_widget; + GtkWidget *len_label; GtkWidget *len_spin; GtkWidget *len_units_label; + + GtkWidget *angle_label; GtkWidget *angle_spin; GtkWidget *angle_units_label; }; struct _glWdgtVectorClass { - GtkVBoxClass parent_class; + glHigVBoxClass parent_class; void (*changed) (glWdgtVector * vector, gpointer user_data); }; -extern guint gl_wdgt_vector_get_type (void); +guint gl_wdgt_vector_get_type (void); + +GtkWidget *gl_wdgt_vector_new (void); + +void gl_wdgt_vector_get_params (glWdgtVector *vector, + gdouble *dx, + gdouble *dy); -extern GtkWidget *gl_wdgt_vector_new (gchar * label); +void gl_wdgt_vector_set_params (glWdgtVector *vector, + gdouble dx, + gdouble dy, + gdouble x_max, + gdouble y_max); -extern void gl_wdgt_vector_get_params (glWdgtVector * vector, - gdouble * dx, gdouble * dy); +void gl_wdgt_vector_set_label_size_group (glWdgtVector *vector, + GtkSizeGroup *label_size_group); -extern void gl_wdgt_vector_set_params (glWdgtVector * vector, - gdouble dx, gdouble dy, - gdouble x_max, gdouble y_max); +G_END_DECLS #endif