aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/frame.h3
-rw-r--r--src/render.c1
-rw-r--r--src/sc_editor.c22
-rw-r--r--src/sc_interp.c13
4 files changed, 30 insertions, 9 deletions
diff --git a/src/frame.h b/src/frame.h
index e81197b..8f70c33 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -83,6 +83,9 @@ struct frame
/* True if the aspect ratio of this frame should be maintained */
int is_image;
+ /* True if this frame can be resized and moved */
+ int resizable;
+
/* True if wrapping failed for this frame */
int trouble;
};
diff --git a/src/render.c b/src/render.c
index 4156ed0..17d0444 100644
--- a/src/render.c
+++ b/src/render.c
@@ -426,6 +426,7 @@ static void render_sc_to_surface(SCBlock *scblocks, cairo_surface_t *surf,
top = sc_block_frame(scblocks);
if ( top == NULL ) {
top = frame_new();
+ top->resizable = 0;
sc_block_set_frame(scblocks, top);
}
top->x = 0.0;
diff --git a/src/sc_editor.c b/src/sc_editor.c
index 1736b47..71cdc7f 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -358,12 +358,13 @@ static void draw_overlay(cairo_t *cr, SCEditor *e)
w = e->selection->w;
h = e->selection->h;
- /* Draw resize handles */
- /* FIXME: Not if this frame can't be resized */
- draw_resize_handle(cr, x, y+h-20.0);
- draw_resize_handle(cr, x+w-20.0, y);
- draw_resize_handle(cr, x, y);
- draw_resize_handle(cr, x+w-20.0, y+h-20.0);
+ if ( e->selection->resizable ) {
+ /* Draw resize handles */
+ draw_resize_handle(cr, x, y+h-20.0);
+ draw_resize_handle(cr, x+w-20.0, y);
+ draw_resize_handle(cr, x, y);
+ draw_resize_handle(cr, x+w-20.0, y+h-20.0);
+ }
draw_caret(cr, e->cursor_frame, e->cursor_line, e->cursor_box,
e->cursor_pos);
@@ -826,7 +827,7 @@ static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event,
/* Within the resizing region? */
c = which_corner(x, y, fr);
- if ( c != CORNER_NONE ) {
+ if ( (c != CORNER_NONE) && (fr->resizable) ) {
e->drag_reason = DRAG_REASON_RESIZE;
e->drag_corner = c;
@@ -851,8 +852,11 @@ static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event,
e->start_corner_x = event->x - e->border_offs_x;
e->start_corner_y = event->y - e->border_offs_y;
- e->drag_status = DRAG_STATUS_COULD_DRAG;
- e->drag_reason = DRAG_REASON_MOVE;
+
+ if ( fr->resizable ) {
+ e->drag_status = DRAG_STATUS_COULD_DRAG;
+ e->drag_reason = DRAG_REASON_MOVE;
+ }
}
diff --git a/src/sc_interp.c b/src/sc_interp.c
index e954613..e1a5df7 100644
--- a/src/sc_interp.c
+++ b/src/sc_interp.c
@@ -773,6 +773,14 @@ static void maybe_recurse_after(SCInterpreter *scin, SCBlock *child)
}
+static int in_macro(SCInterpreter *scin)
+{
+ struct sc_state *st = &scin->state[scin->j];
+ if ( st->macro_contents == NULL ) return 0;
+ return 1;
+}
+
+
static int check_outputs(SCBlock *bl, SCInterpreter *scin)
{
const char *name = sc_block_name(bl);
@@ -809,6 +817,11 @@ static int check_outputs(SCBlock *bl, SCInterpreter *scin)
fr = add_subframe(sc_interp_get_frame(scin));
sc_block_set_frame(bl, fr);
fr->scblocks = bl;
+ if ( in_macro(scin) ) {
+ fr->resizable = 0;
+ } else {
+ fr->resizable = 1;
+ }
}
if ( fr == NULL ) {
fprintf(stderr, "Failed to add frame.\n");