added gas bottle shape
[dia.git] / app / tool.c
blobaaed4a49f52d88c83391d9080dbcfe6fa070a6c9
1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 1998 Alexander Larsson
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 #include "tool.h"
19 #include "create_object.h"
20 #include "magnify.h"
21 #include "modify_tool.h"
22 #include "scroll_tool.h"
23 #include "interface.h"
24 #include "defaults.h"
26 Tool *active_tool = NULL;
28 void
29 tool_select(ToolType type, gpointer extra_data, gpointer user_data)
31 switch(active_tool->type) {
32 case MODIFY_TOOL:
33 free_modify_tool(active_tool);
34 break;
35 case CREATE_OBJECT_TOOL:
36 free_create_object_tool(active_tool);
37 break;
38 case MAGNIFY_TOOL:
39 free_magnify_tool(active_tool);
40 break;
41 case SCROLL_TOOL:
42 free_scroll_tool(active_tool);
43 break;
45 switch(type) {
46 case MODIFY_TOOL:
47 active_tool = create_modify_tool();
48 break;
49 case CREATE_OBJECT_TOOL:
50 active_tool =
51 create_create_object_tool(object_get_type((char *)extra_data),
52 (void *) user_data);
53 break;
54 case MAGNIFY_TOOL:
55 active_tool = create_magnify_tool();
56 break;
57 case SCROLL_TOOL:
58 active_tool = create_scroll_tool();
59 break;
63 void
64 tool_options_dialog_show(ToolType type, gpointer extra_data,
65 gpointer user_data)
67 ObjectType *objtype;
69 if (active_tool->type != type) {
70 switch(active_tool->type) {
71 case MODIFY_TOOL:
72 free_modify_tool(active_tool);
73 break;
74 case CREATE_OBJECT_TOOL:
75 free_create_object_tool(active_tool);
76 break;
77 case MAGNIFY_TOOL:
78 free_magnify_tool(active_tool);
79 break;
80 case SCROLL_TOOL:
81 free_scroll_tool(active_tool);
82 break;
84 switch(type) {
85 case MODIFY_TOOL:
86 active_tool = create_modify_tool();
87 break;
88 case CREATE_OBJECT_TOOL:
89 active_tool =
90 create_create_object_tool(object_get_type((char *)extra_data),
91 (void *) user_data);
92 break;
93 case MAGNIFY_TOOL:
94 active_tool = create_magnify_tool();
95 break;
96 case SCROLL_TOOL:
97 active_tool = create_scroll_tool();
98 break;
101 switch(type) {
102 case MODIFY_TOOL:
103 break;
104 case CREATE_OBJECT_TOOL:
105 objtype = object_get_type((char *)extra_data);
106 defaults_show(objtype);
107 break;
108 case MAGNIFY_TOOL:
109 break;
110 case SCROLL_TOOL:
111 break;
115 void
116 tool_reset(void)
118 gtk_signal_emit_by_name(GTK_OBJECT(modify_tool_button), "clicked",
119 GTK_BUTTON(modify_tool_button), NULL);