mirror of
git://projects.qi-hardware.com/ben-scans.git
synced 2025-04-21 12:27:27 +03:00
solidify now stores the context of sessions in project description files.
- solidify/Makefile (OBJS): added project.o - solidify/Makefile (new): new target to create a new project - solidify/Makefile (run): changed to resume previously created project - solidify/util.h (stralloc): added stralloc (from fped) - solidify/project.h, solidify/project.c: create, load, and save project description files - solidify/solidify.c (clicked, gui_buttons, gui, main): updated to use project instead of solid - solidify/solidify.c (usage, main): new invocation: four arguments to start new project, one argument to resume old project
This commit is contained in:
@@ -19,13 +19,14 @@
|
||||
|
||||
#include "face.h"
|
||||
#include "solid.h"
|
||||
#include "project.h"
|
||||
#include "style.h"
|
||||
#include "level.h"
|
||||
#include "overlap.h"
|
||||
|
||||
|
||||
static struct solid solid;
|
||||
static const struct face *active;
|
||||
static struct project *prj;
|
||||
static const struct face *active; /* NULL if overlapping */
|
||||
static GtkWidget *canvas;
|
||||
|
||||
|
||||
@@ -41,7 +42,7 @@ static void clicked(GtkButton *button, gpointer user_data)
|
||||
if (face)
|
||||
level(canvas, face);
|
||||
else
|
||||
overlap(canvas, &solid);
|
||||
overlap(canvas, &prj->s);
|
||||
active = face;
|
||||
|
||||
gtk_widget_show_all(canvas);
|
||||
@@ -57,12 +58,12 @@ static GtkWidget *gui_buttons(void)
|
||||
but = gtk_button_new_with_label("A");
|
||||
gtk_box_pack_start(GTK_BOX(vbox), but, FALSE, FALSE, 0);
|
||||
g_signal_connect(G_OBJECT(but), "clicked",
|
||||
G_CALLBACK(clicked), solid.a);
|
||||
G_CALLBACK(clicked), prj->s.a);
|
||||
|
||||
but = gtk_button_new_with_label("B");
|
||||
gtk_box_pack_start(GTK_BOX(vbox), but, FALSE, FALSE, 0);
|
||||
g_signal_connect(G_OBJECT(but), "clicked",
|
||||
G_CALLBACK(clicked), solid.b);
|
||||
G_CALLBACK(clicked), prj->s.b);
|
||||
|
||||
but = gtk_button_new_with_label("A+B");
|
||||
gtk_box_pack_start(GTK_BOX(vbox), but, FALSE, FALSE, 0);
|
||||
@@ -101,8 +102,8 @@ static void gui(void)
|
||||
buttons = gui_buttons();
|
||||
gtk_box_pack_start(GTK_BOX(hbox), buttons, FALSE, FALSE, 0);
|
||||
|
||||
level(canvas, solid.a);
|
||||
active = solid.a;
|
||||
level(canvas, prj->s.a);
|
||||
active = prj->s.a;
|
||||
|
||||
init_style(root->window);
|
||||
|
||||
@@ -119,37 +120,36 @@ static void gui(void)
|
||||
|
||||
static void usage(const char *name)
|
||||
{
|
||||
fprintf(stderr, "usage: %s top bottom dist\n", name);
|
||||
fprintf(stderr, "usage: %s project [top bottom dist]\n", name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
double dist;
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
setlocale(LC_ALL, "C"); /* damage control */
|
||||
|
||||
switch (argc) {
|
||||
case 4:
|
||||
case 2:
|
||||
prj = load_project(argv[1]);
|
||||
break;
|
||||
case 5:
|
||||
dist = atof(argv[4]);
|
||||
prj = new_project(argv[1], argv[2], argv[3], dist);
|
||||
break;
|
||||
default:
|
||||
usage(*argv);
|
||||
}
|
||||
|
||||
solid.a = read_face(argv[1]);
|
||||
solid.b = read_face(argv[2]);
|
||||
if (solid.a->x_step != solid.a->x_step ||
|
||||
solid.a->y_step != solid.a->y_step ||
|
||||
solid.a->z_step != solid.a->z_step) {
|
||||
fprintf(stderr, "both faces must have the same resolution\n");
|
||||
exit(1);
|
||||
}
|
||||
solid.dist = atof(argv[3])/solid.a->z_step;
|
||||
|
||||
gui();
|
||||
|
||||
save_project(prj);
|
||||
|
||||
if (!isatty(1))
|
||||
povray(&solid);
|
||||
povray(&prj->s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user