Permalink
Browse files

sheet directory cleaned and improvement for fourier analysis

  • Loading branch information...
1 parent 1af2d29 commit 3e7f1cdf8fd32bf0c653fe242ac3d62033229b30 @marc-lorber committed Dec 31, 2011
View
@@ -1,4 +1,7 @@
oreganodir = $(datadir)/oregano
+
+CFLAGS += -Wall -DG_DISABLE_DEPRECATED
+
INCLUDES = \
$(OREGANO_CFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/src/model \
-DOREGANO_GLADEDIR=\""$(oreganodir)/glade"\" \
@@ -25,4 +28,3 @@ libsheet_a_SOURCES = \
textbox-item.h \
wire-item.c \
wire-item.h
-libsheet_a_LIBADD = libsheet.a
View
@@ -29,7 +29,7 @@
*/
#include <glade/glade.h>
-#include <math.h>
+#include <glib/gi18n.h>
#include <string.h>
#include "main.h"
#include "schematic-view.h"
@@ -103,10 +103,8 @@ enum {
struct _PartItemPriv {
guint cache_valid : 1;
guint highlight : 1;
-
GnomeCanvasGroup *label_group;
GSList *label_items;
-
GnomeCanvasGroup *node_group;
GSList *label_nodes;
@@ -135,6 +133,7 @@ static const char *part_item_context_menu =
" <menuitem action='ObjectProperties'/>"
" </popup>"
"</ui>";
+
static GtkActionEntry action_entries[] = {
{"ObjectProperties", GTK_STOCK_PROPERTIES, N_("_Object Properties..."), NULL, N_("Modify the object's properties"), NULL}//G_CALLBACK (object_properties_cmd)}
};
@@ -489,8 +488,7 @@ part_item_update_node_label (PartItem *item)
GSList *labels;
GnomeCanvasItem *canvas_item;
Pin *pins;
- gint num_pins, i;
-
+ gint num_pins;
g_return_if_fail(item != NULL);
g_return_if_fail(IS_PART_ITEM (item));
@@ -501,19 +499,21 @@ part_item_update_node_label (PartItem *item)
/* Put the label of each node */
num_pins = part_get_num_pins(part);
- pins = part_get_pins(part);
- labels = priv->label_nodes;
- for (i=0; i<num_pins; i++, labels=labels->next) {
- int x, y;
- char *txt;
- x = pins[i].offset.x;
- y = pins[i].offset.y;
+
+ if (num_pins == 1) {
+
+ pins = part_get_pins(part);
+ labels = priv->label_nodes;
+ for (labels = priv->label_nodes; labels; labels=labels->next) {
+ char *txt;
- txt = g_strdup_printf("%d", pins[i].node_nr);
- canvas_item = labels->data;
- gnome_canvas_item_set (canvas_item, "text", txt, NULL);
+ txt = g_strdup_printf("V(%d)", pins[0].node_nr);
+ canvas_item = labels->data;
+ //if (pins[0].node_nr != 0)
+ gnome_canvas_item_set (canvas_item, "text", txt, NULL);
- g_free(txt);
+ g_free(txt);
+ }
}
}
@@ -551,7 +551,7 @@ prop_dialog_response(GtkWidget *dialog, gint response,
for (props = part_get_properties (part); props; props = props->next) {
prop = props->data;
- if (g_strcasecmp (prop->name, prop_name) == 0) {
+ if (g_ascii_strcasecmp (prop->name, prop_name) == 0) {
if (prop->value) g_free (prop->value);
prop->value = g_strdup (prop_value);
}
@@ -622,27 +622,27 @@ edit_properties_point (PartItem *item)
Property *prop;
prop = properties->data;
if (prop->name) {
- if (!g_strcasecmp (prop->name, "internal"))
+ if (!g_ascii_strcasecmp (prop->name, "internal"))
continue;
- if (!g_strcasecmp (prop->name, "type")) {
- if (!g_strcasecmp (prop->value, "v")) {
+ if (!g_ascii_strcasecmp (prop->name, "type")) {
+ if (!g_ascii_strcasecmp (prop->value, "v")) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_v), TRUE);
} else {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_c), TRUE);
}
- } else if (!g_strcasecmp (prop->name, "ac_type")) {
- if (!g_strcasecmp (prop->value, "m")) {
+ } else if (!g_ascii_strcasecmp (prop->name, "ac_type")) {
+ if (!g_ascii_strcasecmp (prop->value, "m")) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ac_m), TRUE);
- } else if (!g_strcasecmp (prop->value, "i")) {
+ } else if (!g_ascii_strcasecmp (prop->value, "i")) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ac_i), TRUE);
- } else if (!g_strcasecmp (prop->value, "p")) {
+ } else if (!g_ascii_strcasecmp (prop->value, "p")) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ac_p), TRUE);
- } else if (!g_strcasecmp (prop->value, "r")) {
+ } else if (!g_ascii_strcasecmp (prop->value, "r")) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ac_r), TRUE);
}
- } else if (!g_strcasecmp (prop->name, "ac_db")) {
- if (!g_strcasecmp (prop->value, "true"))
+ } else if (!g_ascii_strcasecmp (prop->name, "ac_db")) {
+ if (!g_ascii_strcasecmp (prop->value, "true"))
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chk_db), TRUE);
}
}
@@ -657,17 +657,17 @@ edit_properties_point (PartItem *item)
prop = properties->data;
if (prop->name) {
- if (!g_strcasecmp (prop->name, "internal"))
+ if (!g_ascii_strcasecmp (prop->name, "internal"))
continue;
- if (!g_strcasecmp (prop->name, "type")) {
+ if (!g_ascii_strcasecmp (prop->name, "type")) {
g_free (prop->value);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_v))) {
prop->value = g_strdup ("v");
} else {
prop->value = g_strdup ("i");
}
- } else if (!g_strcasecmp (prop->name, "ac_type")) {
+ } else if (!g_ascii_strcasecmp (prop->name, "ac_type")) {
g_free (prop->value);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ac_m))) {
prop->value = g_strdup ("m");
@@ -678,7 +678,7 @@ edit_properties_point (PartItem *item)
} else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ac_r))) {
prop->value = g_strdup ("r");
}
- } else if (!g_strcasecmp (prop->name, "ac_db")) {
+ } else if (!g_ascii_strcasecmp (prop->name, "ac_db")) {
g_free (prop->value);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (chk_db)))
prop->value = g_strdup ("true");
@@ -687,7 +687,6 @@ edit_properties_point (PartItem *item)
}
}
}
-
gtk_widget_destroy (GTK_WIDGET (prop_dialog->dialog));
}
@@ -715,12 +714,12 @@ edit_properties (SheetItem *object)
internal = part_get_property (part, "internal");
if (internal) {
- if (g_strcasecmp (internal, "ground") == 0) {
+ if (g_ascii_strcasecmp (internal, "ground") == 0) {
g_free (internal);
return;
}
/* Hack!! */
- if (g_strcasecmp (internal, "point") == 0) {
+ if (g_ascii_strcasecmp (internal, "point") == 0) {
edit_properties_point (item);
return;
}
@@ -760,24 +759,25 @@ edit_properties (SheetItem *object)
prop_dialog->widgets = NULL;
has_model = FALSE;
+
for (properties = part_get_properties (part); properties;
properties = properties->next) {
Property *prop;
prop = properties->data;
+
if (prop->name) {
GtkWidget *entry;
GtkWidget *label;
gchar *temp=NULL;
- if (!g_strcasecmp (prop->name, "internal"))
+ if (!g_ascii_strcasecmp (prop->name, "internal"))
continue;
- if (!g_strcasecmp (prop->name, "model")) {
+ if (!g_ascii_strcasecmp (prop->name, "model")) {
has_model = TRUE;
model_name = g_strdup (prop->value);
}
-
/* Find the Refdes and replace by their real value */
temp = prop->name;
@@ -787,6 +787,7 @@ edit_properties (SheetItem *object)
if (!g_ascii_strcasecmp (temp, "Cap")) temp = _("Capacitor");
if (!g_ascii_strcasecmp (temp, "Ind")) temp = _("Inductor");
label = gtk_label_new (temp);
+
entry = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (entry), prop->value);
g_object_set_data (G_OBJECT (entry), "user", g_strdup (prop->name));
@@ -935,7 +936,6 @@ part_rotated_callback (ItemData *data, int angle, SheetItem *sheet_item)
break;
}
-
for (label_items = priv->label_items; label_items;
label_items = label_items->next) {
gnome_canvas_item_set (
@@ -1618,15 +1618,14 @@ part_item_place_ghost (SheetItem *item, SchematicView *sv)
void
-part_item_show_node_labels (PartItem *part, gboolean b)
+part_item_show_node_labels (PartItem *part, gboolean show)
{
PartItemPriv *priv;
priv = part->priv;
- if (b)
+ if (show)
gnome_canvas_item_show (GNOME_CANVAS_ITEM (priv->node_group));
else
gnome_canvas_item_hide (GNOME_CANVAS_ITEM (priv->node_group));
}
-
@@ -30,7 +30,6 @@
#ifndef __SHEET_ITEM_FACTORY_H
#define __SHEET_ITEM_FACTORY_H
-#include "item-data.h"
#include "sheet-item.h"
SheetItem *sheet_item_factory_create_sheet_item (SchematicView *sv, ItemData *data);
View
@@ -28,7 +28,10 @@
* Boston, MA 02111-1307, USA.
*/
-#include <math.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+
#include "main.h"
#include "sheet-private.h"
#include "sheet-item.h"
@@ -108,6 +111,7 @@ static GtkActionEntry action_entries[] = {
{"FlipH", NULL, N_("Flip _horizontally"), "<control>F", N_("Flip the selection horizontally"), NULL},
{"FlipV", NULL, N_("Flip _vertically"), "<control><shift>F", N_("Flip the selection vertically"), NULL}
};
+
GType
sheet_item_get_type ()
{
@@ -326,7 +330,6 @@ sheet_item_run_menu (SheetItem *item, SchematicView *sv, GdkEventButton *event)
GtkWidget *menu;
menu = gtk_ui_manager_get_widget (item->priv->ui_manager, "/ItemMenu");
-
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, sv, event->button, event->time);
}
@@ -495,7 +498,6 @@ sheet_item_event (SheetItem *sheet_item, const GdkEvent *event, SchematicView *s
sheet->state = SHEET_STATE_NONE;
gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM (sheet_item), event->button.time);
-
/*
* HACK :(
* FIXME: fix this later. The problem is that we don't want to
@@ -873,7 +875,6 @@ sheet_item_floating_event (Sheet *sheet, const GdkEvent *event, SchematicView *s
for (list = priv->floating_objects; list; list = list->next) {
sheet_item_reparent (SHEET_ITEM (list->data), priv->floating_group);
}
-
gtk_object_get (GTK_OBJECT (sheet->priv->floating_group),
"x", &delta.x,
"y", &delta.y,
@@ -1209,6 +1210,7 @@ sheet_item_add_menu (SheetItem *item, const char *menu,
const GtkActionEntry *action_entries, int nb_entries)
{
GError *error = NULL;
+
gtk_action_group_add_actions (item->priv->action_group,
action_entries,
nb_entries,
View
@@ -34,8 +34,6 @@
#include <glib.h>
#include <libgnomecanvas/libgnomecanvas.h>
#include "sheet-pos.h"
-#include "item-data.h"
-
#define TYPE_SHEET_ITEM (sheet_item_get_type())
#define SHEET_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST(obj, sheet_item_get_type (), SheetItem))
@@ -126,4 +124,4 @@ void sheet_item_place_ghost (SheetItem *item, SchematicView *sv);
void sheet_item_add_menu (SheetItem *item, const char *menu,
const GtkActionEntry *action_entries, int nb_entries);
-#endif
+#endif
View
@@ -36,9 +36,10 @@
* (C) 1999, 2000 Richard Hult, http://www.dtek.chalmers.se/~d4hult/oregano/
*/
-#include <math.h>
-#include <gnome.h>
#include <glade/glade.h>
+#include <string.h>
+#include <glib/gi18n.h>
+
#include "cursors.h"
#include "sheet-private.h"
#include "sheet-pos.h"
@@ -77,7 +78,6 @@ inline static void get_cached_bounds (TextboxItem *item, SheetPos *p1,
static void textbox_item_place (SheetItem *item, SchematicView *sv);
static void textbox_item_place_ghost (SheetItem *item, SchematicView *sv);
-
static void edit_cmd (GtkWidget *widget, SchematicView *sv);
static void edit_textbox (SheetItem *sheet_item);
@@ -386,11 +386,6 @@ inline static void
get_cached_bounds (TextboxItem *item, SheetPos *p1, SheetPos *p2)
{
PangoFontDescription *font;
- PangoFontMetrics *font_metric;
- int width;
- int rbearing;
- int lbearing;
- int ascent, descent;
SheetPos pos;
TextboxItemPriv *priv;
@@ -417,7 +412,6 @@ get_cached_bounds (TextboxItem *item, SheetPos *p1, SheetPos *p2)
memcpy (p1, &priv->bbox_start, sizeof (SheetPos));
memcpy (p2, &priv->bbox_end, sizeof (SheetPos));
-
}
static void
@@ -696,4 +690,4 @@ edit_cmd (GtkWidget *widget, SchematicView *sv)
list = schematic_view_get_selection (sv);
if ((list != NULL) && IS_TEXTBOX_ITEM (list->data))
edit_textbox (list->data);
-}
+}
Oops, something went wrong.

0 comments on commit 3e7f1cd

Please sign in to comment.