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");
G_CALLBACK (src_changed_cb), data);
gl_merge_free (&merge);
+
+ gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
}
/*--------------------------------------------------------------------------*/
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");
/*-----------------------------------------------------------------*/
/* 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);
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");
/*-----------------------------------------------------------------*/
/* 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);
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");
/*-----------------------------------------------------------------*/
/* 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
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),
/*----------------------------*/
- /* 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);
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");
/*-----------------------------------------------------------------*/
/* 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);
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;
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);
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
/* Private globals */
/*===========================================*/
-static GObjectClass *parent_class;
+static glHigVBoxClass *parent_class;
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);
\f
-/*================================================================*/
-/* Boilerplate Object stuff. */
-/*================================================================*/
+/***************************************************************************/
+/* Boilerplate Object stuff. */
+/***************************************************************************/
guint
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;
}
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;
}
static void
-gl_wdgt_size_finalize (GObject * object)
+gl_wdgt_size_finalize (GObject *object)
{
glWdgtSize *size;
glWdgtSizeClass *class;
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);
}
-\f
-/*============================================================*/
-/* 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;
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);
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);
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",
g_signal_connect (G_OBJECT (size->h_spin), "changed",
G_CALLBACK (h_spin_cb), size);
}
-\f
+
/*--------------------------------------------------------------------------*/
/* 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;
g_signal_emit (G_OBJECT (size), wdgt_size_signals[CHANGED], 0);
}
-\f
+
/*--------------------------------------------------------------------------*/
/* 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);
/* 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);
g_signal_emit (G_OBJECT (size), wdgt_size_signals[CHANGED], 0);
}
-\f
-/*====================================================================*/
-/* 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;
*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;
}
-/*====================================================================*/
-/* 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;
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);
+}
#include <gnome.h>
#include "label.h"
+#include "hig.h"
+
+G_BEGIN_DECLS
#define GL_TYPE_WDGT_SIZE (gl_wdgt_size_get_type ())
#define GL_WDGT_SIZE(obj) \
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
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);
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));
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 ();
/* PRIVATE. Callback for when text has changed. */
/*--------------------------------------------------------------------------*/
static void
-changed_cb (glWdgtTextEntry * text_entry)
+changed_cb (glWdgtTextEntry *text_entry)
{
gl_debug (DEBUG_WDGT, "START");
/* 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;
/* 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;
/* 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;
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);
+}
+
struct _glWdgtTextEntry {
glHigVBox parent_widget;
+ GtkWidget *edit_label;
GtkWidget *text_entry;
+
+ GtkWidget *key_label;
GtkWidget *key_entry;
GtkWidget *insert_button;
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
/* Private globals */
/*===========================================*/
-static GtkContainerClass *parent_class;
+static glHigVBoxClass *parent_class;
static gint wdgt_vector_signals[LAST_SIGNAL] = { 0 };
-\f
+
/*===========================================*/
/* 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);
-\f
-/*================================================================*/
-/* 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)
{
};
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);
}
}
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;
}
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;
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);
}
-\f
-/*============================================================*/
-/* 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;
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);
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 =
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);
}
/*--------------------------------------------------------------------------*/
/* Emit our "changed" signal */
g_signal_emit (G_OBJECT (vector), wdgt_vector_signals[CHANGED], 0);
}
-\f
-/*====================================================================*/
-/* 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;
*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;
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);
+}
#include <gnome.h>
#include "label.h"
+#include "hig.h"
+
+G_BEGIN_DECLS
#define GL_TYPE_WDGT_VECTOR (gl_wdgt_vector_get_type ())
#define GL_WDGT_VECTOR(obj) \
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