Initial import of gattrib 20040806
[geda-gaf/whiteaudio.git] / gattrib / src / i_basic.c
blob5282bc8155a08130320fe4cfb9682951afca7946
1 /* gEDA - GPL Electronic Design Automation
2 * gschem - gEDA Schematic Capture
3 * Copyright (C) 1998-2000 Ales V. Hvezda
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
22 #include <config.h>
24 #ifdef HAVE_STRING_H
25 #include <string.h>
26 #endif
29 /*------------------------------------------------------------------
30 * Gattrib specific includes. Note that include order is important.
31 *------------------------------------------------------------------*/
32 #include <libgeda/libgeda.h> /* geda library fcns */
33 #include "../include/struct.h" /* typdef and struct declarations */
34 #include "../include/prototype.h" /* function prototypes */
35 #include "../include/globals.h"
37 /* --- This is necessary for i_basic.c --- */
38 #include "../include/x_states.h"
41 /* ------------------------------------------------------------- *
43 * ------------------------------------------------------------- */
44 static void i_update_status(TOPLEVEL * w_current, const char *string)
46 if (!w_current->status_label) {
47 return;
50 if (string) {
51 /* NOTE: consider optimizing this if same label */
52 w_current->DONT_RESIZE = 1;
53 gtk_label_set(GTK_LABEL(w_current->status_label), (char *) string);
58 /* ------------------------------------------------------------- *
60 * ------------------------------------------------------------- */
61 void i_update_cursor(TOPLEVEL * w_current)
64 /* SDB asks: Do we need this?!?!?!?! */
66 GdkCursor *cursor;
67 cursor = gdk_cursor_new(GDK_ARROW);
68 gdk_window_set_cursor(w_current->window, cursor);
69 gdk_cursor_destroy(cursor);
74 /* ------------------------------------------------------------- *
76 * ------------------------------------------------------------- */
77 void i_set_filename(TOPLEVEL * w_current, const char *string)
79 char trunc_string[41];
80 int len;
81 int i;
83 if (!w_current->filename_label) {
84 return;
87 if (string) {
88 len = strlen(string);
89 w_current->DONT_RESIZE = 1;
91 if (w_current->filename_label) {
92 if (len > 40) {
94 trunc_string[0] = '.';
95 trunc_string[1] = '.';
96 trunc_string[2] = '.';
98 trunc_string[40] = '\0';
99 for (i = 39; i > 2; i--) {
100 if (len >= 0) {
101 trunc_string[i] = string[len];
102 } else {
103 break;
105 len--;
108 gtk_label_set(GTK_LABEL(w_current->filename_label), trunc_string);
110 } else {
112 gtk_label_set(GTK_LABEL(w_current->
113 filename_label), (char *) string);