Версия graph2d-0.3.5
This commit is contained in:
parent
dfd8e6946a
commit
82d0515b23
24 changed files with 1774 additions and 785 deletions
39
Makefile
39
Makefile
|
@ -1,9 +1,30 @@
|
|||
GTK_LIBS = -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk -rdynamic -lgmodule \
|
||||
-lglib -ldl -lXi -lXext -lX11 -lm -lgdk_imlib
|
||||
OBJECTS = graph2d.o interface.o callback.o drawelem.o
|
||||
CFLAGS =-I/usr/lib/glib/include -I/usr/X11R6/include
|
||||
CC=g++
|
||||
All: $(OBJECTS)
|
||||
$(CC) -o graph2d $(GTK_LIBS) $(OBJECTS)
|
||||
clean:
|
||||
rm -f *.o graph2d
|
||||
|
||||
All: base nls
|
||||
|
||||
clean: clean-base clean-nls
|
||||
|
||||
install: install-base install-pal install-nls
|
||||
|
||||
|
||||
base:
|
||||
@$(MAKE) -C src All
|
||||
|
||||
nls:
|
||||
@$(MAKE) -C po all
|
||||
|
||||
clean-base:
|
||||
@$(MAKE) -C src clean
|
||||
|
||||
clean-nls:
|
||||
@$(MAKE) -C po clean
|
||||
|
||||
install-base:
|
||||
@$(MAKE) -C src install
|
||||
|
||||
install-nls:
|
||||
@$(MAKE) -C po install
|
||||
|
||||
install-pal:
|
||||
mkdir /usr/local/share/graph2d
|
||||
mkdir /usr/local/share/graph2d/palettes
|
||||
cp palettes/*.pal /usr/local/share/graph2d/palettes
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
dddddd
|
||||
ddddddd
|
||||
fff123
|
||||
1 0.00000 -8.08764 1.00000000000000E+0000
|
||||
2 0.00000 -4.58012 0.00000000000000E+0000
|
||||
3 0.00000 -0.26143 0.00000000000000E+0000
|
||||
|
|
BIN
dat/x.jpg
Normal file
BIN
dat/x.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
17
debug/Makefile
Normal file
17
debug/Makefile
Normal file
|
@ -0,0 +1,17 @@
|
|||
GTK_LIBS = -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk -rdynamic -lgmodule \
|
||||
-lglib -ldl -lXi -lXext -lX11 -lm -lgdk_imlib
|
||||
OBJECTS = graph2d.o interface.o callback.o drawelem.o
|
||||
CFLAGS =-g -I/usr/lib/glib/include -I/usr/X11R6/include
|
||||
CC=g++ -g
|
||||
All:
|
||||
g++ -g -c -o graph2d.o graph2d.C
|
||||
g++ -g -c -o interface.o interface.C
|
||||
g++ -g -c -o callback.o callback.C
|
||||
g++ -g -c -o drawelem.o drawelem.C
|
||||
g++ -g -o graph2d -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm -lgdk_imlib graph2d.o interface.o callback.o drawelem.o
|
||||
|
||||
clean:
|
||||
rm -f *.o graph2d
|
||||
|
||||
install:
|
||||
cp graph2d /usr/local/bin
|
744
debug/interface.C
Normal file
744
debug/interface.C
Normal file
|
@ -0,0 +1,744 @@
|
|||
#include "interface.h"
|
||||
#include "pixmaps.h"
|
||||
#include "intl.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
GtkWidget *create_main_window (void)
|
||||
{
|
||||
GtkWidget *main_window;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *main_statusbar;
|
||||
|
||||
GtkWidget *menubar;
|
||||
GtkWidget *item_menu;
|
||||
GtkWidget *main_menu;
|
||||
GtkAccelGroup *main_menu_accels;
|
||||
GtkWidget *item;
|
||||
GSList *menugroup = NULL;
|
||||
|
||||
GtkWidget *menu_handlebox;
|
||||
GtkWidget *scrolledwindow;
|
||||
GtkWidget *viewport;
|
||||
GtkWidget *table;
|
||||
GtkWidget *drawelem;
|
||||
GtkAccelGroup *accel_group;
|
||||
|
||||
GtkWidget *toolbar_handlebox;
|
||||
GtkWidget *toolbar;
|
||||
GtkWidget *tmp_toolbar_icon;
|
||||
GdkBitmap *mask;
|
||||
GdkPixmap *pixmap;
|
||||
GtkStyle *style;
|
||||
GtkWidget *button;
|
||||
GtkWidget *button_s;
|
||||
GtkWidget *button_d;
|
||||
GtkWidget *button_n;
|
||||
GtkWidget *button_m;
|
||||
|
||||
chdir (getenv ("HOME"));
|
||||
|
||||
accel_group = gtk_accel_group_new ();
|
||||
|
||||
main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_default_size (GTK_WINDOW (main_window), 500, 400);
|
||||
gtk_window_set_title (GTK_WINDOW (main_window),
|
||||
_("ðÒÏÇÒÁÍÍÁ Graph2D"));
|
||||
gtk_signal_connect (GTK_OBJECT (main_window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (on_close_main_window), NULL);
|
||||
gtk_widget_show (main_window);
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (main_window), main_vbox);
|
||||
gtk_widget_show (main_vbox);
|
||||
|
||||
main_statusbar = gtk_statusbar_new ();
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "statusbar",
|
||||
main_statusbar);
|
||||
gtk_box_pack_end (GTK_BOX (main_vbox), main_statusbar, FALSE, FALSE,
|
||||
0);
|
||||
gtk_statusbar_push (GTK_STATUSBAR (main_statusbar), 1,
|
||||
_("äÏÂÒÏ ÐÏÖÁÌÏ×ÁÔØ × Graph2D"));
|
||||
gtk_widget_show (main_statusbar);
|
||||
|
||||
menu_handlebox = gtk_handle_box_new ();
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), menu_handlebox, FALSE, TRUE,
|
||||
0);
|
||||
gtk_widget_show (menu_handlebox);
|
||||
|
||||
menubar = gtk_menu_bar_new ();
|
||||
gtk_container_add (GTK_CONTAINER (menu_handlebox), menubar);
|
||||
gtk_widget_show (menubar);
|
||||
|
||||
item_menu = gtk_menu_item_new_with_label (_("æÁÊÌ"));
|
||||
gtk_container_add (GTK_CONTAINER (menubar), item_menu);
|
||||
gtk_widget_show (item_menu);
|
||||
|
||||
main_menu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item_menu), main_menu);
|
||||
|
||||
item = gtk_menu_item_new_with_label (_("ïÔËÒÙÔØ..."));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_O, GDK_CONTROL_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_open_dialog), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_menu_item_new_with_label (_("óÏÈÒÁÎÉÔØ"));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "save", item);
|
||||
gtk_widget_set_sensitive (item, FALSE);
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_S, GDK_CONTROL_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_save_dialog), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_menu_item_new_with_label (_("óÏÈÒÁÎÉÔØ ËÁË..."));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "saveas", item);
|
||||
gtk_widget_set_sensitive (item, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_saveas_dialog), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_menu_item_new_with_label (_("ðÁÌÉÔÒÁ..."));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "pal", item);
|
||||
gtk_widget_set_sensitive (item, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_pal_dialog), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_menu_item_new ();
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_menu_item_new_with_label (_("÷ÙÈÏÄ"));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_Q, GDK_CONTROL_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_close_main_window), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item_menu = gtk_menu_item_new_with_label (_("ðÒÏÓÍÏÔÒ"));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "view", item_menu);
|
||||
gtk_widget_set_sensitive (item_menu, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (menubar), item_menu);
|
||||
gtk_widget_show (item_menu);
|
||||
main_menu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item_menu), main_menu);
|
||||
|
||||
item = gtk_menu_item_new_with_label (_("õ×ÅÌÉÞÉÔØ"));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_equal, 0, GTK_ACCEL_VISIBLE);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_zoomin), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_menu_item_new_with_label (_("õÍÅÎØÛÉÔØ"));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_minus, 0, GTK_ACCEL_VISIBLE);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_zoomout), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_menu_item_new ();
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_radio_menu_item_new_with_label (menugroup, _("óÅÔËÁ"));
|
||||
|
||||
menugroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_menu_setka), NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "menu_s", item);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_radio_menu_item_new_with_label (menugroup, _("äÅÆÏÒÁÃÉÉ"));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "menu_d", item);
|
||||
menugroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_menu_def), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_radio_menu_item_new_with_label (menugroup, _("îÁÐÒÑÖÅÎÉÑ"));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "menu_n", item);
|
||||
menugroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_menu_nap), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_radio_menu_item_new_with_label (menugroup, _("ðÏ×ÒÅÖÄÅÎ."));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "menu_m", item);
|
||||
menugroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_menu_mtr), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_menu_item_new ();
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_check_menu_item_new_with_label (_("éÎÔÅÒÐÏÌÑÃÉÑ"));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "menu_inter", item);
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_menu_inter), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_check_menu_item_new_with_label (_("üÌÅÍÅÎÔÙ"));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "menu_elem", item);
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_menu_elem), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_check_menu_item_new_with_label (_("õÚÌÙ"));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "menu_knot", item);
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_menu_knot), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item_menu = gtk_menu_item_new_with_label (_("óÐÒÁ×ËÁ"));
|
||||
gtk_container_add (GTK_CONTAINER (menubar), item_menu);
|
||||
gtk_menu_item_right_justify (GTK_MENU_ITEM (item_menu));
|
||||
gtk_widget_show (item_menu);
|
||||
main_menu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item_menu), main_menu);
|
||||
|
||||
item = gtk_menu_item_new_with_label (_("ï ðÒÏÇÒÁÍÍÅ"));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_about_dialog), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
toolbar_handlebox = gtk_handle_box_new ();
|
||||
gtk_container_set_border_width (GTK_CONTAINER (toolbar_handlebox), 2);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), toolbar_handlebox, FALSE,
|
||||
TRUE, 0);
|
||||
gtk_widget_show (toolbar_handlebox);
|
||||
|
||||
toolbar =
|
||||
gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS);
|
||||
gtk_container_add (GTK_CONTAINER (toolbar_handlebox), toolbar);
|
||||
gtk_toolbar_set_space_style (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_SPACE_LINE);
|
||||
gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar), GTK_RELIEF_NONE);
|
||||
gtk_widget_show (toolbar);
|
||||
|
||||
|
||||
style = gtk_widget_get_style (main_window);
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (main_window->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
(gchar **) open_xpm);
|
||||
tmp_toolbar_icon = gtk_pixmap_new (pixmap, mask);
|
||||
gdk_pixmap_unref (pixmap);
|
||||
gdk_bitmap_unref (mask);
|
||||
button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_BUTTON,
|
||||
NULL,
|
||||
_("ïÔËÒÙÔØ"),
|
||||
_("ïÔËÒÙÔØ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_open_dialog),
|
||||
NULL);
|
||||
|
||||
gtk_widget_show (button);
|
||||
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (main_window->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
(gchar **) save_xpm);
|
||||
tmp_toolbar_icon = gtk_pixmap_new (pixmap, mask);
|
||||
gdk_pixmap_unref (pixmap);
|
||||
gdk_bitmap_unref (mask);
|
||||
button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_BUTTON,
|
||||
NULL,
|
||||
_("óÏÈÒÁÎÉÔØ"),
|
||||
_("óÏÈÒÁÎÉÔØ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_save_dialog),
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "button_save", button);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_widget_show (button);
|
||||
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (main_window->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
(gchar **) pal_xpm);
|
||||
tmp_toolbar_icon = gtk_pixmap_new (pixmap, mask);
|
||||
gdk_pixmap_unref (pixmap);
|
||||
gdk_bitmap_unref (mask);
|
||||
button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_BUTTON,
|
||||
NULL,
|
||||
_("ðÁÌÉÔÒÁ"),
|
||||
_("ðÁÌÉÔÒÁ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_pal_dialog),
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "button_pal", button);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
|
||||
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (main_window->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
(gchar **) zoomin_xpm);
|
||||
tmp_toolbar_icon = gtk_pixmap_new (pixmap, mask);
|
||||
gdk_pixmap_unref (pixmap);
|
||||
gdk_bitmap_unref (mask);
|
||||
button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_BUTTON,
|
||||
NULL,
|
||||
_("õ×ÅÌÉÞÉÔØ"),
|
||||
_("õ×ÅÌÉÞÉÔØ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_zoomin),
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "button_in", button);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_widget_show (button);
|
||||
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (main_window->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
(gchar **) zoomout_xpm);
|
||||
tmp_toolbar_icon = gtk_pixmap_new (pixmap, mask);
|
||||
gdk_pixmap_unref (pixmap);
|
||||
gdk_bitmap_unref (mask);
|
||||
button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_BUTTON,
|
||||
NULL,
|
||||
_("õÍÅÎØÛÉÔØ"),
|
||||
_("õÍÅÎØÛÉÔØ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_zoomout),
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "button_out", button);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
|
||||
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (main_window->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
(gchar **) setka_xpm);
|
||||
tmp_toolbar_icon = gtk_pixmap_new (pixmap, mask);
|
||||
gdk_pixmap_unref (pixmap);
|
||||
gdk_bitmap_unref (mask);
|
||||
button_s = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_RADIOBUTTON,
|
||||
NULL,
|
||||
_("óÅÔËÁ"),
|
||||
_("óÅÔËÁ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC
|
||||
(on_button_setka), NULL);
|
||||
gtk_widget_set_name (GTK_WIDGET (button_s), "setka");
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "button_s", button_s);
|
||||
gtk_widget_set_sensitive (button_s, FALSE);
|
||||
gtk_widget_show (button);
|
||||
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (main_window->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
(gchar **) epsilon_xpm);
|
||||
tmp_toolbar_icon = gtk_pixmap_new (pixmap, mask);
|
||||
gdk_pixmap_unref (pixmap);
|
||||
gdk_bitmap_unref (mask);
|
||||
button_d = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_RADIOBUTTON,
|
||||
button_s,
|
||||
_("äÅÆÏÒÍÁÃÉÉ"),
|
||||
_("äÅÆÏÒÍÁÃÉÉ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_button_def),
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "button_d", button_d);
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button_d), FALSE);
|
||||
gtk_widget_set_sensitive (button_d, FALSE);
|
||||
gtk_widget_show (button_d);
|
||||
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (main_window->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
(gchar **) sigma_xpm);
|
||||
tmp_toolbar_icon = gtk_pixmap_new (pixmap, mask);
|
||||
gdk_pixmap_unref (pixmap);
|
||||
gdk_bitmap_unref (mask);
|
||||
button_n = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_RADIOBUTTON,
|
||||
button_s,
|
||||
_("îÁÐÒÑÖÅÎÉÑ"),
|
||||
_("îÁÐÒÑÖÅÎÉÑ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_button_nap),
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "button_n", button_n);
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button_n), FALSE);
|
||||
gtk_widget_set_sensitive (button_n, FALSE);
|
||||
gtk_widget_show (button_n);
|
||||
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (main_window->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
(gchar **) trech_xpm);
|
||||
tmp_toolbar_icon = gtk_pixmap_new (pixmap, mask);
|
||||
gdk_pixmap_unref (pixmap);
|
||||
gdk_bitmap_unref (mask);
|
||||
button_m = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_RADIOBUTTON,
|
||||
button_s,
|
||||
_("ðÏ×ÒÅÖÄÅÎ."),
|
||||
_("ðÏ×ÒÅÖÄÅÎ."), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_button_mtr),
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "button_m", button_m);
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button_m), FALSE);
|
||||
gtk_widget_set_sensitive (button_m, FALSE);
|
||||
gtk_widget_show (button_m);
|
||||
|
||||
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
|
||||
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (main_window->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
(gchar **) elem_xpm);
|
||||
tmp_toolbar_icon = gtk_pixmap_new (pixmap, mask);
|
||||
gdk_pixmap_unref (pixmap);
|
||||
gdk_bitmap_unref (mask);
|
||||
button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
|
||||
NULL,
|
||||
_("üÌÅÍÅÎÔÙ"),
|
||||
_("üÌÅÍÅÎÔÙ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_button_elem),
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "button_elem", button);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_widget_show (button);
|
||||
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (main_window->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
(gchar **) knot_xpm);
|
||||
tmp_toolbar_icon = gtk_pixmap_new (pixmap, mask);
|
||||
gdk_pixmap_unref (pixmap);
|
||||
gdk_bitmap_unref (mask);
|
||||
button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
|
||||
NULL,
|
||||
_("õÚÌÙ"),
|
||||
_("õÚÌÙ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_button_knot),
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "button_knot", button);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_widget_show (button);
|
||||
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (main_window->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
(gchar **) inter_xpm);
|
||||
tmp_toolbar_icon = gtk_pixmap_new (pixmap, mask);
|
||||
gdk_pixmap_unref (pixmap);
|
||||
gdk_bitmap_unref (mask);
|
||||
button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
|
||||
NULL,
|
||||
_("éÎÔÅÒÐÏÌÑÃÉÑ"),
|
||||
_("éÎÔÅÒÐÏÌÑÃÉÑ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_button_inter),
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "button_inter", button);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_widget_show (button);
|
||||
|
||||
scrolledwindow = gtk_scrolled_window_new (0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), scrolledwindow, TRUE, TRUE,
|
||||
0);
|
||||
gtk_widget_show (scrolledwindow);
|
||||
|
||||
viewport = gtk_viewport_new (0, 0);
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwindow), viewport);
|
||||
gtk_widget_show (viewport);
|
||||
|
||||
table = gtk_table_new (1, 1, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (viewport), table);
|
||||
gtk_widget_show (table);
|
||||
|
||||
drawelem = drawelem_new ();
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "drawelem", drawelem);
|
||||
gtk_table_attach (GTK_TABLE (table), drawelem, 0, 1, 0, 1,
|
||||
(GtkAttachOptions) (GTK_EXPAND),
|
||||
(GtkAttachOptions) (GTK_EXPAND), 0, 0);
|
||||
gtk_widget_show (drawelem);
|
||||
|
||||
gtk_window_add_accel_group (GTK_WINDOW (main_window), accel_group);
|
||||
return (main_window);
|
||||
};
|
||||
|
||||
GtkWidget *create_about_dialog (void)
|
||||
{
|
||||
GtkWidget *about_dialog;
|
||||
GtkWidget *about_vbox;
|
||||
GtkWidget *about_button;
|
||||
GtkWidget *about_action_area;
|
||||
GtkWidget *about_frame;
|
||||
GtkWidget *about_label1;
|
||||
GtkWidget *about_label2;
|
||||
|
||||
GtkWidget *about_pixmapwid;
|
||||
GdkBitmap *mask;
|
||||
GdkPixmap *about_pixmap;
|
||||
GtkStyle *style;
|
||||
|
||||
static GdkGC *gc = NULL;
|
||||
int PixmapHeight=0;
|
||||
int PixmapWidth=0;
|
||||
int i,j,len;
|
||||
int n=0;
|
||||
char *buf1 = NULL;
|
||||
char *buf2 = NULL;
|
||||
char *buf3 = NULL;
|
||||
int n_comments=-1;
|
||||
char *Title = "Graph 2D 0.3.6";
|
||||
char *Copyright = "Copyright 2001 Rodionov Andrey";
|
||||
char *Authors = "á×ÔÏÒ: òÏÄÉÏÎÏ× áÎÄÒÅÊ";
|
||||
char *Comments =
|
||||
"ðÒÏÇÒÁÍÍÁ ÐÒÅÄÎÁÚÎÁÞÅÎÁ ÄÌÑ ÇÒÁÆÉÞÅÓËÏÇÏ ÐÒÅÄÓÔÁ×ÌÅÎÉÑ ÒÅÚÕÌØÔÁÔÏ× ÞÉÓÌÅÎÎÏÇÏ ÍÏÄÅÌÉÒÏ×ÁÎÉÑ ÍÅÔÏÄÏÍ ËÏÎÅÞÎÙÈ ÜÌÅÍÅÎÔÏ×";
|
||||
|
||||
GdkFont *fontTitle =
|
||||
gdk_font_load
|
||||
("-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*");
|
||||
|
||||
GdkFont *fontCopyright =
|
||||
gdk_font_load
|
||||
("-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*");
|
||||
|
||||
GdkFont *fontAuthors =
|
||||
gdk_font_load
|
||||
("-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*");
|
||||
|
||||
GdkFont *fontComments =
|
||||
gdk_font_load
|
||||
("-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*");
|
||||
|
||||
about_dialog = gtk_dialog_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (about_dialog), _("ï ðÒÏÇÒÁÍÍÅ"));
|
||||
//gtk_widget_set_usize (GTK_WIDGET (about_dialog), 300, 200);
|
||||
gtk_window_set_policy (GTK_WINDOW (about_dialog), FALSE, FALSE, FALSE);
|
||||
gtk_widget_show (about_dialog);
|
||||
|
||||
about_vbox = GTK_DIALOG (about_dialog)->vbox;
|
||||
gtk_container_set_border_width (GTK_CONTAINER (about_vbox), 0);
|
||||
gtk_widget_show (about_vbox);
|
||||
|
||||
about_frame = gtk_frame_new (NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (about_frame), 7);
|
||||
gtk_box_pack_start (GTK_BOX (about_vbox), about_frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (about_frame);
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
PixmapWidth = gdk_string_width (fontTitle, Title)+20;
|
||||
PixmapHeight = gdk_string_height (fontTitle, Title);
|
||||
|
||||
if (PixmapWidth < gdk_string_width (fontCopyright,Copyright)+10)
|
||||
PixmapWidth = gdk_string_width (fontCopyright,Copyright)+10;
|
||||
PixmapHeight =PixmapHeight + gdk_string_height (fontCopyright,Copyright);
|
||||
|
||||
if (PixmapWidth < gdk_string_width (fontAuthors,Authors)+10)
|
||||
PixmapWidth = gdk_string_width (fontAuthors,Authors)+10;
|
||||
PixmapHeight =PixmapHeight + gdk_string_height (fontAuthors,Authors);
|
||||
|
||||
for (i=0;i<strlen(Comments);i++)
|
||||
{
|
||||
|
||||
if (buf1!=NULL)
|
||||
{
|
||||
len=strlen(buf1)+1;
|
||||
if (buf2!=NULL)
|
||||
delete(buf2);
|
||||
buf2=new char[len-1];
|
||||
for(j=0;j<len;j++)
|
||||
buf2[j]=buf1[j];
|
||||
delete(buf1);
|
||||
}
|
||||
else
|
||||
len=1;
|
||||
|
||||
buf1 = new char[len+1];
|
||||
buf1[len] = *"\0";
|
||||
|
||||
for (j=0;j<len-1;j++)
|
||||
buf1[j]=buf2[j];
|
||||
buf1[len-1] = Comments[i];
|
||||
|
||||
if ((Comments[i] == *" ")||((i+1)==strlen(Comments)))
|
||||
{
|
||||
if (((gdk_string_width(fontComments,buf1)+10)>PixmapWidth)
|
||||
||((i+1)==strlen(Comments)))
|
||||
{
|
||||
n_comments++;
|
||||
if ((i+1)!=strlen(Comments))
|
||||
{
|
||||
len=strlen(buf1)-(i-n)-1;
|
||||
i=n;
|
||||
}
|
||||
else
|
||||
len=strlen(buf1)+1;
|
||||
|
||||
buf3 = new char[len];
|
||||
buf3[len] = *"\0";
|
||||
|
||||
for (j=0;j<len;j++)
|
||||
buf3[j]=buf1[j];
|
||||
|
||||
PixmapHeight=PixmapHeight+gdk_string_height(fontComments,buf3);
|
||||
|
||||
// g_print(buf3);
|
||||
// g_print("\n");
|
||||
delete(buf3);
|
||||
delete(buf1);
|
||||
buf1=NULL;
|
||||
delete(buf2);
|
||||
buf2=NULL;
|
||||
|
||||
}
|
||||
n=i;
|
||||
}
|
||||
}
|
||||
style = gtk_widget_get_style (about_dialog);
|
||||
/*about_pixmap =
|
||||
gdk_pixmap_new (about_dialog->window,PixmapWidth,PixmapHeight,
|
||||
-1);
|
||||
about_pixmapwid = gtk_pixmap_new (about_pixmap, mask);
|
||||
gdk_pixmap_unref(about_pixmap);
|
||||
gtk_widget_show (about_pixmapwid);
|
||||
gtk_container_add (GTK_CONTAINER (about_frame), about_pixmapwid);
|
||||
gtk_widget_show (about_pixmapwid);*/
|
||||
gtk_widget_set_usize (GTK_WIDGET (about_frame),PixmapWidth,PixmapHeight);
|
||||
//GTK_WIDGET (about_frame)->window;
|
||||
//GTK_WIDGET (about_frame)->style->black;
|
||||
//GTK_WIDGET (about_frame)t->style->white;
|
||||
GdkWindow *win = GTK_WIDGET(about_frame)->window;
|
||||
if (gc == NULL)
|
||||
gc = gdk_gc_new (win);
|
||||
gdk_gc_set_foreground (gc,&(GTK_WIDGET(about_frame)->style->black));
|
||||
gdk_gc_set_background (gc,&(GTK_WIDGET (about_frame)->style->black));
|
||||
gdk_draw_rectangle (GTK_WIDGET (about_frame)->window,gc,
|
||||
TRUE,3,3,PixmapWidth,PixmapHeight);
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
about_action_area = GTK_DIALOG (about_dialog)->action_area;
|
||||
gtk_widget_show (about_action_area);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (about_action_area), 5);
|
||||
|
||||
about_button = gtk_button_new_with_label (_(" OK "));
|
||||
gtk_box_pack_end (GTK_BOX (about_action_area), about_button, FALSE,
|
||||
FALSE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (about_button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (about_button), "clicked",
|
||||
GTK_SIGNAL_FUNC (on_about_ok), NULL);
|
||||
gtk_widget_grab_default (about_button);
|
||||
gtk_widget_show (about_button);
|
||||
|
||||
return (about_dialog);
|
||||
}
|
||||
|
||||
GtkWidget *create_open_dialog (void)
|
||||
{
|
||||
GtkWidget *open_dialog;
|
||||
GtkWidget *ok_button;
|
||||
GtkWidget *cancel_button;
|
||||
|
||||
|
||||
|
||||
open_dialog = gtk_file_selection_new (_("ïÔËÒÙÔÉÅ"));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (open_dialog), 10);
|
||||
|
||||
ok_button = GTK_FILE_SELECTION (open_dialog)->ok_button;
|
||||
gtk_widget_show (ok_button);
|
||||
GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);
|
||||
|
||||
cancel_button = GTK_FILE_SELECTION (open_dialog)->cancel_button;
|
||||
gtk_widget_show (cancel_button);
|
||||
GTK_WIDGET_SET_FLAGS (cancel_button, GTK_CAN_DEFAULT);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (open_dialog), "delete_event",
|
||||
GTK_SIGNAL_FUNC (on_open_dialog_delete), NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (ok_button), "clicked",
|
||||
GTK_SIGNAL_FUNC (on_open_dialog_ok), NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (cancel_button), "clicked",
|
||||
GTK_SIGNAL_FUNC (on_open_dialog_cancel), NULL);
|
||||
|
||||
return (open_dialog);
|
||||
}
|
||||
|
||||
GtkWidget *create_save_dialog (void)
|
||||
{
|
||||
GtkWidget *save_dialog;
|
||||
GtkWidget *ok_button;
|
||||
GtkWidget *cancel_button;
|
||||
|
||||
save_dialog = gtk_file_selection_new (_("óÏÈÒÁÎÅÎÉÅ"));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (save_dialog), 10);
|
||||
|
||||
ok_button = GTK_FILE_SELECTION (save_dialog)->ok_button;
|
||||
gtk_widget_show (ok_button);
|
||||
GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);
|
||||
|
||||
cancel_button = GTK_FILE_SELECTION (save_dialog)->cancel_button;
|
||||
gtk_widget_show (cancel_button);
|
||||
GTK_WIDGET_SET_FLAGS (cancel_button, GTK_CAN_DEFAULT);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (save_dialog), "delete_event",
|
||||
GTK_SIGNAL_FUNC (on_save_dialog_delete), NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (ok_button), "clicked",
|
||||
GTK_SIGNAL_FUNC (on_save_dialog_ok), NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (cancel_button), "clicked",
|
||||
GTK_SIGNAL_FUNC (on_save_dialog_cancel), NULL);
|
||||
|
||||
return (save_dialog);
|
||||
}
|
||||
|
||||
GtkWidget *create_pal_dialog (void)
|
||||
{
|
||||
GtkWidget *open_dialog;
|
||||
GtkWidget *ok_button;
|
||||
GtkWidget *cancel_button;
|
||||
|
||||
chdir ("/usr/local/share/graph2d/palettes");
|
||||
|
||||
open_dialog = gtk_file_selection_new (_("ïÔËÒÙÔÉÅ"));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (open_dialog), 10);
|
||||
|
||||
ok_button = GTK_FILE_SELECTION (open_dialog)->ok_button;
|
||||
gtk_widget_show (ok_button);
|
||||
GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);
|
||||
|
||||
cancel_button = GTK_FILE_SELECTION (open_dialog)->cancel_button;
|
||||
gtk_widget_show (cancel_button);
|
||||
GTK_WIDGET_SET_FLAGS (cancel_button, GTK_CAN_DEFAULT);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (open_dialog), "delete_event",
|
||||
GTK_SIGNAL_FUNC (on_open_dialog_delete), NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (ok_button), "clicked",
|
||||
GTK_SIGNAL_FUNC (on_pal_dialog_ok), NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (cancel_button), "clicked",
|
||||
GTK_SIGNAL_FUNC (on_open_dialog_cancel), NULL);
|
||||
|
||||
return (open_dialog);
|
||||
}
|
2
debug/readme
Normal file
2
debug/readme
Normal file
|
@ -0,0 +1,2 @@
|
|||
Для отладки скопируй в
|
||||
каталог ../src .
|
|
@ -19,25 +19,25 @@ static char * about_xpm[] = {
|
|||
"............................................................................................................................................................................................................................................................................",
|
||||
"............................................................................................................................................................................................................................................................................",
|
||||
"............................................................................................................................................................................................................................................................................",
|
||||
"...........................................................+++++++++++.+++............................+++++..................................+++..................++++++++..................................................................................................",
|
||||
"...........................................................+++++++++++.+++..........................+++++++++................................+++.........+++++....++++++++++...........+++..........+++++.......++++++++....................................................",
|
||||
"...............................................................+++.....+++.........................++++...+++................................+++........+++++++...+++....++++........+++++++.......+++++++......++++++++....................................................",
|
||||
"...............................................................+++.....+++.........................+++.....+++...............................+++.......+++...+++..+++.....+++........+++.+++......+++..+++......+++.........................................................",
|
||||
"...............................................................+++.....+++.++++......++++.........+++......+++..+++.++..+++++....+++.++++....+++.++++..+++...+++..+++......+++......+++...+++.....+++...++......+++.........................................................",
|
||||
"...............................................................+++.....+++++++++...+++++++........+++...........++++++.+++++++...+++++++++...+++++++++.......+++..+++......+++......+++...+++..........+++......+++++++.....................................................",
|
||||
"...............................................................+++.....++++..+++...+++..+++.......+++...........++++++.+++..+++..++++..+++...++++..+++......+++...+++......+++......+++...+++........++++.......++++++++....................................................",
|
||||
"...............................................................+++.....+++...+++..+++....++.......+++...++++++..+++........++++..+++....+++..+++...+++....+++++...+++......+++......+++...+++........+++++......+++..++++...................................................",
|
||||
"...............................................................+++.....+++...+++..+++++++++.......+++...++++++..+++......++++++..+++....+++..+++...+++...+++++....+++......+++......+++...+++..........++++...........+++...................................................",
|
||||
"...............................................................+++.....+++...+++..+++++++++.......+++......+++..+++.....+++.+++..+++....+++..+++...+++..++++......+++......+++......+++...+++...........+++...........+++...................................................",
|
||||
"...............................................................+++.....+++...+++..+++..............+++.....+++..+++....+++..+++..+++....+++..+++...+++..+++.......+++.....+++.......+++...+++.....+++...+++.....+++...+++...................................................",
|
||||
"...............................................................+++.....+++...+++...+++..+++........++++...++++..+++....+++..+++..++++..+++...+++...+++.+++........+++....++++........+++.+++...++.+++..++++..++.+++..++++...................................................",
|
||||
"...............................................................+++.....+++...+++...++++++++.........++++++++++..+++....++++++++..+++++++++...+++...+++.+++++++++..++++++++++.........+++++++...++..+++++++...++.++++++++....................................................",
|
||||
"...............................................................+++.....+++...+++.....++++............++++++.++..+++.....+++.+++..+++.++++....+++...+++.+++++++++..++++++++.............+++.....++...+++++....++..++++++.....................................................",
|
||||
".................................................................................................................................+++........................................................................................................................................",
|
||||
".................................................................................................................................+++........................................................................................................................................",
|
||||
".................................................................................................................................+++........................................................................................................................................",
|
||||
".................................................................................................................................+++........................................................................................................................................",
|
||||
"............................................................................................................................................................................................................................................................................",
|
||||
".........................................+++++++++++++.+++...............................++++++...................................+++...........++++++...++++++++...............++++.............++++.............++++......................................................",
|
||||
".........................................+++++++++++++.+++.............................++++++++++.................................+++..........++++++++..++++++++++...........++++++++.........++++++++.........++++++++....................................................",
|
||||
"..............................................+++......+++............................++++....++++................................+++.........++++..++++.+++....++++..........+++..+++.........+++..+++.........+++..+++....................................................",
|
||||
"..............................................+++......+++............................+++......+++................................+++.........+++....+++.+++.....+++.........+++....+++.......+++....+++.......+++....+++...................................................",
|
||||
"..............................................+++......+++++++........++++...........+++............++++++...+++++....+++++++.....+++++++............+++.+++......+++........+++....+++.......+++....+++.......+++....+++...................................................",
|
||||
"..............................................+++......+++++++++....++++++++.........+++............++++++..+++++++...+++++++++...+++++++++.........++++.+++......+++........+++....+++.............+++..............+++....................................................",
|
||||
"..............................................+++......++++..+++....+++..+++.........+++............++++...++++.++++..++++..+++...++++..+++........++++..+++......+++........+++....+++..........+++++............+++++.....................................................",
|
||||
"..............................................+++......+++....+++..+++....+++........+++.....+++++..+++..........+++..+++....+++..+++....+++.....+++++...+++......+++........+++....+++..........++++++...........++++++....................................................",
|
||||
"..............................................+++......+++....+++..++++++++++........+++.....+++++..+++.......++++++..+++....+++..+++....+++....++++.....+++......+++........+++....+++.............+++..............+++....................................................",
|
||||
"..............................................+++......+++....+++..++++++++++........+++.......+++..+++.....++++.+++..+++....+++..+++....+++...++++......+++......+++........+++....+++.......+++....+++.......+++....+++...................................................",
|
||||
"..............................................+++......+++....+++..+++................+++......+++..+++....+++...+++..+++....+++..+++....+++...+++.......+++.....+++.........+++....+++.......+++....+++.......+++....+++...................................................",
|
||||
"..............................................+++......+++....+++...+++...+++.........++++....++++..+++....+++..++++..++++..+++...+++....+++..+++........+++....++++..........+++..+++.........+++..+++.........+++..+++....................................................",
|
||||
"..............................................+++......+++....+++...++++++++...........+++++++++++..+++....++++++++++.+++++++++...+++....+++..++++++++++.++++++++++...........++++++++...+++...++++++++...+++...++++++++....................................................",
|
||||
"..............................................+++......+++....+++.....++++...............+++++++++..+++.....+++++.+++.+++++++.....+++....+++..++++++++++.++++++++...............++++.....+++.....++++.....+++.....++++......................................................",
|
||||
"......................................................................................................................+++...................................................................................................................................................",
|
||||
"......................................................................................................................+++...................................................................................................................................................",
|
||||
"......................................................................................................................+++...................................................................................................................................................",
|
||||
"......................................................................................................................+++...................................................................................................................................................",
|
||||
"............................................................................................................................................................................................................................................................................",
|
||||
"............................................................................................................................................................................................................................................................................",
|
||||
"............................................................................................................................................................................................................................................................................",
|
||||
|
|
176
pixmaps/inter.xpm
Normal file
176
pixmaps/inter.xpm
Normal file
|
@ -0,0 +1,176 @@
|
|||
/* XPM */
|
||||
static char * inter_xpm[] = {
|
||||
"24 24 149 2",
|
||||
" c None",
|
||||
". c #D8DACE",
|
||||
"+ c #D3D5D5",
|
||||
"@ c #CBCDDB",
|
||||
"# c #C2C4E0",
|
||||
"$ c #B9BBE3",
|
||||
"% c #DFE1C5",
|
||||
"& c #DCDFCA",
|
||||
"* c #D6D9CF",
|
||||
"= c #D0D3D5",
|
||||
"- c #C8CBDB",
|
||||
"; c #BFC1E0",
|
||||
"> c #B7B8E5",
|
||||
", c #AEB0E5",
|
||||
"' c #E1E5C5",
|
||||
") c #DFE2C9",
|
||||
"! c #DCDFCD",
|
||||
"~ c #D6D8D2",
|
||||
"{ c #CDD0D7",
|
||||
"] c #C5C8DE",
|
||||
"^ c #BBBEE3",
|
||||
"/ c #B2B4E4",
|
||||
"( c #A9AAE5",
|
||||
"_ c #A1A3E6",
|
||||
": c #E2E4CA",
|
||||
"< c #DFE1CE",
|
||||
"[ c #DBDDD1",
|
||||
"} c #D3D6D6",
|
||||
"| c #CCCEDB",
|
||||
"1 c #B6BAE4",
|
||||
"2 c #ADAFE6",
|
||||
"3 c #A4A6E6",
|
||||
"4 c #9B9EE4",
|
||||
"5 c #9495E0",
|
||||
"6 c #E1E3CF",
|
||||
"7 c #DFE2D0",
|
||||
"8 c #DCDFD2",
|
||||
"9 c #D8DAD7",
|
||||
"0 c #D1D3DB",
|
||||
"a c #C7CADF",
|
||||
"b c #BDC0E3",
|
||||
"c c #B2B4E5",
|
||||
"d c #A7AAE7",
|
||||
"e c #9EA0E6",
|
||||
"f c #9598E5",
|
||||
"g c #8F91E1",
|
||||
"h c #E0E2D7",
|
||||
"i c #DDDFD7",
|
||||
"j c #DADCD8",
|
||||
"k c #D4D6DC",
|
||||
"l c #CCCFDF",
|
||||
"m c #C2C4E2",
|
||||
"n c #B8BAE6",
|
||||
"o c #ACAEE8",
|
||||
"p c #A1A3E7",
|
||||
"q c #989BE7",
|
||||
"r c #8F90E3",
|
||||
"s c #878AE0",
|
||||
"t c #8385DD",
|
||||
"u c #DCDEDE",
|
||||
"v c #D9DCDD",
|
||||
"w c #D6D8DF",
|
||||
"x c #CFD2E2",
|
||||
"y c #C7C9E4",
|
||||
"z c #BCC0E6",
|
||||
"A c #B1B3E9",
|
||||
"B c #A6A8EA",
|
||||
"C c #9B9DEA",
|
||||
"D c #9093E7",
|
||||
"E c #888AE5",
|
||||
"F c #8284E2",
|
||||
"G c #7C7EDE",
|
||||
"H c #D7D9E3",
|
||||
"I c #D3D6E3",
|
||||
"J c #D0D2E4",
|
||||
"K c #CACCE7",
|
||||
"L c #C1C3E8",
|
||||
"M c #B7B9EB",
|
||||
"N c #ACAEEC",
|
||||
"O c #9FA1EC",
|
||||
"P c #9496EC",
|
||||
"Q c #8A8CEA",
|
||||
"R c #8283E7",
|
||||
"S c #7B7EE4",
|
||||
"T c #7678E0",
|
||||
"U c #D1D3EA",
|
||||
"V c #CECFE8",
|
||||
"W c #C9CBEA",
|
||||
"X c #C2C4EA",
|
||||
"Y c #BABCEC",
|
||||
"Z c #AFB2EE",
|
||||
"` c #A4A7EE",
|
||||
" . c #989AED",
|
||||
".. c #8C90ED",
|
||||
"+. c #8486EA",
|
||||
"@. c #7B7CE7",
|
||||
"#. c #7577E5",
|
||||
"$. c #7072E3",
|
||||
"%. c #C9CBEC",
|
||||
"&. c #C6C9ED",
|
||||
"*. c #C2C4ED",
|
||||
"=. c #BBBDEE",
|
||||
"-. c #B3B5EF",
|
||||
";. c #A8AAEF",
|
||||
">. c #9D9EF0",
|
||||
",. c #9192EF",
|
||||
"'. c #8688EF",
|
||||
"). c #7D7FEC",
|
||||
"!. c #7576E9",
|
||||
"~. c #6E71E6",
|
||||
"{. c #BEC1EF",
|
||||
"]. c #B9BBF0",
|
||||
"^. c #B3B4F0",
|
||||
"/. c #A9ABF0",
|
||||
"(. c #9FA2F1",
|
||||
"_. c #9596F1",
|
||||
":. c #8A8CF1",
|
||||
"<. c #7F81EE",
|
||||
"[. c #7578ED",
|
||||
"}. c #6F70E9",
|
||||
"|. c #696AE6",
|
||||
"1. c #B7B9F2",
|
||||
"2. c #B1B2F2",
|
||||
"3. c #AAADF2",
|
||||
"4. c #A2A4F1",
|
||||
"5. c #979AF0",
|
||||
"6. c #8E8FF0",
|
||||
"7. c #8384EF",
|
||||
"8. c #797BEF",
|
||||
"9. c #7071ED",
|
||||
"0. c #696BEC",
|
||||
"a. c #6365E7",
|
||||
"b. c #A9A9EF",
|
||||
"c. c #A2A4F0",
|
||||
"d. c #9A9BF1",
|
||||
"e. c #9091F0",
|
||||
"f. c #8788F0",
|
||||
"g. c #7C7EF0",
|
||||
"h. c #7275EF",
|
||||
"i. c #6A6DED",
|
||||
"j. c #6466EA",
|
||||
"k. c #9A9CF0",
|
||||
"l. c #9293EE",
|
||||
"m. c #8A8BEF",
|
||||
"n. c #8081EF",
|
||||
"o. c #7678ED",
|
||||
"p. c #6E70EE",
|
||||
"q. c #6769EB",
|
||||
"r. c #7B7BED",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" . + @ # $ ",
|
||||
" % & * = - ; > , ",
|
||||
" ' ) ! ~ { ] ^ / ( _ ",
|
||||
" : < [ } | # 1 2 3 4 5 ",
|
||||
" 6 7 8 9 0 a b c d e f g ",
|
||||
" h i j k l m n o p q r s t ",
|
||||
" u v w x y z A B C D E F G ",
|
||||
" H I J K L M N O P Q R S T ",
|
||||
" U V W X Y Z ` ...+.@.#.$. ",
|
||||
" %.&.*.=.-.;.>.,.'.).!.~. ",
|
||||
" {.].^./.(._.:.<.[.}.|. ",
|
||||
" 1.2.3.4.5.6.7.8.9.0.a. ",
|
||||
" b.c.d.e.f.g.h.i.j. ",
|
||||
" k.l.m.n.o.p.q. ",
|
||||
" r. ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
42
po/Makefile
Normal file
42
po/Makefile
Normal file
|
@ -0,0 +1,42 @@
|
|||
PACKAGE = graph2d
|
||||
SOURCES = $(shell grep -l '\<_\>' ../src/*.C)
|
||||
POFILES = $(wildcard *.po)
|
||||
POXFILES = $(POFILES:.po=.pox)
|
||||
MOFILES = $(POFILES:.po=.mo)
|
||||
|
||||
XGETTEXT = xgettext
|
||||
MSGMERGE = msgmerge --indent --verbose
|
||||
MSGFMT = msgfmt --check --statistics
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .po .mo
|
||||
|
||||
all: $(MOFILES)
|
||||
|
||||
install: all
|
||||
@echo Installing message catalogues in $(LOCDIR)
|
||||
@for c in $(MOFILES); do \
|
||||
LANG=`echo $$c|sed -e 's/.mo//'` ; \
|
||||
MSGDIR="$(LOCDIR)/$$LANG/LC_MESSAGES"; \
|
||||
echo Installing language: $$LANG ; \
|
||||
$(INSTALLDIR) $$MSGDIR; \
|
||||
$(INSTALLLIB) $$c $$MSGDIR/$(PACKAGE).mo; \
|
||||
done
|
||||
|
||||
$(PACKAGE).pot: POTFILES.in
|
||||
$(XGETTEXT) --default-domain=$(PACKAGE) --directory=../src \
|
||||
--add-comments --keyword=_ --keyword=N_ --msgstr-prefix="" \
|
||||
--msgstr-suffix="" --files-from=POTFILES.in
|
||||
|
||||
clean:
|
||||
rm -f $(MOFILES) *~
|
||||
|
||||
|
||||
merge: $(POXFILES)
|
||||
|
||||
%.pox: %.po $(PACKAGE).pot
|
||||
$(MSGMERGE) --indent --output-file $@ $< $(PACKAGE).pot
|
||||
|
||||
# convert portable into machine objects
|
||||
.po.mo:
|
||||
$(MSGFMT) -o $@ $<
|
2
po/POTFILES.in
Normal file
2
po/POTFILES.in
Normal file
|
@ -0,0 +1,2 @@
|
|||
interface.C
|
||||
callback.C
|
135
po/graph2d.po
Normal file
135
po/graph2d.po
Normal file
|
@ -0,0 +1,135 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR Free Software Foundation, Inc.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2001-12-03 14:00+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: ENCODING\n"
|
||||
|
||||
#: interface.C:53
|
||||
msgid "ðÒÏÇÒÁÍÍÁ Graph2D"
|
||||
msgstr "ðÒÏÇÒÁÍÍÁ Graph2D"
|
||||
|
||||
#: interface.C:68
|
||||
msgid "äÏÂÒÏ ÐÏÖÁÌÏ×ÁÔØ × Graph2D"
|
||||
msgstr "äÏÂÒÏ ÐÏÖÁÌÏ×ÁÔØ × Graph2D"
|
||||
|
||||
#: interface.C:80
|
||||
msgid "æÁÊÌ"
|
||||
msgstr "æÁÊÌ"
|
||||
|
||||
#: interface.C:87
|
||||
msgid "ïÔËÒÙÔØ..."
|
||||
msgstr "ïÔËÒÙÔØ..."
|
||||
|
||||
#: interface.C:96 interface.C:277 interface.C:278
|
||||
msgid "óÏÈÒÁÎÉÔØ"
|
||||
msgstr "óÏÈÒÁÎÉÔØ"
|
||||
|
||||
#: interface.C:107
|
||||
msgid "óÏÈÒÁÎÉÔØ ËÁË..."
|
||||
msgstr "óÏÈÒÁÎÉÔØ ËÁË..."
|
||||
|
||||
#: interface.C:115
|
||||
msgid "ðÁÌÉÔÒÁ..."
|
||||
msgstr "ðÁÌÉÔÒÁ..."
|
||||
|
||||
#: interface.C:127
|
||||
msgid "÷ÙÈÏÄ"
|
||||
msgstr "÷ÙÈÏÄ"
|
||||
|
||||
#: interface.C:136
|
||||
msgid "ðÒÏÓÍÏÔÒ"
|
||||
msgstr "ðÒÏÓÍÏÔÒ"
|
||||
|
||||
#: interface.C:144 interface.C:315 interface.C:316
|
||||
msgid "õ×ÅÌÉÞÉÔØ"
|
||||
msgstr "õ×ÅÌÉÞÉÔØ"
|
||||
|
||||
#: interface.C:152 interface.C:333 interface.C:334
|
||||
msgid "õÍÅÎØÛÉÔØ"
|
||||
msgstr "õÍÅÎØÛÉÔØ"
|
||||
|
||||
#: interface.C:164 interface.C:353 interface.C:354
|
||||
msgid "óÅÔËÁ"
|
||||
msgstr "óÅÔËÁ"
|
||||
|
||||
#: interface.C:173
|
||||
msgid "äÅÆÏÒÁÃÉÉ"
|
||||
msgstr "äÅÆÏÒÁÃÉÉ"
|
||||
|
||||
#: interface.C:181 interface.C:391 interface.C:392
|
||||
msgid "îÁÐÒÑÖÅÎÉÑ"
|
||||
msgstr "îÁÐÒÑÖÅÎÉÑ"
|
||||
|
||||
#: interface.C:189 interface.C:410 interface.C:411
|
||||
msgid "ðÏ×ÒÅÖÄÅÎ."
|
||||
msgstr "ðÏ×ÒÅÖÄÅÎ."
|
||||
|
||||
#: interface.C:201 interface.C:467 interface.C:468
|
||||
msgid "éÎÔÅÒÐÏÌÑÃÉÑ"
|
||||
msgstr "éÎÔÅÒÐÏÌÑÃÉÑ"
|
||||
|
||||
#: interface.C:208 interface.C:431 interface.C:432
|
||||
msgid "üÌÅÍÅÎÔÙ"
|
||||
msgstr "üÌÅÍÅÎÔÙ"
|
||||
|
||||
#: interface.C:215 interface.C:449 interface.C:450
|
||||
msgid "õÚÌÙ"
|
||||
msgstr "õÚÌÙ"
|
||||
|
||||
#: interface.C:222
|
||||
msgid "óÐÒÁ×ËÁ"
|
||||
msgstr "óÐÒÁ×ËÁ"
|
||||
|
||||
#: interface.C:229 interface.C:516
|
||||
msgid "ï ðÒÏÇÒÁÍÍÅ"
|
||||
msgstr "ï ðÒÏÇÒÁÍÍÅ"
|
||||
|
||||
#: interface.C:260 interface.C:261
|
||||
msgid "ïÔËÒÙÔØ"
|
||||
msgstr "ïÔËÒÙÔØ"
|
||||
|
||||
#: interface.C:295 interface.C:296
|
||||
msgid "ðÁÌÉÔÒÁ"
|
||||
msgstr "ðÁÌÉÔÒÁ"
|
||||
|
||||
#: interface.C:372 interface.C:373
|
||||
msgid "äÅÆÏÒÍÁÃÉÉ"
|
||||
msgstr "äÅÆÏÒÍÁÃÉÉ"
|
||||
|
||||
#: interface.C:544
|
||||
msgid " OK "
|
||||
msgstr " OK "
|
||||
|
||||
#: interface.C:562 interface.C:616
|
||||
msgid "ïÔËÒÙÔÉÅ"
|
||||
msgstr "ïÔËÒÙÔÉÅ"
|
||||
|
||||
#: interface.C:589
|
||||
msgid "óÏÈÒÁÎÅÎÉÅ"
|
||||
msgstr "óÏÈÒÁÎÅÎÉÅ"
|
||||
|
||||
#: callback.C:282
|
||||
msgid "ðÒÏÓÍÏÔÒ ÜÌÅÍÅÎÔÏ×"
|
||||
msgstr "ðÒÏÓÍÏÔÒ ÜÌÅÍÅÎÔÏ×"
|
||||
|
||||
#: callback.C:297
|
||||
msgid "ðÒÏÓÍÏÔÒ ÎÁÐÒÑÖÅÎÉÊ"
|
||||
msgstr "ðÒÏÓÍÏÔÒ ÎÁÐÒÑÖÅÎÉÊ"
|
||||
|
||||
#: callback.C:313
|
||||
msgid "ðÒÏÓÍÏÔÒ ÄÅÆÏÒÍÁÃÉÊ"
|
||||
msgstr "ðÒÏÓÍÏÔÒ ÄÅÆÏÒÍÁÃÉÊ"
|
||||
|
||||
#: callback.C:329
|
||||
msgid "ðÒÏÓÍÏÔÒ ÍÉËÒÏÔÒÅÝÉÎ"
|
||||
msgstr "ðÒÏÓÍÏÔÒ ÍÉËÒÏÔÒÅÝÉÎ"
|
135
po/ru.po
Normal file
135
po/ru.po
Normal file
|
@ -0,0 +1,135 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR Free Software Foundation, Inc.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2001-12-03 14:00+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: ENCODING\n"
|
||||
|
||||
#: interface.C:53
|
||||
msgid "ðÒÏÇÒÁÍÍÁ Graph2D"
|
||||
msgstr "ðÒÏÇÒÁÍÍÁ Graph2D"
|
||||
|
||||
#: interface.C:68
|
||||
msgid "äÏÂÒÏ ÐÏÖÁÌÏ×ÁÔØ × Graph2D"
|
||||
msgstr "äÏÂÒÏ ÐÏÖÁÌÏ×ÁÔØ × Graph2D"
|
||||
|
||||
#: interface.C:80
|
||||
msgid "æÁÊÌ"
|
||||
msgstr "æÁÊÌ"
|
||||
|
||||
#: interface.C:87
|
||||
msgid "ïÔËÒÙÔØ..."
|
||||
msgstr "ïÔËÒÙÔØ..."
|
||||
|
||||
#: interface.C:96 interface.C:277 interface.C:278
|
||||
msgid "óÏÈÒÁÎÉÔØ"
|
||||
msgstr "óÏÈÒÁÎÉÔØ"
|
||||
|
||||
#: interface.C:107
|
||||
msgid "óÏÈÒÁÎÉÔØ ËÁË..."
|
||||
msgstr "óÏÈÒÁÎÉÔØ ËÁË..."
|
||||
|
||||
#: interface.C:115
|
||||
msgid "ðÁÌÉÔÒÁ..."
|
||||
msgstr "ðÁÌÉÔÒÁ..."
|
||||
|
||||
#: interface.C:127
|
||||
msgid "÷ÙÈÏÄ"
|
||||
msgstr "÷ÙÈÏÄ"
|
||||
|
||||
#: interface.C:136
|
||||
msgid "ðÒÏÓÍÏÔÒ"
|
||||
msgstr "ðÒÏÓÍÏÔÒ"
|
||||
|
||||
#: interface.C:144 interface.C:315 interface.C:316
|
||||
msgid "õ×ÅÌÉÞÉÔØ"
|
||||
msgstr "õ×ÅÌÉÞÉÔØ"
|
||||
|
||||
#: interface.C:152 interface.C:333 interface.C:334
|
||||
msgid "õÍÅÎØÛÉÔØ"
|
||||
msgstr "õÍÅÎØÛÉÔØ"
|
||||
|
||||
#: interface.C:164 interface.C:353 interface.C:354
|
||||
msgid "óÅÔËÁ"
|
||||
msgstr "óÅÔËÁ"
|
||||
|
||||
#: interface.C:173
|
||||
msgid "äÅÆÏÒÁÃÉÉ"
|
||||
msgstr "äÅÆÏÒÁÃÉÉ"
|
||||
|
||||
#: interface.C:181 interface.C:391 interface.C:392
|
||||
msgid "îÁÐÒÑÖÅÎÉÑ"
|
||||
msgstr "îÁÐÒÑÖÅÎÉÑ"
|
||||
|
||||
#: interface.C:189 interface.C:410 interface.C:411
|
||||
msgid "ðÏ×ÒÅÖÄÅÎ."
|
||||
msgstr "ðÏ×ÒÅÖÄÅÎ."
|
||||
|
||||
#: interface.C:201 interface.C:467 interface.C:468
|
||||
msgid "éÎÔÅÒÐÏÌÑÃÉÑ"
|
||||
msgstr "éÎÔÅÒÐÏÌÑÃÉÑ"
|
||||
|
||||
#: interface.C:208 interface.C:431 interface.C:432
|
||||
msgid "üÌÅÍÅÎÔÙ"
|
||||
msgstr "üÌÅÍÅÎÔÙ"
|
||||
|
||||
#: interface.C:215 interface.C:449 interface.C:450
|
||||
msgid "õÚÌÙ"
|
||||
msgstr "õÚÌÙ"
|
||||
|
||||
#: interface.C:222
|
||||
msgid "óÐÒÁ×ËÁ"
|
||||
msgstr "óÐÒÁ×ËÁ"
|
||||
|
||||
#: interface.C:229 interface.C:516
|
||||
msgid "ï ðÒÏÇÒÁÍÍÅ"
|
||||
msgstr "ï ðÒÏÇÒÁÍÍÅ"
|
||||
|
||||
#: interface.C:260 interface.C:261
|
||||
msgid "ïÔËÒÙÔØ"
|
||||
msgstr "ïÔËÒÙÔØ"
|
||||
|
||||
#: interface.C:295 interface.C:296
|
||||
msgid "ðÁÌÉÔÒÁ"
|
||||
msgstr "ðÁÌÉÔÒÁ"
|
||||
|
||||
#: interface.C:372 interface.C:373
|
||||
msgid "äÅÆÏÒÍÁÃÉÉ"
|
||||
msgstr "äÅÆÏÒÍÁÃÉÉ"
|
||||
|
||||
#: interface.C:544
|
||||
msgid " OK "
|
||||
msgstr " OK "
|
||||
|
||||
#: interface.C:562 interface.C:616
|
||||
msgid "ïÔËÒÙÔÉÅ"
|
||||
msgstr "ïÔËÒÙÔÉÅ"
|
||||
|
||||
#: interface.C:589
|
||||
msgid "óÏÈÒÁÎÅÎÉÅ"
|
||||
msgstr "óÏÈÒÁÎÅÎÉÅ"
|
||||
|
||||
#: callback.C:282
|
||||
msgid "ðÒÏÓÍÏÔÒ ÜÌÅÍÅÎÔÏ×"
|
||||
msgstr "ðÒÏÓÍÏÔÒ ÜÌÅÍÅÎÔÏ×"
|
||||
|
||||
#: callback.C:297
|
||||
msgid "ðÒÏÓÍÏÔÒ ÎÁÐÒÑÖÅÎÉÊ"
|
||||
msgstr "ðÒÏÓÍÏÔÒ ÎÁÐÒÑÖÅÎÉÊ"
|
||||
|
||||
#: callback.C:313
|
||||
msgid "ðÒÏÓÍÏÔÒ ÄÅÆÏÒÍÁÃÉÊ"
|
||||
msgstr "ðÒÏÓÍÏÔÒ ÄÅÆÏÒÍÁÃÉÊ"
|
||||
|
||||
#: callback.C:329
|
||||
msgid "ðÒÏÓÍÏÔÒ ÍÉËÒÏÔÒÅÝÉÎ"
|
||||
msgstr "ðÒÏÓÍÏÔÒ ÍÉËÒÏÔÒÅÝÉÎ"
|
12
src/Makefile
Normal file
12
src/Makefile
Normal file
|
@ -0,0 +1,12 @@
|
|||
GTK_LIBS = -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk -rdynamic -lgmodule \
|
||||
-lglib -ldl -lXi -lXext -lX11 -lm -lgdk_imlib
|
||||
OBJECTS = graph2d.o interface.o callback.o drawelem.o
|
||||
CFLAGS =-I/usr/lib/glib/include -I/usr/X11R6/include
|
||||
CC=g++
|
||||
All: $(OBJECTS)
|
||||
$(CC) -o graph2d $(GTK_LIBS) $(OBJECTS)
|
||||
clean:
|
||||
rm -f *.o graph2d
|
||||
|
||||
install:
|
||||
cp graph2d /usr/local/bin
|
|
@ -1,4 +1,7 @@
|
|||
#include "callback.h"
|
||||
#include "intl.h"
|
||||
static char *dirname = NULL;
|
||||
|
||||
char *savename = "";
|
||||
GtkWidget *lookup_widget (GtkWidget * widget, const gchar * widget_name)
|
||||
{
|
||||
|
@ -46,7 +49,10 @@ void on_open_dialog (GtkWidget * widget, gpointer Data)
|
|||
GtkWidget *drawelem;
|
||||
|
||||
drawelem = lookup_widget (widget, "drawelem");
|
||||
|
||||
|
||||
if (dirname!=NULL)
|
||||
chdir(dirname);
|
||||
|
||||
opendialog = create_open_dialog ();
|
||||
|
||||
gtk_object_set_data (GTK_OBJECT (opendialog), "drawelem", drawelem);
|
||||
|
@ -63,10 +69,9 @@ void on_open_dialog_ok (GtkWidget * widget, gpointer Data)
|
|||
GtkWidget *button;
|
||||
GtkWidget *menuitem;
|
||||
static char *filename = NULL;
|
||||
static char *dirname = NULL;
|
||||
|
||||
int i, j;
|
||||
|
||||
|
||||
|
||||
filesel = gtk_widget_get_toplevel (GTK_WIDGET (widget));
|
||||
gtk_widget_hide (filesel);
|
||||
|
||||
|
@ -76,7 +81,9 @@ void on_open_dialog_ok (GtkWidget * widget, gpointer Data)
|
|||
if (filename[i] == *"/")
|
||||
break;
|
||||
i++;
|
||||
|
||||
|
||||
if (dirname==NULL)
|
||||
delete(dirname);
|
||||
dirname = new char[i];
|
||||
|
||||
for (j = 0; j < i; j++)
|
||||
|
@ -132,6 +139,9 @@ void on_open_dialog_ok (GtkWidget * widget, gpointer Data)
|
|||
|
||||
button = lookup_widget (menuitem, "button_knot");
|
||||
gtk_widget_set_sensitive (button, TRUE);
|
||||
|
||||
button = lookup_widget (menuitem, "button_inter");
|
||||
gtk_widget_set_sensitive (button, TRUE);
|
||||
}
|
||||
|
||||
void on_open_dialog_cancel (GtkWidget * widget, gpointer Data)
|
||||
|
@ -251,7 +261,6 @@ void on_pal_dialog_ok (GtkWidget * widget, gpointer Data)
|
|||
static char *filename = NULL;
|
||||
int i, j;
|
||||
|
||||
|
||||
filesel = gtk_widget_get_toplevel (GTK_WIDGET (widget));
|
||||
gtk_widget_hide (filesel);
|
||||
|
||||
|
@ -274,7 +283,7 @@ void on_setka (GtkWidget * widget, gpointer Data)
|
|||
|
||||
status_bar = lookup_widget (widget, "statusbar");
|
||||
gtk_statusbar_push (GTK_STATUSBAR (status_bar), 1,
|
||||
"Просмотр элементов");
|
||||
_("ðÒÏÓÍÏÔÒ ÜÌÅÍÅÎÔÏ×"));
|
||||
|
||||
draw = lookup_widget (widget, "drawelem");
|
||||
drawelem_set (0);
|
||||
|
@ -289,10 +298,12 @@ void on_nap (GtkWidget * widget, gpointer Data)
|
|||
|
||||
status_bar = lookup_widget (widget, "statusbar");
|
||||
gtk_statusbar_push (GTK_STATUSBAR (status_bar), 1,
|
||||
"Просмотр напряжений");
|
||||
_("ðÒÏÓÍÏÔÒ ÎÁÐÒÑÖÅÎÉÊ"));
|
||||
|
||||
draw = lookup_widget (widget, "drawelem");
|
||||
drawelem_set (1);
|
||||
if (dirname!=NULL)
|
||||
chdir(dirname);
|
||||
drawelem_load_nds (DRAWELEM (draw), "sg_na.poc");
|
||||
drawelem_fit (DRAWELEM (draw));
|
||||
|
||||
|
@ -305,10 +316,12 @@ void on_def (GtkWidget * widget, gpointer Data)
|
|||
|
||||
status_bar = lookup_widget (widget, "statusbar");
|
||||
gtk_statusbar_push (GTK_STATUSBAR (status_bar), 1,
|
||||
"Просмотр деформаций");
|
||||
_("ðÒÏÓÍÏÔÒ ÄÅÆÏÒÍÁÃÉÊ"));
|
||||
|
||||
draw = lookup_widget (widget, "drawelem");
|
||||
drawelem_set (2);
|
||||
if (dirname!=NULL)
|
||||
chdir(dirname);
|
||||
drawelem_load_nds (DRAWELEM (draw), "na_df.poc");
|
||||
drawelem_fit (DRAWELEM (draw));
|
||||
|
||||
|
@ -321,10 +334,12 @@ void on_mtr (GtkWidget * widget, gpointer Data)
|
|||
|
||||
status_bar = lookup_widget (widget, "statusbar");
|
||||
gtk_statusbar_push (GTK_STATUSBAR (status_bar), 1,
|
||||
"Просмотр микротрещин");
|
||||
_("ðÒÏÓÍÏÔÒ ÍÉËÒÏÔÒÅÝÉÎ"));
|
||||
|
||||
draw = lookup_widget (widget, "drawelem");
|
||||
drawelem_set (3);
|
||||
if (dirname!=NULL)
|
||||
chdir(dirname);
|
||||
drawelem_load_nds (DRAWELEM (draw), "ntg.poc");
|
||||
drawelem_fit (DRAWELEM (draw));
|
||||
|
||||
|
@ -348,6 +363,16 @@ void on_knot (GtkWidget * widget, gpointer Data)
|
|||
drawelem_fit (DRAWELEM (draw));
|
||||
}
|
||||
|
||||
void on_inter (GtkWidget * widget, gpointer Data)
|
||||
{
|
||||
GtkWidget *draw;
|
||||
|
||||
draw = lookup_widget (widget, "drawelem");
|
||||
drawelem_inter ();
|
||||
drawelem_fit (DRAWELEM (draw));
|
||||
}
|
||||
|
||||
|
||||
void on_menu_setka (GtkWidget * widget, gpointer Data)
|
||||
{
|
||||
GtkWidget *button;
|
||||
|
@ -544,4 +569,46 @@ void on_button_knot (GtkWidget * widget, gpointer Data)
|
|||
}
|
||||
}
|
||||
|
||||
void on_menu_inter (GtkWidget * widget, gpointer Data)
|
||||
{
|
||||
|
||||
GtkWidget *button;
|
||||
button = lookup_widget (widget, "button_inter");
|
||||
if (GTK_CHECK_MENU_ITEM (widget)->active == TRUE) {
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) ==
|
||||
FALSE) {
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
TRUE);
|
||||
return;
|
||||
}
|
||||
on_inter (widget, Data);
|
||||
} else {
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) ==
|
||||
TRUE) {
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
FALSE);
|
||||
return;
|
||||
}
|
||||
on_inter (widget, Data);
|
||||
}
|
||||
}
|
||||
|
||||
void on_button_inter (GtkWidget * widget, gpointer Data)
|
||||
{
|
||||
GtkWidget *item;
|
||||
item = lookup_widget (widget, "menu_inter");
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active == TRUE) {
|
||||
if (GTK_CHECK_MENU_ITEM (item)->active == FALSE) {
|
||||
gtk_menu_item_activate (GTK_MENU_ITEM (item));
|
||||
return;
|
||||
}
|
||||
on_inter (widget, Data);
|
||||
} else {
|
||||
if (GTK_CHECK_MENU_ITEM (item)->active == TRUE) {
|
||||
gtk_menu_item_activate (GTK_MENU_ITEM (item));
|
||||
return;
|
||||
}
|
||||
on_inter (widget, Data);
|
||||
}
|
||||
}
|
||||
|
|
@ -31,6 +31,7 @@ void on_def (GtkWidget * widget, gpointer Data);
|
|||
|
||||
void on_elem (GtkWidget * widget, gpointer Data);
|
||||
void on_knot (GtkWidget * widget, gpointer Data);
|
||||
void on_inter (GtkWidget * widget, gpointer Data);
|
||||
|
||||
void on_menu_setka (GtkWidget * widget, gpointer Data);
|
||||
void on_button_setka (GtkWidget * widget, gpointer Data);
|
||||
|
@ -46,4 +47,7 @@ void on_button_elem (GtkWidget * widget, gpointer Data);
|
|||
|
||||
void on_menu_knot (GtkWidget * widget, gpointer Data);
|
||||
void on_button_knot (GtkWidget * widget, gpointer Data);
|
||||
|
||||
void on_menu_inter (GtkWidget * widget, gpointer Data);
|
||||
void on_button_inter (GtkWidget * widget, gpointer Data);
|
||||
#endif
|
|
@ -1,6 +1,5 @@
|
|||
#include "drawelem.h"
|
||||
#include "colormap.h"
|
||||
|
||||
GdkColor *color_pal = NULL;
|
||||
int ncolor_pal = 0;
|
||||
int sdn = 0;
|
||||
|
@ -9,6 +8,11 @@ int sknot = 0;
|
|||
static void drawelem_class_init (DrawElemClass * klass);
|
||||
static void drawelem_init (DrawElem * det);
|
||||
|
||||
// îÕÖÎÏ ÄÌÑ ÉÎÔÅÒÐÏÌÑÃÉÉ
|
||||
float *nds_knot;
|
||||
int *nds_knotn;
|
||||
int sinter = 0;
|
||||
|
||||
void drawelem_show_nelem (void)
|
||||
{
|
||||
if (selem == 0)
|
||||
|
@ -17,6 +21,14 @@ void drawelem_show_nelem (void)
|
|||
selem = 0;
|
||||
}
|
||||
|
||||
void drawelem_inter (void)
|
||||
{
|
||||
if (sinter == 0)
|
||||
sinter = 1;
|
||||
else
|
||||
sinter = 0;
|
||||
}
|
||||
|
||||
void drawelem_show_nknot (void)
|
||||
{
|
||||
if (sknot == 0)
|
||||
|
@ -80,6 +92,49 @@ char *float_to_char (float n)
|
|||
return (st);
|
||||
}
|
||||
|
||||
float area_triangle (float x1, float y1, float x2, float y2, float x3,
|
||||
float y3)
|
||||
{
|
||||
float s = (x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2;
|
||||
if (s < 0)
|
||||
s = s * (-1);
|
||||
return (s);
|
||||
}
|
||||
|
||||
float len (float x1, float y1, float x2, float y2)
|
||||
{
|
||||
return (sqrt ((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)));
|
||||
}
|
||||
|
||||
float koef (float x1, float y1, float x2, float y2, float x3, float y3,
|
||||
float x4, float y4)
|
||||
{
|
||||
float b1, c1, b2, c2, x, y;
|
||||
|
||||
if ((x1 - x2) != 0)
|
||||
b1 = (y1 - y2) / (x1 - x2);
|
||||
else
|
||||
b1 = (y1 - y2) / (0.0000001);
|
||||
c1 = y1 - b1 * x1;
|
||||
|
||||
if ((x3 - x4) != 0)
|
||||
b2 = (y3 - y4) / (x3 - x4);
|
||||
else
|
||||
b2 = (y3 - y4) / (0.0000001);
|
||||
c2 = y3 - b2 * x3;
|
||||
|
||||
if ((b1 - b2) != 0)
|
||||
x = (c2 - c1) / (b1 - b2);
|
||||
else
|
||||
x = (c2 - c1) / (0.0000001);
|
||||
y = b1 * x + c1;
|
||||
|
||||
if (len (x2, y2, x, y) != 0)
|
||||
return (len (x1, y1, x, y) / len (x2, y2, x, y));
|
||||
else
|
||||
return (len (x1, y1, x, y) / 0.0000001);
|
||||
}
|
||||
|
||||
void drawelem_size (DrawElem * de, gint width, gint height)
|
||||
{
|
||||
gtk_drawing_area_size (GTK_DRAWING_AREA (de), width, height);
|
||||
|
@ -92,10 +147,10 @@ static gint configure_event (GtkWidget * widget, GdkEventConfigure * event)
|
|||
if (DRAWELEM (widget)->pixmap != NULL)
|
||||
gdk_pixmap_unref (DRAWELEM (widget)->pixmap);
|
||||
DRAWELEM (widget)->pixmap = gdk_pixmap_new (widget->window,
|
||||
widget->allocation.
|
||||
width,
|
||||
widget->allocation.
|
||||
height, -1);
|
||||
widget->
|
||||
allocation.width,
|
||||
widget->
|
||||
allocation.height, -1);
|
||||
|
||||
gdk_draw_rectangle (DRAWELEM (widget)->pixmap,
|
||||
widget->style->white_gc,
|
||||
|
@ -238,7 +293,11 @@ void drawelem_show_elem (DrawElem * det)
|
|||
int colline;
|
||||
int width, height;
|
||||
char *text = NULL;
|
||||
|
||||
// ðÅÒÅÍÅÎÎÙÅ ÄÌÑ ÉÎÔÅÒÐÏÌÑÃÉÉ
|
||||
int max_Y, min_Y, k, max_X, min_X, l, m, n, j;
|
||||
float S1, S2, nd;
|
||||
float kx[3];
|
||||
|
||||
colormap = gdk_colormap_get_system ();
|
||||
|
||||
if (color_pal == NULL)
|
||||
|
@ -262,38 +321,182 @@ void drawelem_show_elem (DrawElem * det)
|
|||
/* ÷Ů×ĎÄ ÓĹÔËÉ ÉĚÉ ÚÁĚÉ×ËÁ ÚÁÇĎÔĎ×ËÉ */
|
||||
for (i = 0; i < det->nelem; i++) {
|
||||
if (sdn != 0) {
|
||||
num = int ((det->nds[i] - minn) / inter);
|
||||
if ((inter * num) > (det->nds[i] - minn))
|
||||
num--;
|
||||
if (color_pal == NULL)
|
||||
colorgc =
|
||||
color_to_gc (GTK_WIDGET (det), &default_color[num],
|
||||
colormap);
|
||||
else
|
||||
colorgc =
|
||||
color_to_gc (GTK_WIDGET (det), &color_pal[num],
|
||||
colormap);
|
||||
if (sinter == 0) {
|
||||
num = int ((det->nds[i] - minn) / inter);
|
||||
if ((inter * num) > (det->nds[i] - minn))
|
||||
num--;
|
||||
if (color_pal == NULL)
|
||||
colorgc =
|
||||
color_to_gc (GTK_WIDGET (det), &default_color[num],
|
||||
colormap);
|
||||
else
|
||||
colorgc =
|
||||
color_to_gc (GTK_WIDGET (det), &color_pal[num],
|
||||
colormap);
|
||||
|
||||
draw_triangle (det->pixmap, colorgc, TRUE,
|
||||
int (det->mash *
|
||||
det->knot_x[det->elem[0][i] - 1]) +
|
||||
det->zero_x,
|
||||
-int (det->mash *
|
||||
det->knot_y[det->elem[0][i] - 1]) +
|
||||
det->zero_y,
|
||||
int (det->mash *
|
||||
det->knot_x[det->elem[1][i] - 1]) +
|
||||
det->zero_x,
|
||||
-int (det->mash *
|
||||
det->knot_y[det->elem[1][i] - 1]) +
|
||||
det->zero_y,
|
||||
int (det->mash *
|
||||
det->knot_x[det->elem[2][i] - 1]) +
|
||||
det->zero_x,
|
||||
-int (det->mash *
|
||||
det->knot_y[det->elem[2][i] - 1]) +
|
||||
det->zero_y);
|
||||
gdk_gc_unref (colorgc);
|
||||
draw_triangle (det->pixmap, colorgc, TRUE,
|
||||
int (det->mash *
|
||||
det->knot_x[det->elem[0][i] - 1]) +
|
||||
det->zero_x,
|
||||
-int (det->mash *
|
||||
det->knot_y[det->elem[0][i] - 1]) +
|
||||
det->zero_y,
|
||||
int (det->mash *
|
||||
det->knot_x[det->elem[1][i] - 1]) +
|
||||
det->zero_x,
|
||||
-int (det->mash *
|
||||
det->knot_y[det->elem[1][i] - 1]) +
|
||||
det->zero_y,
|
||||
int (det->mash *
|
||||
det->knot_x[det->elem[2][i] - 1]) +
|
||||
det->zero_x,
|
||||
-int (det->mash *
|
||||
det->knot_y[det->elem[2][i] - 1]) +
|
||||
det->zero_y);
|
||||
gdk_gc_unref (colorgc);
|
||||
} else {
|
||||
|
||||
max_Y = int (det->knot_y[det->elem[0][i] - 1] * det->mash);
|
||||
min_Y = int (det->knot_y[det->elem[0][i] - 1] * det->mash);
|
||||
max_X = int (det->knot_x[det->elem[0][i] - 1] * det->mash);
|
||||
min_X = int (det->knot_x[det->elem[0][i] - 1] * det->mash);
|
||||
|
||||
for (j = 1; j < 3; j++) {
|
||||
if (int (det->knot_y[det->elem[j][i] - 1] * det->mash)
|
||||
> max_Y)
|
||||
max_Y =
|
||||
int (det->knot_y[det->elem[j][i] - 1] *
|
||||
det->mash);
|
||||
if (int (det->knot_y[det->elem[j][i] - 1] * det->mash)
|
||||
< min_Y)
|
||||
min_Y =
|
||||
int (det->knot_y[det->elem[j][i] - 1] *
|
||||
det->mash);
|
||||
|
||||
if (int (det->knot_x[det->elem[j][i] - 1] * det->mash)
|
||||
> max_X)
|
||||
max_X =
|
||||
int (det->knot_x[det->elem[j][i] - 1] *
|
||||
det->mash);
|
||||
if (int (det->knot_x[det->elem[j][i] - 1] * det->mash)
|
||||
< min_X)
|
||||
min_X =
|
||||
int (det->knot_x[det->elem[j][i] - 1] *
|
||||
det->mash);
|
||||
}
|
||||
|
||||
for (j = min_Y; j <= max_Y; j++)
|
||||
for (k = min_X; k <= max_X; k++) {
|
||||
S1 =
|
||||
area_triangle (
|
||||
(det->
|
||||
knot_x[det->elem[0][i] -
|
||||
1] * det->mash),
|
||||
(det->
|
||||
knot_y[det->elem[0][i] -
|
||||
1] * det->mash),
|
||||
(det->
|
||||
knot_x[det->elem[1][i] -
|
||||
1] * det->mash),
|
||||
(det->
|
||||
knot_y[det->elem[1][i] -
|
||||
1] * det->mash),
|
||||
(det->
|
||||
knot_x[det->elem[2][i] -
|
||||
1] * det->mash),
|
||||
(det->
|
||||
knot_y[det->elem[2][i] -
|
||||
1] * det->mash));
|
||||
S2 = 0;
|
||||
for (l = 0; l < 3; l++) {
|
||||
m = l + 1;
|
||||
if (m > 2)
|
||||
m = 0;
|
||||
S2 =
|
||||
S2 +
|
||||
area_triangle (
|
||||
(det->
|
||||
knot_x[det->elem[l][i] -
|
||||
1] * det->mash),
|
||||
(det->
|
||||
knot_y[det->elem[l][i] -
|
||||
1] * det->mash),
|
||||
(det->
|
||||
knot_x[det->elem[m][i] -
|
||||
1] * det->mash),
|
||||
(det->
|
||||
knot_y[det->elem[m][i] -
|
||||
1] * det->mash), k,
|
||||
j);
|
||||
|
||||
}
|
||||
|
||||
nd = S2 - S1;
|
||||
if (nd < 0)
|
||||
nd = nd * (-1);
|
||||
|
||||
if (nd < 0.3) {
|
||||
|
||||
for (l = 0; l < 3; l++) {
|
||||
m = l + 1;
|
||||
n = m + 1;
|
||||
|
||||
if (m > 2)
|
||||
m = m - 3;
|
||||
if (n > 2)
|
||||
n = n - 3;
|
||||
|
||||
kx[l] = koef (k, j,
|
||||
(det->
|
||||
knot_x[det->elem[l][i] -
|
||||
1] * det->mash),
|
||||
(det->
|
||||
knot_y[det->elem[l][i] -
|
||||
1] * det->mash),
|
||||
(det->
|
||||
knot_x[det->elem[m][i] -
|
||||
1] * det->mash),
|
||||
(det->
|
||||
knot_y[det->elem[m][i] -
|
||||
1] * det->mash),
|
||||
(det->
|
||||
knot_x[det->elem[n][i] -
|
||||
1] * det->mash),
|
||||
(det->
|
||||
knot_y[det->elem[n][i] -
|
||||
1] * det->mash));
|
||||
}
|
||||
|
||||
nd = 0;
|
||||
|
||||
for (l = 0; l < 3; l++)
|
||||
nd =
|
||||
nd + kx[l] * nds_knot[det->elem[l][i] -
|
||||
1];
|
||||
|
||||
num = int ((nd - minn) / inter);
|
||||
|
||||
if ((inter * num) > (nd - minn))
|
||||
num--;
|
||||
if (color_pal == NULL)
|
||||
colorgc =
|
||||
color_to_gc (GTK_WIDGET (det),
|
||||
&default_color[num],
|
||||
colormap);
|
||||
else
|
||||
colorgc =
|
||||
color_to_gc (GTK_WIDGET (det),
|
||||
&color_pal[num],
|
||||
colormap);
|
||||
|
||||
gdk_draw_point (det->pixmap, colorgc,
|
||||
k + det->zero_x,
|
||||
-j + det->zero_y);
|
||||
|
||||
gdk_gc_unref (colorgc);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
draw_triangle (det->pixmap, GTK_WIDGET (det)->style->black_gc,
|
||||
FALSE,
|
||||
|
@ -594,6 +797,30 @@ void drawelem_load_nds (DrawElem * det, char *path)
|
|||
fgets (s, 80, fd);
|
||||
}
|
||||
fclose (fd);
|
||||
|
||||
// îÕÖÎÏ ÄÌÑ ÉÎÔÅÒÐÏÌÑÃÉÉ
|
||||
if (nds_knot != NULL)
|
||||
delete (nds_knot);
|
||||
nds_knot = new float[det->nknot];
|
||||
|
||||
if (nds_knotn != NULL)
|
||||
delete (nds_knotn);
|
||||
nds_knotn = new int[det->nknot];
|
||||
for (i = 0; i < (det->nknot); i++) {
|
||||
nds_knotn[i] = 0;
|
||||
nds_knot[i] = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < (det->nelem); i++)
|
||||
for (n = 0; n < 3; n++) {
|
||||
nds_knot[det->elem[n][i]-1] =
|
||||
det->nds[i] + nds_knot[det->elem[n][i]-1];
|
||||
nds_knotn[det->elem[n][i]-1]++;
|
||||
}
|
||||
|
||||
for (i = 0; i < (det->nknot); i++)
|
||||
nds_knot[i] = nds_knot[i] / nds_knotn[i];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -628,6 +855,7 @@ void drawelem_load_all (DrawElem * det, char *path)
|
|||
drawelem_load_nds (det, "ntg.poc");
|
||||
drawelem_fit (det);
|
||||
}
|
||||
|
||||
void drawelem_save (DrawElem * det, char *path)
|
||||
{
|
||||
GdkImlibImage *image;
|
|
@ -48,4 +48,5 @@ void drawelem_show_nelem (void);
|
|||
void drawelem_show_nknot (void);
|
||||
void draw_nknot (DrawElem * det);
|
||||
void draw_nelem (DrawElem * det);
|
||||
void drawelem_inter (void);
|
||||
#endif
|
|
@ -16,11 +16,19 @@
|
|||
#include <gdk_imlib.h>
|
||||
#include "interface.h"
|
||||
#include "callback.h"
|
||||
#include <locale.h>
|
||||
#include "intl.h"
|
||||
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
|
||||
GtkWidget *main_window;
|
||||
|
||||
setlocale(LC_ALL,"");
|
||||
bindtextdomain("graph2d", "/usr/local/share/locale");
|
||||
textdomain("graph2d");
|
||||
gtk_set_locale ();
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
gdk_imlib_init ();
|
||||
|
|
@ -1,17 +1,7 @@
|
|||
#include "interface.h"
|
||||
#include "pixmaps/about.xpm"
|
||||
#include "pixmaps/open.xpm"
|
||||
#include "pixmaps/save.xpm"
|
||||
#include "pixmaps/pal.xpm"
|
||||
#include "pixmaps/zoomin.xpm"
|
||||
#include "pixmaps/zoomout.xpm"
|
||||
#include "pixmaps/elem.xpm"
|
||||
#include "pixmaps/knot.xpm"
|
||||
#include "pixmaps/setka.xpm"
|
||||
#include "pixmaps/epsilon.xpm"
|
||||
#include "pixmaps/sigma.xpm"
|
||||
#include "pixmaps/trech.xpm"
|
||||
|
||||
#include "pixmaps.h"
|
||||
#include "intl.h"
|
||||
#include <stdlib.h>
|
||||
GtkWidget *create_main_window (void)
|
||||
{
|
||||
GtkWidget *main_window;
|
||||
|
@ -44,11 +34,13 @@ GtkWidget *create_main_window (void)
|
|||
GtkWidget *button_n;
|
||||
GtkWidget *button_m;
|
||||
|
||||
chdir (getenv("HOME"));
|
||||
|
||||
accel_group = gtk_accel_group_new ();
|
||||
|
||||
main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_default_size (GTK_WINDOW (main_window), 500, 400);
|
||||
gtk_window_set_title (GTK_WINDOW (main_window), "ðÒÏÇÒÁÍÍÁ Graph2D");
|
||||
gtk_window_set_title (GTK_WINDOW (main_window), _("đŇĎÇŇÁÍÍÁ Graph2D"));
|
||||
gtk_signal_connect (GTK_OBJECT (main_window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (on_close_main_window), NULL);
|
||||
gtk_widget_show (main_window);
|
||||
|
@ -63,7 +55,7 @@ GtkWidget *create_main_window (void)
|
|||
gtk_box_pack_end (GTK_BOX (main_vbox), main_statusbar, FALSE, FALSE,
|
||||
0);
|
||||
gtk_statusbar_push (GTK_STATUSBAR (main_statusbar), 1,
|
||||
"äÏÂÒÏ ÐÏÖÁÌÏ×ÁÔØ × Graph2D");
|
||||
_("äĎÂŇĎ ĐĎÖÁĚĎ×ÁÔŘ × Graph2D"));
|
||||
gtk_widget_show (main_statusbar);
|
||||
|
||||
menu_handlebox = gtk_handle_box_new ();
|
||||
|
@ -75,14 +67,14 @@ GtkWidget *create_main_window (void)
|
|||
gtk_container_add (GTK_CONTAINER (menu_handlebox), menubar);
|
||||
gtk_widget_show (menubar);
|
||||
|
||||
item_menu = gtk_menu_item_new_with_label ("æÁÊÌ");
|
||||
item_menu = gtk_menu_item_new_with_label (_("ćÁĘĚ"));
|
||||
gtk_container_add (GTK_CONTAINER (menubar), item_menu);
|
||||
gtk_widget_show (item_menu);
|
||||
|
||||
main_menu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item_menu), main_menu);
|
||||
|
||||
item = gtk_menu_item_new_with_label ("ïÔËÒÙÔØ...");
|
||||
item = gtk_menu_item_new_with_label (_("ďÔËŇŮÔŘ..."));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_O, GDK_CONTROL_MASK,
|
||||
|
@ -91,7 +83,7 @@ GtkWidget *create_main_window (void)
|
|||
GTK_SIGNAL_FUNC (on_open_dialog), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_menu_item_new_with_label ("óÏÈÒÁÎÉÔØ");
|
||||
item = gtk_menu_item_new_with_label (_("óĎČŇÁÎÉÔŘ"));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "save", item);
|
||||
gtk_widget_set_sensitive (item, FALSE);
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
|
@ -102,7 +94,7 @@ GtkWidget *create_main_window (void)
|
|||
GTK_SIGNAL_FUNC (on_save_dialog), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_menu_item_new_with_label ("óÏÈÒÁÎÉÔØ ËÁË...");
|
||||
item = gtk_menu_item_new_with_label (_("óĎČŇÁÎÉÔŘ ËÁË..."));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "saveas", item);
|
||||
gtk_widget_set_sensitive (item, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
|
@ -110,7 +102,7 @@ GtkWidget *create_main_window (void)
|
|||
GTK_SIGNAL_FUNC (on_saveas_dialog), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_menu_item_new_with_label ("ðÁÌÉÔÒÁ...");
|
||||
item = gtk_menu_item_new_with_label (_("đÁĚÉÔŇÁ..."));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "pal", item);
|
||||
gtk_widget_set_sensitive (item, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
|
@ -122,7 +114,7 @@ GtkWidget *create_main_window (void)
|
|||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_menu_item_new_with_label ("÷ÙÈÏÄ");
|
||||
item = gtk_menu_item_new_with_label (_("÷ŮČĎÄ"));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_Q, GDK_CONTROL_MASK,
|
||||
|
@ -131,7 +123,7 @@ GtkWidget *create_main_window (void)
|
|||
GTK_SIGNAL_FUNC (on_close_main_window), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item_menu = gtk_menu_item_new_with_label ("ðÒÏÓÍÏÔÒ");
|
||||
item_menu = gtk_menu_item_new_with_label (_("đŇĎÓÍĎÔŇ"));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "view", item_menu);
|
||||
gtk_widget_set_sensitive (item_menu, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (menubar), item_menu);
|
||||
|
@ -139,7 +131,7 @@ GtkWidget *create_main_window (void)
|
|||
main_menu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item_menu), main_menu);
|
||||
|
||||
item = gtk_menu_item_new_with_label ("õ×ÅÌÉÞÉÔØ");
|
||||
item = gtk_menu_item_new_with_label (_("ő×ĹĚÉŢÉÔŘ"));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_equal, 0, GTK_ACCEL_VISIBLE);
|
||||
|
@ -147,7 +139,7 @@ GtkWidget *create_main_window (void)
|
|||
GTK_SIGNAL_FUNC (on_zoomin), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_menu_item_new_with_label ("õÍÅÎØÛÉÔØ");
|
||||
item = gtk_menu_item_new_with_label (_("őÍĹÎŘŰÉÔŘ"));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_minus, 0, GTK_ACCEL_VISIBLE);
|
||||
|
@ -159,7 +151,7 @@ GtkWidget *create_main_window (void)
|
|||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_radio_menu_item_new_with_label (menugroup, "óÅÔËÁ");
|
||||
item = gtk_radio_menu_item_new_with_label (menugroup,_("óĹÔËÁ"));
|
||||
|
||||
menugroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
|
@ -168,7 +160,7 @@ GtkWidget *create_main_window (void)
|
|||
gtk_object_set_data (GTK_OBJECT (main_window), "menu_s", item);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_radio_menu_item_new_with_label (menugroup, "äÅÆÏÒÁÃÉÉ");
|
||||
item = gtk_radio_menu_item_new_with_label (menugroup,_("äĹĆĎŇÁĂÉÉ"));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "menu_d", item);
|
||||
menugroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
|
@ -176,7 +168,7 @@ GtkWidget *create_main_window (void)
|
|||
GTK_SIGNAL_FUNC (on_menu_def), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_radio_menu_item_new_with_label (menugroup, "îÁÐÒÑÖÅÎÉÑ");
|
||||
item = gtk_radio_menu_item_new_with_label (menugroup,_("îÁĐŇŃÖĹÎÉŃ"));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "menu_n", item);
|
||||
menugroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
|
@ -184,7 +176,7 @@ GtkWidget *create_main_window (void)
|
|||
GTK_SIGNAL_FUNC (on_menu_nap), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_radio_menu_item_new_with_label (menugroup, "ðÏ×ÒÅÖÄÅÎ.");
|
||||
item = gtk_radio_menu_item_new_with_label (menugroup,_("đĎ×ŇĹÖÄĹÎ."));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "menu_m", item);
|
||||
menugroup = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
|
@ -195,29 +187,36 @@ GtkWidget *create_main_window (void)
|
|||
item = gtk_menu_item_new ();
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_check_menu_item_new_with_label (_("éÎÔĹŇĐĎĚŃĂÉŃ"));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "menu_inter", item);
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_menu_inter), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_check_menu_item_new_with_label ("üÌÅÍÅÎÔÙ");
|
||||
item = gtk_check_menu_item_new_with_label (_("üĚĹÍĹÎÔŮ"));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "menu_elem", item);
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_menu_elem), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item = gtk_check_menu_item_new_with_label ("õÚÌÙ");
|
||||
item = gtk_check_menu_item_new_with_label (_("őÚĚŮ"));
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "menu_knot", item);
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_menu_knot), NULL);
|
||||
gtk_widget_show (item);
|
||||
|
||||
item_menu = gtk_menu_item_new_with_label ("óÐÒÁ×ËÁ");
|
||||
item_menu = gtk_menu_item_new_with_label (_("óĐŇÁ×ËÁ"));
|
||||
gtk_container_add (GTK_CONTAINER (menubar), item_menu);
|
||||
gtk_menu_item_right_justify (GTK_MENU_ITEM (item_menu));
|
||||
gtk_widget_show (item_menu);
|
||||
main_menu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item_menu), main_menu);
|
||||
|
||||
item = gtk_menu_item_new_with_label ("ï ðÒÏÇÒÁÍÍÅ");
|
||||
item = gtk_menu_item_new_with_label (_("ď đŇĎÇŇÁÍÍĹ"));
|
||||
gtk_container_add (GTK_CONTAINER (main_menu), item);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
GTK_SIGNAL_FUNC (on_about_dialog), NULL);
|
||||
|
@ -248,8 +247,8 @@ GtkWidget *create_main_window (void)
|
|||
button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_BUTTON,
|
||||
NULL,
|
||||
"ïÔËÒÙÔØ",
|
||||
"ïÔËÒÙÔØ", NULL,
|
||||
_("ďÔËŇŮÔŘ"),
|
||||
_("ďÔËŇŮÔŘ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_open_dialog),
|
||||
NULL);
|
||||
|
@ -265,8 +264,8 @@ GtkWidget *create_main_window (void)
|
|||
button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_BUTTON,
|
||||
NULL,
|
||||
"óÏÈÒÁÎÉÔØ",
|
||||
"óÏÈÒÁÎÉÔØ", NULL,
|
||||
_("óĎČŇÁÎÉÔŘ"),
|
||||
_("óĎČŇÁÎÉÔŘ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_save_dialog),
|
||||
NULL);
|
||||
|
@ -283,8 +282,8 @@ GtkWidget *create_main_window (void)
|
|||
button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_BUTTON,
|
||||
NULL,
|
||||
"ðÁÌÉÔÒÁ",
|
||||
"ðÁÌÉÔÒÁ", NULL,
|
||||
_("đÁĚÉÔŇÁ"),
|
||||
_("đÁĚÉÔŇÁ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_pal_dialog),
|
||||
NULL);
|
||||
|
@ -303,8 +302,8 @@ GtkWidget *create_main_window (void)
|
|||
button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_BUTTON,
|
||||
NULL,
|
||||
"õ×ÅÌÉÞÉÔØ",
|
||||
"õ×ÅÌÉÞÉÔØ", NULL,
|
||||
_("ő×ĹĚÉŢÉÔŘ"),
|
||||
_("ő×ĹĚÉŢÉÔŘ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_zoomin),
|
||||
NULL);
|
||||
|
@ -321,8 +320,8 @@ GtkWidget *create_main_window (void)
|
|||
button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_BUTTON,
|
||||
NULL,
|
||||
"õÍÅÎØÛÉÔØ",
|
||||
"õÍÅÎØÛÉÔØ", NULL,
|
||||
_("őÍĹÎŘŰÉÔŘ"),
|
||||
_("őÍĹÎŘŰÉÔŘ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_zoomout),
|
||||
NULL);
|
||||
|
@ -341,12 +340,12 @@ GtkWidget *create_main_window (void)
|
|||
button_s = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_RADIOBUTTON,
|
||||
NULL,
|
||||
"óÅÔËÁ",
|
||||
"óÅÔËÁ", NULL,
|
||||
_("óĹÔËÁ"),
|
||||
_("óĹÔËÁ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC
|
||||
(on_button_setka), NULL);
|
||||
gtk_widget_set_name (GTK_WIDGET (button_s), "setka");
|
||||
gtk_widget_set_name (GTK_WIDGET (button_s),"setka");
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "button_s", button_s);
|
||||
gtk_widget_set_sensitive (button_s, FALSE);
|
||||
gtk_widget_show (button);
|
||||
|
@ -360,8 +359,8 @@ GtkWidget *create_main_window (void)
|
|||
button_d = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_RADIOBUTTON,
|
||||
button_s,
|
||||
"äÅÆÏÒÍÁÃÉÉ",
|
||||
"äÅÆÏÒÍÁÃÉÉ", NULL,
|
||||
_("äĹĆĎŇÍÁĂÉÉ"),
|
||||
_("äĹĆĎŇÍÁĂÉÉ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_button_def),
|
||||
NULL);
|
||||
|
@ -379,8 +378,8 @@ GtkWidget *create_main_window (void)
|
|||
button_n = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_RADIOBUTTON,
|
||||
button_s,
|
||||
"îÁÐÒÑÖÅÎÉÑ",
|
||||
"îÁÐÒÑÖÅÎÉÑ", NULL,
|
||||
_("îÁĐŇŃÖĹÎÉŃ"),
|
||||
_("îÁĐŇŃÖĹÎÉŃ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_button_nap),
|
||||
NULL);
|
||||
|
@ -398,8 +397,8 @@ GtkWidget *create_main_window (void)
|
|||
button_m = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_RADIOBUTTON,
|
||||
button_s,
|
||||
"ðÏ×ÒÅÖÄÅÎ.",
|
||||
"ðÏ×ÒÅÖÄÅÎ.", NULL,
|
||||
_("đĎ×ŇĹÖÄĹÎ."),
|
||||
_("đĎ×ŇĹÖÄĹÎ."), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_button_mtr),
|
||||
NULL);
|
||||
|
@ -419,8 +418,8 @@ GtkWidget *create_main_window (void)
|
|||
button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
|
||||
NULL,
|
||||
"üÌÅÍÅÎÔÙ",
|
||||
"üÌÅÍÅÎÔÙ", NULL,
|
||||
_("üĚĹÍĹÎÔŮ"),
|
||||
_("üĚĹÍĹÎÔŮ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_button_elem),
|
||||
NULL);
|
||||
|
@ -437,14 +436,32 @@ GtkWidget *create_main_window (void)
|
|||
button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
|
||||
NULL,
|
||||
"õÚÌÙ",
|
||||
"õÚÌÙ", NULL,
|
||||
_("őÚĚŮ"),
|
||||
_("őÚĚŮ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_button_knot),
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "button_knot", button);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_widget_show (button);
|
||||
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (main_window->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
(gchar **) inter_xpm);
|
||||
tmp_toolbar_icon = gtk_pixmap_new (pixmap, mask);
|
||||
gdk_pixmap_unref (pixmap);
|
||||
gdk_bitmap_unref (mask);
|
||||
button = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
|
||||
GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
|
||||
NULL,
|
||||
_("éÎÔĹŇĐĎĚŃĂÉŃ"),
|
||||
_("éÎÔĹŇĐĎĚŃĂÉŃ"), NULL,
|
||||
tmp_toolbar_icon,
|
||||
GTK_SIGNAL_FUNC (on_button_inter),
|
||||
NULL);
|
||||
gtk_object_set_data (GTK_OBJECT (main_window), "button_inter", button);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_widget_show (button);
|
||||
|
||||
scrolledwindow = gtk_scrolled_window_new (0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), scrolledwindow, TRUE, TRUE,
|
||||
|
@ -486,7 +503,7 @@ GtkWidget *create_about_dialog (void)
|
|||
GtkStyle *style;
|
||||
|
||||
about_dialog = gtk_dialog_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (about_dialog), "ï ðÒÏÇÒÁÍÍÅ");
|
||||
gtk_window_set_title (GTK_WINDOW (about_dialog), _("ď đŇĎÇŇÁÍÍĹ"));
|
||||
gtk_widget_set_usize (GTK_WIDGET (about_dialog), 300, 200);
|
||||
gtk_window_set_policy (GTK_WINDOW (about_dialog), FALSE, FALSE, FALSE);
|
||||
gtk_widget_show (about_dialog);
|
||||
|
@ -514,7 +531,7 @@ GtkWidget *create_about_dialog (void)
|
|||
gtk_widget_show (about_action_area);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (about_action_area), 5);
|
||||
|
||||
about_button = gtk_button_new_with_label (" OK ");
|
||||
about_button = gtk_button_new_with_label (_(" OK "));
|
||||
gtk_box_pack_end (GTK_BOX (about_action_area), about_button, FALSE,
|
||||
FALSE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (about_button, GTK_CAN_DEFAULT);
|
||||
|
@ -531,8 +548,10 @@ GtkWidget *create_open_dialog (void)
|
|||
GtkWidget *open_dialog;
|
||||
GtkWidget *ok_button;
|
||||
GtkWidget *cancel_button;
|
||||
|
||||
|
||||
|
||||
open_dialog = gtk_file_selection_new ("ïÔËÒÙÔÉÅ");
|
||||
open_dialog = gtk_file_selection_new (_("ďÔËŇŮÔÉĹ"));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (open_dialog), 10);
|
||||
|
||||
ok_button = GTK_FILE_SELECTION (open_dialog)->ok_button;
|
||||
|
@ -559,7 +578,7 @@ GtkWidget *create_save_dialog (void)
|
|||
GtkWidget *ok_button;
|
||||
GtkWidget *cancel_button;
|
||||
|
||||
save_dialog = gtk_file_selection_new ("óÏÈÒÁÎÅÎÉÅ");
|
||||
save_dialog = gtk_file_selection_new (_("óĎČŇÁÎĹÎÉĹ"));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (save_dialog), 10);
|
||||
|
||||
ok_button = GTK_FILE_SELECTION (save_dialog)->ok_button;
|
||||
|
@ -586,7 +605,9 @@ GtkWidget *create_pal_dialog (void)
|
|||
GtkWidget *ok_button;
|
||||
GtkWidget *cancel_button;
|
||||
|
||||
open_dialog = gtk_file_selection_new ("ïÔËÒÙÔÉÅ");
|
||||
chdir ("/usr/local/share/graph2d/palettes");
|
||||
|
||||
open_dialog = gtk_file_selection_new (_("ďÔËŇŮÔÉĹ"));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (open_dialog), 10);
|
||||
|
||||
ok_button = GTK_FILE_SELECTION (open_dialog)->ok_button;
|
|
@ -7,7 +7,6 @@
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
// #include "delem.h"
|
||||
|
||||
GtkWidget *create_main_window (void);
|
||||
GtkWidget *create_about_dialog (void);
|
8
src/intl.h
Normal file
8
src/intl.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
# include <libintl.h>
|
||||
# undef _
|
||||
# define _(String) dgettext ("graph2d", String)
|
||||
# ifdef gettext_noop
|
||||
# define N_(String) gettext_noop (String)
|
||||
# else
|
||||
# define N_(String) (String)
|
||||
# endif
|
16
src/pixmaps.h
Normal file
16
src/pixmaps.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef PIXMAPS
|
||||
#define PIXMAPS
|
||||
#include "../pixmaps/about.xpm"
|
||||
#include "../pixmaps/open.xpm"
|
||||
#include "../pixmaps/save.xpm"
|
||||
#include "../pixmaps/pal.xpm"
|
||||
#include "../pixmaps/zoomin.xpm"
|
||||
#include "../pixmaps/zoomout.xpm"
|
||||
#include "../pixmaps/elem.xpm"
|
||||
#include "../pixmaps/knot.xpm"
|
||||
#include "../pixmaps/setka.xpm"
|
||||
#include "../pixmaps/epsilon.xpm"
|
||||
#include "../pixmaps/sigma.xpm"
|
||||
#include "../pixmaps/trech.xpm"
|
||||
#include "../pixmaps/inter.xpm"
|
||||
#endif
|
649
temp/drawelem.C
649
temp/drawelem.C
|
@ -1,649 +0,0 @@
|
|||
#include "drawelem.h"
|
||||
#include "colormap.h"
|
||||
|
||||
GdkColor *color_pal = NULL;
|
||||
int ncolor_pal = 0;
|
||||
int sdn = 0;
|
||||
int selem = 0;
|
||||
int sknot = 0;
|
||||
static void drawelem_class_init (DrawElemClass * klass);
|
||||
static void drawelem_init (DrawElem * det);
|
||||
|
||||
void drawelem_show_nelem (void)
|
||||
{
|
||||
if (selem == 0)
|
||||
selem = 1;
|
||||
else
|
||||
selem = 0;
|
||||
}
|
||||
|
||||
void drawelem_show_nknot (void)
|
||||
{
|
||||
if (sknot == 0)
|
||||
sknot = 1;
|
||||
else
|
||||
sknot = 0;
|
||||
}
|
||||
|
||||
void drawelem_set (int s)
|
||||
{
|
||||
sdn = s;
|
||||
}
|
||||
|
||||
char *float_to_char (float n)
|
||||
{
|
||||
int x, nn;
|
||||
int i, j;
|
||||
char *st = NULL;
|
||||
int flag = 0;
|
||||
|
||||
nn = int (n);
|
||||
j = 0;
|
||||
if (int (1000 * n) > int (n) * 1000) {
|
||||
nn = int (n * 1000);
|
||||
if (n < 1)
|
||||
j++;
|
||||
flag++;
|
||||
}
|
||||
x = nn;
|
||||
while (x > 0) {
|
||||
x = int (x / 10);
|
||||
j++;
|
||||
}
|
||||
|
||||
x = nn;
|
||||
|
||||
if (flag == 1)
|
||||
j++;
|
||||
|
||||
if ((j < 5) && (flag == 1))
|
||||
j = 5;
|
||||
|
||||
st = new char[j];
|
||||
st[j] = *"\0";
|
||||
|
||||
if (n < 1) {
|
||||
st[0] = *"0";
|
||||
j--;
|
||||
}
|
||||
|
||||
for (i = 1; i <= j; i++) {
|
||||
if ((flag == 1) && (i == 4)) {
|
||||
st[strlen (st) - i] = *".";
|
||||
} else {
|
||||
nn = int (nn / 10);
|
||||
x = x - nn * 10;
|
||||
st[strlen (st) - i] = char (int (*"0") + x);
|
||||
x = nn;
|
||||
}
|
||||
}
|
||||
return (st);
|
||||
}
|
||||
|
||||
void drawelem_size (DrawElem * de, gint width, gint height)
|
||||
{
|
||||
gtk_drawing_area_size (GTK_DRAWING_AREA (de), width, height);
|
||||
}
|
||||
|
||||
static gint configure_event (GtkWidget * widget, GdkEventConfigure * event)
|
||||
{
|
||||
if (!DRAWELEM (widget)->pixmap) {
|
||||
|
||||
if (DRAWELEM (widget)->pixmap != NULL)
|
||||
gdk_pixmap_unref (DRAWELEM (widget)->pixmap);
|
||||
DRAWELEM (widget)->pixmap = gdk_pixmap_new (widget->window,
|
||||
widget->
|
||||
allocation.width,
|
||||
widget->
|
||||
allocation.height, -1);
|
||||
|
||||
gdk_draw_rectangle (DRAWELEM (widget)->pixmap,
|
||||
widget->style->white_gc,
|
||||
TRUE,
|
||||
0, 0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Redraw the screen from the backing pixmap */
|
||||
static gint expose_event (GtkWidget * widget, GdkEventExpose * event)
|
||||
{
|
||||
gdk_draw_pixmap (widget->window,
|
||||
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
|
||||
DRAWELEM (widget)->pixmap,
|
||||
event->area.x, event->area.y,
|
||||
event->area.x, event->area.y,
|
||||
widget->allocation.width, widget->allocation.height);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void draw_triangle (GdkDrawable * pixmap, GdkGC * color, gint filled,
|
||||
int x1, int y1, int x2, int y2, int x3, int y3)
|
||||
{
|
||||
GdkPoint points[3];
|
||||
|
||||
points[0].x = x1;
|
||||
points[0].y = y1;
|
||||
|
||||
points[1].x = x2;
|
||||
points[1].y = y2;
|
||||
|
||||
points[2].x = x3;
|
||||
points[2].y = y3;
|
||||
|
||||
gdk_draw_polygon (pixmap, color, filled, points, 3);
|
||||
}
|
||||
|
||||
GdkGC *color_to_gc (GtkWidget * widget, GdkColor * fcolor,
|
||||
GdkColormap * colormap)
|
||||
{
|
||||
GdkColor color;
|
||||
GdkGC *colorgc;
|
||||
GdkGCValues gc_values;
|
||||
color.red = fcolor->red * 256;
|
||||
color.green = fcolor->green * 256;
|
||||
color.blue = fcolor->blue * 256;
|
||||
if (!gdk_color_alloc (colormap, &color))
|
||||
g_print ("ïÛÉÂËÁ: ã×ÅÔ ÎÅ ÎÁÊÄÅÎ.\n ");
|
||||
gc_values.foreground = color;
|
||||
colorgc = gdk_gc_new_with_values (GTK_WIDGET (widget)->window,
|
||||
&gc_values, GDK_GC_FOREGROUND);
|
||||
return (colorgc);
|
||||
};
|
||||
|
||||
void draw_nknot (DrawElem * det)
|
||||
{
|
||||
GdkFont *font =
|
||||
gdk_font_load
|
||||
("-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*");
|
||||
GdkColormap *colormap;
|
||||
GdkGC *colorgc;
|
||||
GdkColor color = { 0, 0, 0, 65535 };
|
||||
char *text = NULL;
|
||||
int i;
|
||||
|
||||
colormap = gdk_colormap_get_system ();
|
||||
colorgc = color_to_gc (GTK_WIDGET (det), &color, colormap);
|
||||
|
||||
for (i = 0; i < det->nknot; i++) {
|
||||
text = float_to_char (float (i + 1));
|
||||
gdk_draw_text (DRAWELEM (det)->pixmap,
|
||||
font,
|
||||
colorgc,
|
||||
int (det->mash * det->knot_x[i]) + det->zero_x + 2,
|
||||
-int (det->mash * det->knot_y[i]) + det->zero_y - 2,
|
||||
text, strlen (text));
|
||||
delete (text);
|
||||
}
|
||||
|
||||
gdk_gc_unref (colorgc);
|
||||
gdk_colormap_unref (colormap);
|
||||
gdk_font_unref (font);
|
||||
}
|
||||
|
||||
void draw_nelem (DrawElem * det)
|
||||
{
|
||||
GdkFont *font =
|
||||
gdk_font_load
|
||||
("-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*");
|
||||
GdkColormap *colormap;
|
||||
GdkGC *colorgc;
|
||||
GdkColor color = { 0, 65535, 0, 0 };
|
||||
char *text = NULL;
|
||||
int i;
|
||||
float x, y;
|
||||
|
||||
colormap = gdk_colormap_get_system ();
|
||||
colorgc = color_to_gc (GTK_WIDGET (det), &color, colormap);
|
||||
|
||||
for (i = 0; i < det->nelem; i++) {
|
||||
x =
|
||||
(det->knot_x[det->elem[0][i] - 1] +
|
||||
det->knot_x[det->elem[1][i] - 1] +
|
||||
det->knot_x[det->elem[2][i] - 1]) / 3;
|
||||
y =
|
||||
(det->knot_y[det->elem[0][i] - 1] +
|
||||
det->knot_y[det->elem[1][i] - 1] +
|
||||
det->knot_y[det->elem[2][i] - 1]) / 3;
|
||||
|
||||
text = float_to_char (float (i + 1));
|
||||
gdk_draw_text (DRAWELEM (det)->pixmap,
|
||||
font,
|
||||
colorgc,
|
||||
int (det->mash * x) + det->zero_x -
|
||||
int (gdk_string_width (font, text) / 2),
|
||||
-int (det->mash * y) + det->zero_y +
|
||||
int (gdk_string_height (font, "0") / 2), text,
|
||||
strlen (text));
|
||||
delete (text);
|
||||
}
|
||||
|
||||
gdk_gc_unref (colorgc);
|
||||
gdk_colormap_unref (colormap);
|
||||
gdk_font_unref (font);
|
||||
}
|
||||
|
||||
void drawelem_show_elem (DrawElem * det)
|
||||
{
|
||||
GdkGC *colorgc;
|
||||
GdkColormap *colormap;
|
||||
GdkFont *font;
|
||||
|
||||
int num, i, th;
|
||||
gint csize;
|
||||
float maxn, minn, inter;
|
||||
int colline;
|
||||
int width, height;
|
||||
char *text = NULL;
|
||||
|
||||
colormap = gdk_colormap_get_system ();
|
||||
|
||||
if (color_pal == NULL)
|
||||
csize = 256;
|
||||
else
|
||||
csize = ncolor_pal;
|
||||
|
||||
if (sdn != 0) {
|
||||
maxn = det->nds[0];
|
||||
minn = maxn;
|
||||
|
||||
for (int i = 0; i < det->nelem; i++) {
|
||||
if (maxn < det->nds[i])
|
||||
maxn = det->nds[i];
|
||||
if (minn > det->nds[i])
|
||||
minn = det->nds[i];
|
||||
}
|
||||
inter = (maxn - minn) / csize;
|
||||
}
|
||||
|
||||
/* ÷Ù×ÏÄ ÓÅÔËÉ ÉÌÉ ÚÁÌÉ×ËÁ ÚÁÇÏÔÏ×ËÉ */
|
||||
for (i = 0; i < det->nelem; i++) {
|
||||
if (sdn != 0) {
|
||||
num = int ((det->nds[i] - minn) / inter);
|
||||
if ((inter * num) > (det->nds[i] - minn))
|
||||
num--;
|
||||
if (color_pal == NULL)
|
||||
colorgc =
|
||||
color_to_gc (GTK_WIDGET (det), &default_color[num],
|
||||
colormap);
|
||||
else
|
||||
colorgc =
|
||||
color_to_gc (GTK_WIDGET (det), &color_pal[num],
|
||||
colormap);
|
||||
|
||||
draw_triangle (det->pixmap, colorgc, TRUE,
|
||||
int (det->mash *
|
||||
det->knot_x[det->elem[0][i] - 1]) +
|
||||
det->zero_x,
|
||||
-int (det->mash *
|
||||
det->knot_y[det->elem[0][i] - 1]) +
|
||||
det->zero_y,
|
||||
int (det->mash *
|
||||
det->knot_x[det->elem[1][i] - 1]) +
|
||||
det->zero_x,
|
||||
-int (det->mash *
|
||||
det->knot_y[det->elem[1][i] - 1]) +
|
||||
det->zero_y,
|
||||
int (det->mash *
|
||||
det->knot_x[det->elem[2][i] - 1]) +
|
||||
det->zero_x,
|
||||
-int (det->mash *
|
||||
det->knot_y[det->elem[2][i] - 1]) +
|
||||
det->zero_y);
|
||||
gdk_gc_unref (colorgc);
|
||||
} else
|
||||
draw_triangle (det->pixmap, GTK_WIDGET (det)->style->black_gc,
|
||||
FALSE,
|
||||
int (det->mash *
|
||||
det->knot_x[det->elem[0][i] - 1]) +
|
||||
det->zero_x,
|
||||
-int (det->mash *
|
||||
det->knot_y[det->elem[0][i] - 1]) +
|
||||
det->zero_y,
|
||||
int (det->mash *
|
||||
det->knot_x[det->elem[1][i] - 1]) +
|
||||
det->zero_x,
|
||||
-int (det->mash *
|
||||
det->knot_y[det->elem[1][i] - 1]) +
|
||||
det->zero_y,
|
||||
int (det->mash *
|
||||
det->knot_x[det->elem[2][i] - 1]) +
|
||||
det->zero_x,
|
||||
-int (det->mash *
|
||||
det->knot_y[det->elem[2][i] - 1]) +
|
||||
det->zero_y);
|
||||
}
|
||||
|
||||
if (selem != 0)
|
||||
draw_nelem (det);
|
||||
if (sknot != 0)
|
||||
draw_nknot (det);
|
||||
|
||||
if (sdn == 0)
|
||||
return;
|
||||
|
||||
/* ÷Ù×ÏÄ ÇÒÁÄÉÅÎÔÁ */
|
||||
if (csize < 128)
|
||||
colline = int (256 / csize);
|
||||
else
|
||||
colline = 1;
|
||||
|
||||
gdk_window_get_size (det->pixmap, &width, &height);
|
||||
|
||||
for (i = 0; i < csize; i++) {
|
||||
if (color_pal == NULL)
|
||||
colorgc =
|
||||
color_to_gc (GTK_WIDGET (det), &default_color[i],
|
||||
colormap);
|
||||
else
|
||||
colorgc =
|
||||
color_to_gc (GTK_WIDGET (det), &color_pal[i], colormap);
|
||||
|
||||
gdk_draw_rectangle (DRAWELEM (det)->pixmap,
|
||||
colorgc,
|
||||
TRUE,
|
||||
width - 100, 10 + colline * i, 20, colline);
|
||||
gdk_gc_unref (colorgc);
|
||||
}
|
||||
|
||||
/* ÷Ù×ÏÄ ÚÎÁÞÅÎÉÊ ÇÒÁÄÉÅÎÔÁ */
|
||||
font =
|
||||
gdk_font_load
|
||||
("-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*");
|
||||
th = gdk_string_height (font, "H") + 3;
|
||||
|
||||
inter = (maxn - minn) / int (csize * colline / th);
|
||||
for (i = 1; i <= int (csize * colline / th); i++) {
|
||||
text = float_to_char (minn + (i) * inter + inter / 2);
|
||||
gdk_draw_text (DRAWELEM (det)->pixmap,
|
||||
font,
|
||||
GTK_WIDGET (det)->style->black_gc,
|
||||
width - 70, 10 + i * th, text, strlen (text));
|
||||
delete (text);
|
||||
}
|
||||
gdk_font_unref (font);
|
||||
|
||||
gdk_colormap_unref (colormap);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void drawelem_center (DrawElem * det)
|
||||
{
|
||||
float maxx, minx, maxy, miny;
|
||||
gint width, height;
|
||||
|
||||
maxx = minx = det->knot_x[0];
|
||||
maxy = miny = det->knot_y[0];
|
||||
|
||||
for (int i = 0; i < det->nknot; i++) {
|
||||
if (maxx < (det->knot_x[i]))
|
||||
maxx = det->knot_x[i];
|
||||
if (maxy < (det->knot_y[i]))
|
||||
maxy = det->knot_y[i];
|
||||
if (minx > (det->knot_x[i]))
|
||||
minx = det->knot_x[i];
|
||||
if (miny > (det->knot_y[i]))
|
||||
miny = det->knot_y[i];
|
||||
}
|
||||
|
||||
gdk_window_get_size (det->pixmap, &width, &height);
|
||||
|
||||
det->zero_x = int ((width - 125 - (maxx + minx) * det->mash) / 2);
|
||||
det->zero_y = int ((height + (maxy + miny) * det->mash) / 2);
|
||||
}
|
||||
|
||||
void drawelem_fit (DrawElem * det)
|
||||
{
|
||||
float maxx, minx, maxy, miny;
|
||||
gint width, height;
|
||||
|
||||
maxx = minx = det->knot_x[0];
|
||||
maxy = miny = det->knot_y[0];
|
||||
|
||||
for (int i = 0; i < det->nknot; i++) {
|
||||
if (maxx < det->knot_x[i])
|
||||
maxx = det->knot_x[i];
|
||||
if (maxy < det->knot_y[i])
|
||||
maxy = det->knot_y[i];
|
||||
if (minx > det->knot_x[i])
|
||||
minx = det->knot_x[i];
|
||||
if (miny > det->knot_y[i])
|
||||
miny = det->knot_y[i];
|
||||
}
|
||||
|
||||
width = int ((maxx - minx) * det->mash) + 145;
|
||||
height = int ((maxy - miny) * det->mash) + 20;
|
||||
|
||||
if (height < 300)
|
||||
height = 300;
|
||||
|
||||
det->zero_x = int ((width - 125 - (maxx + minx) * det->mash) / 2);
|
||||
det->zero_y = int ((height + (maxy + miny) * det->mash) / 2);
|
||||
|
||||
drawelem_size (det, width, height);
|
||||
gdk_pixmap_unref (det->pixmap);
|
||||
det->pixmap = gdk_pixmap_new (GTK_WIDGET (det)->window,
|
||||
width, height, -1);
|
||||
|
||||
gdk_draw_rectangle (det->pixmap,
|
||||
GTK_WIDGET (det)->style->white_gc,
|
||||
TRUE, 0, 0, width, height);
|
||||
|
||||
drawelem_show_elem (det);
|
||||
}
|
||||
|
||||
void load_knot (DrawElem * det, char *path)
|
||||
{
|
||||
FILE *fd;
|
||||
float tmp;
|
||||
int nuz, n, i;
|
||||
|
||||
fd = fopen (path, "r");
|
||||
fscanf (fd, "%d", &nuz);
|
||||
|
||||
if (det->knot_x != NULL)
|
||||
delete (det->knot_x);
|
||||
if (det->knot_y != NULL)
|
||||
delete (det->knot_y);
|
||||
|
||||
det->knot_x = new float[nuz];
|
||||
det->knot_y = new float[nuz];
|
||||
|
||||
for (i = 0; i < nuz; i++)
|
||||
fscanf (fd, "%d %f %f %f", &n, &det->knot_x[i], &det->knot_y[i],
|
||||
&tmp);
|
||||
|
||||
fclose (fd);
|
||||
|
||||
|
||||
det->nknot = nuz;
|
||||
return;
|
||||
}
|
||||
|
||||
void drawelem_loadpal (char *path)
|
||||
{
|
||||
FILE *fd;
|
||||
int r, g, b;
|
||||
int i;
|
||||
|
||||
fd = fopen (path, "r");
|
||||
|
||||
ncolor_pal = 0;
|
||||
|
||||
if (color_pal != NULL)
|
||||
delete (color_pal);
|
||||
|
||||
while (!feof (fd)) {
|
||||
fscanf (fd, "%x %x %x", &r, &g, &b);
|
||||
ncolor_pal++;
|
||||
}
|
||||
fclose (fd);
|
||||
color_pal = new GdkColor[ncolor_pal];
|
||||
|
||||
fd = fopen (path, "r");
|
||||
for (i = 0; i < ncolor_pal; i++) {
|
||||
fscanf (fd, "%x %x %x", &r, &g, &b);
|
||||
color_pal[i].red = r;
|
||||
color_pal[i].green = g;
|
||||
color_pal[i].blue = b;
|
||||
}
|
||||
fclose (fd);
|
||||
return;
|
||||
}
|
||||
|
||||
void load_elem (DrawElem * det, char *path)
|
||||
{
|
||||
FILE *fd;
|
||||
int n, i;
|
||||
int nelem;
|
||||
|
||||
fd = fopen (path, "r");
|
||||
//fscanf (fd, "%d", &nelem);
|
||||
|
||||
nelem = 0;
|
||||
while (!feof (fd)) {
|
||||
if (fscanf(fd, "%d %d %d %d", &n,&n ,&n,&n)==4)
|
||||
nelem++;
|
||||
}
|
||||
fclose(fd);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
if (det->elem[i] != NULL)
|
||||
delete (det->elem[i]);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
det->elem[i] = new int[nelem];
|
||||
|
||||
nelem = 0;
|
||||
fd = fopen (path, "r");
|
||||
while (!feof (fd)) {
|
||||
if (fscanf
|
||||
(fd, "%d %d %d %d", &n, &det->elem[0][nelem], &det->elem[1][nelem],
|
||||
&det->elem[2][i]) == 4)
|
||||
nelem++;
|
||||
}
|
||||
fclose (fd);
|
||||
if (nelem==177) g_print("--------------------");
|
||||
|
||||
det->nelem = nelem;
|
||||
return;
|
||||
}
|
||||
|
||||
void drawelem_load_nds (DrawElem * det, char *path)
|
||||
{
|
||||
FILE *fd;
|
||||
int n, i;
|
||||
int nelem;
|
||||
|
||||
fd = fopen (path, "r");
|
||||
fscanf (fd, "%d", &nelem);
|
||||
|
||||
if (det->nds != NULL)
|
||||
delete (det->nds);
|
||||
|
||||
det->nds = new float[nelem];
|
||||
|
||||
for (int i = 0; i < nelem; i++) {
|
||||
if (sdn == 3)
|
||||
fscanf (fd, "%f", &det->nds[i]);
|
||||
else
|
||||
fscanf (fd, "%d %f", &n, &det->nds[i]);
|
||||
}
|
||||
fclose (fd);
|
||||
return;
|
||||
}
|
||||
|
||||
void drawelem_load_all (DrawElem * det, char *path)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
|
||||
chdir (path);
|
||||
|
||||
if (stat ("nod_os1.dat", &st) < 0) {
|
||||
g_print ("æÁÊÌ nod_os1.dat ÎÅ ÓÕÝÅÓÔ×ÕÅÔ.\n");
|
||||
return;
|
||||
}
|
||||
if (stat ("koord.poc", &st) < 0) {
|
||||
g_print ("æÁÊÌ koord.poc ÎÅ ÓÕÝÅÓÔ×ÕÅÔ.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (stat ("ntg.poc", &st) < 0) {
|
||||
g_print ("æÁÊÌ ntg.poc ÎÅ ÓÕÝÅÓÔ×ÕÅÔ.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
load_elem (det, "nod_os1.dat");
|
||||
load_knot (det, "koord.poc");
|
||||
if (sdn == 1)
|
||||
drawelem_load_nds (det, "sg_na.poc");
|
||||
if (sdn == 2)
|
||||
drawelem_load_nds (det, "na_df.poc");
|
||||
if (sdn == 3)
|
||||
drawelem_load_nds (det, "ntg.poc");
|
||||
drawelem_fit (det);
|
||||
}
|
||||
void drawelem_save (DrawElem * det, char *path)
|
||||
{
|
||||
GdkImlibImage *image;
|
||||
GdkBitmap mask;
|
||||
gint width, height;
|
||||
GdkImlibSaveInfo *info;
|
||||
|
||||
gdk_window_get_size (DRAWELEM (det)->pixmap, &width, &height);
|
||||
image = gdk_imlib_create_image_from_drawable (DRAWELEM (det)->pixmap,
|
||||
&mask, 0, 0, width,
|
||||
height);
|
||||
gdk_imlib_save_image (image, path, info);
|
||||
|
||||
}
|
||||
|
||||
GtkType drawelem_get_type (void)
|
||||
{
|
||||
static guint det_type = 0;
|
||||
if (!det_type) {
|
||||
GtkTypeInfo det_info = {
|
||||
"DrawElem",
|
||||
sizeof (DrawElem),
|
||||
sizeof (DrawElemClass),
|
||||
(GtkClassInitFunc) drawelem_class_init,
|
||||
(GtkObjectInitFunc) drawelem_init,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL
|
||||
};
|
||||
det_type =
|
||||
gtk_type_unique (gtk_drawing_area_get_type (), &det_info);
|
||||
}
|
||||
|
||||
return det_type;
|
||||
}
|
||||
|
||||
static void drawelem_class_init (DrawElemClass * klass)
|
||||
{
|
||||
}
|
||||
|
||||
static void drawelem_init (DrawElem * det)
|
||||
{
|
||||
int i;
|
||||
gtk_signal_connect (GTK_OBJECT (det), "expose_event",
|
||||
(GtkSignalFunc) expose_event, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (det), "configure_event",
|
||||
(GtkSignalFunc) configure_event, NULL);
|
||||
for (i = 0; i < 3; i++)
|
||||
det->elem[i] = NULL;
|
||||
det->knot_x = NULL;
|
||||
det->knot_y = NULL;
|
||||
det->nds = NULL;
|
||||
det->mash = 5;
|
||||
}
|
||||
|
||||
GtkWidget *drawelem_new (void)
|
||||
{
|
||||
return GTK_WIDGET (gtk_type_new (drawelem_get_type ()));
|
||||
}
|
||||
|
Reference in a new issue