Skip to content

Commit

Permalink
gschem: Use configuration settings for default text size in text add …
Browse files Browse the repository at this point in the history
…dialog (lepton-eda#111)
  • Loading branch information
graahnul-grom authored and vzh committed Mar 31, 2017
1 parent 0c8fdc6 commit 16096ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gschem/src/g_rc.c
Expand Up @@ -235,11 +235,11 @@ SCM g_rc_text_size(SCM size)
SCM_ASSERT (scm_is_integer (size), size, SCM_ARG1, "text-size");

val = scm_to_int (size);
if (val == 0) {
if (val < MINIMUM_TEXT_SIZE) {
fprintf(stderr,
_("Invalid size [%1$d] passed to text-size\n"),
val);
val = 10; /* absolute default */
val = DEFAULT_TEXT_SIZE; /* absolute default */
}

default_text_size = val;
Expand Down
14 changes: 12 additions & 2 deletions gschem/src/x_newtext.c
Expand Up @@ -72,10 +72,17 @@ struct _NewText {
static void
dialog_response_apply (NewText *dialog)
{
g_return_if_fail (dialog != NULL);

GschemToplevel *w_current = NULL;
g_object_get (GSCHEM_DIALOG (dialog), "gschem-toplevel", &w_current, NULL);
g_return_if_fail (w_current != NULL);

int size = w_current->text_size;

int align = LOWER_LEFT;
int color = TEXT_COLOR;
int rotate = 0;
int size = 12;
gchar *string = NULL;
gchar *tmp = NULL;
GtkTextBuffer *textbuffer;
Expand Down Expand Up @@ -292,7 +299,7 @@ static void newtext_init(NewText *dialog)
0);

dialog->textsizecb = gschem_integer_combo_box_new();
gschem_integer_combo_box_set_value(dialog->textsizecb, 12);

gtk_table_attach_defaults(GTK_TABLE(table), dialog->textsizecb, 1,2,1,2);

label = gtk_label_new (_("Alignment:"));
Expand Down Expand Up @@ -432,6 +439,9 @@ text_input_dialog (GschemToplevel *w_current)
gschem_integer_combo_box_set_model (NEWTEXT (w_current->tiwindow)->textsizecb,
gschem_toplevel_get_text_size_list_store (w_current));

gschem_integer_combo_box_set_value (NEWTEXT (w_current->tiwindow)->textsizecb,
w_current->text_size);

gtk_widget_show_all (w_current->tiwindow);
}
else {
Expand Down

0 comments on commit 16096ee

Please sign in to comment.