1 /*
2  * schematic-view.h
3  *
4  *
5  * Authors:
6  *  Richard Hult <rhult@hem.passagen.se>
7  *  Ricardo Markiewicz <rmarkie@fi.uba.ar>
8  *  Andres de Barbara <adebarbara@fi.uba.ar>
9  *  Marc Lorber <lorber.marc@wanadoo.fr>
10  *  Guido Trentalancia <guido@trentalancia.com>
11  *
12  * Web page: https://ahoi.io/project/oregano
13  *
14  * Copyright (C) 1999-2001  Richard Hult
15  * Copyright (C) 2003,2004  Ricardo Markiewicz
16  * Copyright (C) 2009-2012  Marc Lorber
17  * Copyright (C) 2017       Guido Trentalancia
18  *
19  * This library is free software; you can redistribute it and/or
20  * modify it under the terms of the GNU General Public License as
21  * published by the Free Software Foundation; either version 2 of the
22  * License, or (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
27  * General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public
30  * License along with this library; if not, write to the
31  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
32  * Boston, MA 02110-1301, USA.
33  */
34 
35 #ifndef __SCHEMATIC_VIEW_H
36 #define __SCHEMATIC_VIEW_H
37 
38 // typedefing before including makes circular dependencies possible
39 typedef struct _SchematicView SchematicView;
40 
41 #include <gtk/gtk.h>
42 
43 #include "schematic.h"
44 #include "sheet.h"
45 
46 /*
47  * When stretching a schematic to resize
48  * it, increase its width or height of
49  * this percentage (the recommended factor
50  * is 0.15 for a 15% increase).
51  */
52 #define	SCHEMATIC_STRETCH_FACTOR	0.15
53 
54 typedef enum { DRAG_URI_INFO, DRAG_PART_INFO } DragTypes;
55 
56 #define TYPE_SCHEMATIC_VIEW (schematic_view_get_type ())
57 #define SCHEMATIC_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCHEMATIC_VIEW, SchematicView))
58 #define SCHEMATIC_VIEW_CLASS(klass)                                                                \
59 	(G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SCHEMATIC_VIEW, SchematicViewClass))
60 #define IS_SCHEMATIC_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SCHEMATIC_VIEW))
61 #define IS_SCHEMATIC_VIEW_CLASS(klass)                                                             \
62 	(G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SCHEMATIC_VIEW, SchematicViewClass))
63 
64 typedef struct _SchematicViewClass SchematicViewClass;
65 typedef struct _SchematicViewPriv SchematicViewPriv;
66 
67 GType schematic_view_get_type (void);
68 
69 void schematic_view_simulate_cmd (GtkWidget *widget, SchematicView *sv);
70 
71 SchematicView *schematic_view_new (Schematic *schematic);
72 Sheet *schematic_view_get_sheet (SchematicView *sv);
73 void schematic_view_set_sheet (SchematicView *sv, Sheet *sheet);
74 Schematic *schematic_view_get_schematic (SchematicView *sv);
75 Schematic *schematic_view_get_schematic_from_sheet (Sheet *sheet);
76 SchematicView *schematic_view_get_schematicview_from_sheet (Sheet *sheet);
77 void run_context_menu (SchematicView *sv, GdkEventButton *event);
78 
79 // Signal emission wrappers.
80 void schematic_view_reset_tool (SchematicView *sv);
81 
82 // Misc.
83 void schematic_view_set_browser (SchematicView *sv, gpointer p);
84 gpointer schematic_view_get_browser (SchematicView *sv);
85 void schematic_view_set_parent (SchematicView *sv, GtkDialog *dialog);
86 
87 // Logging.
88 void schematic_view_log_show (SchematicView *sv, gboolean explicit);
89 gboolean schematic_view_get_log_window_exists (SchematicView *sv);
90 
91 // Windows services.
92 GtkWidget *schematic_view_get_toplevel (SchematicView *sv);
93 
94 #endif /* __SCHEMATIC_VIEW_H */
95