mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2024-12-22 23:59:34 +02:00
The bottom face can now be shifted and rotated as well.
- solidify/overlap.h, solidify/overlap.c (edit_top, overlap_edit): select the face to rotate and shift - solidify/overlap.c (scroll_event): select face to manipulate based on edit_top - solidify/solidify.c (a_b, gui_buttons): new button B+A to select the bottom face for editing - solidify/solidify.c clicked): call overlap_edit to select face to edit
This commit is contained in:
parent
5fd9b33e5a
commit
733332da8c
@ -28,6 +28,7 @@
|
||||
|
||||
|
||||
static int has_osd;
|
||||
static int edit_top;
|
||||
|
||||
|
||||
static int sx(const struct solid *s)
|
||||
@ -405,16 +406,20 @@ static gboolean scroll_event(GtkWidget *widget, GdkEventScroll *event,
|
||||
switch (event->direction) {
|
||||
case GDK_SCROLL_UP:
|
||||
if (center)
|
||||
shift(&s->a->m, dx, dy, dist);
|
||||
shift(edit_top ? &s->a->m : &s->b->m,
|
||||
edit_top ? dx : -dx, dy, dist);
|
||||
else
|
||||
rotate(&s->a->m, dx > 0 ? rot : -rot);
|
||||
rotate(edit_top ? &s->a->m : &s->b->m,
|
||||
dx > 0 ? rot : -rot);
|
||||
draw_image(darea, s, osd);
|
||||
break;
|
||||
case GDK_SCROLL_DOWN:
|
||||
if (center)
|
||||
shift(&s->a->m, dx, dy, -dist);
|
||||
shift(edit_top ? &s->a->m : &s->b->m,
|
||||
edit_top ? dx : -dx, dy, -dist);
|
||||
else
|
||||
rotate(&s->a->m, dx > 0 ? -rot : rot);
|
||||
rotate(edit_top ? &s->a->m : &s->b->m,
|
||||
dx > 0 ? -rot : rot);
|
||||
draw_image(darea, s, osd);
|
||||
break;
|
||||
default:
|
||||
@ -446,6 +451,12 @@ static gboolean motion_notify_event(GtkWidget *widget, GdkEventMotion *event,
|
||||
}
|
||||
|
||||
|
||||
void overlap_edit(int top)
|
||||
{
|
||||
edit_top = top;
|
||||
}
|
||||
|
||||
|
||||
void overlap(GtkWidget *canvas, struct solid *s)
|
||||
{
|
||||
GtkWidget *evbox, *darea;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "solid.h"
|
||||
|
||||
|
||||
void overlap_edit(int top);
|
||||
void overlap(GtkWidget *canvas, struct solid *solid);
|
||||
|
||||
#endif /* !OVERLAP_H */
|
||||
|
@ -28,13 +28,16 @@
|
||||
|
||||
static struct project *prj;
|
||||
static const struct face *active; /* NULL if overlapping */
|
||||
static GtkWidget *canvas;
|
||||
static GtkWidget *canvas, *a_b;
|
||||
|
||||
|
||||
static void clicked(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
struct face *face = user_data;
|
||||
|
||||
if (!face)
|
||||
overlap_edit(button == GTK_BUTTON(a_b));
|
||||
|
||||
if (active == face)
|
||||
return;
|
||||
|
||||
@ -66,7 +69,12 @@ static GtkWidget *gui_buttons(void)
|
||||
g_signal_connect(G_OBJECT(but), "clicked",
|
||||
G_CALLBACK(clicked), prj->s.b);
|
||||
|
||||
but = gtk_button_new_with_label("A+B");
|
||||
a_b = gtk_button_new_with_label("A+B");
|
||||
gtk_box_pack_start(GTK_BOX(vbox), a_b, FALSE, FALSE, 0);
|
||||
g_signal_connect(G_OBJECT(a_b), "clicked",
|
||||
G_CALLBACK(clicked), NULL);
|
||||
|
||||
but = gtk_button_new_with_label("B+A");
|
||||
gtk_box_pack_start(GTK_BOX(vbox), but, FALSE, FALSE, 0);
|
||||
g_signal_connect(G_OBJECT(but), "clicked",
|
||||
G_CALLBACK(clicked), NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user