aboutsummaryrefslogtreecommitdiff
path: root/src/sc_editor.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2015-10-27 23:03:16 +0100
committerThomas White <taw@bitwiz.org.uk>2015-10-27 23:03:16 +0100
commitc6e5d582be0170b87fdee48aebf1f9673a52f6b2 (patch)
treeea9054e4cb7f6399bc64a6076a66035ddd1d6eea /src/sc_editor.c
parent931c70630f9d87ab371dad830c6b2cb94a2b882d (diff)
Set size properly for fixed size SCEditors
Diffstat (limited to 'src/sc_editor.c')
-rw-r--r--src/sc_editor.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c
index 7786bc8..d77525c 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -1,7 +1,7 @@
/*
* sc_editor.c
*
- * Copyright © 2013-2014 Thomas White <taw@bitwiz.org.uk>
+ * Copyright © 2013-2015 Thomas White <taw@bitwiz.org.uk>
*
* This file is part of Colloquium.
*
@@ -88,7 +88,6 @@ static void update_size(SCEditor *e)
e->log_w = e->w;
e->log_h = e->h;
e->top->h = e->h;
- printf("set %i %i %f %f\n", e->w, e->h, e->log_w, e->log_h);
set_vertical_params(e);
}
@@ -194,27 +193,45 @@ static void sc_editor_get_property(GObject *obj, guint id, GValue *val,
static GtkSizeRequestMode get_request_mode(GtkWidget *widget)
{
- return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
+ if ( SC_EDITOR(widget)->flow ) {
+ return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
+ }
+
+ return GTK_SIZE_REQUEST_CONSTANT_SIZE;
}
static void get_preferred_width(GtkWidget *widget, gint *min, gint *natural)
{
- *min = 100;
- *natural = 640;
+ SCEditor *e = SC_EDITOR(widget);
+ if ( e->flow ) {
+ *min = 100;
+ *natural = 640;
+ }
+
+ *min = e->w;
+ *natural = e->w;
}
static void get_preferred_height(GtkWidget *widget, gint *min, gint *natural)
{
- *min = 1000;
- *natural = 1000;
+ SCEditor *e = SC_EDITOR(widget);
+ if ( e->flow ) {
+ *min = 1000;
+ *natural = 1000;
+ }
+
+ *min = e->h;
+ *natural = e->h;
}
static void hforw(GtkWidget *widget, gint width, gint *min, gint *natural)
{
- printf("height for width = %i\n", width);
+ if ( !SC_EDITOR(widget)->flow ) {
+ fprintf(stderr, "Warning: height for width call!\n");
+ }
*min = 10000;
*natural = 10000;
}