gde_linux/CORE/main.c

149 lines
3.8 KiB
C
Raw Normal View History

2023-04-11 23:34:31 +08:00
#include <malloc.h>
#include <pixrect/pixrect.h>
2022-03-08 04:43:05 +08:00
#include <stdio.h>
#include <xview/defaults.h>
2023-04-11 23:34:31 +08:00
#include <xview/icon.h>
#include <xview/panel.h>
#include <xview/window.h>
2022-03-08 04:43:05 +08:00
#include <xview/xview.h>
2023-04-11 23:34:31 +08:00
2022-03-08 04:43:05 +08:00
#include "defines.h"
#include "globals.h"
2023-04-11 23:34:31 +08:00
#include "menudefs.h"
2022-03-08 04:43:05 +08:00
/*
Main()
Copyright (c) 1989, University of Illinois board of trustees. All rights
reserved. Written by Steven Smith at the Center for Prokaryote Genome
Analysis. Design and implementation guidance by Dr. Gary Olsen and Dr.
Carl Woese.
Copyright (c) 1990,1991,1992 Steven Smith at the Harvard Genome Laboratory.
All rights reserved.
*/
Gmenu menu[100];
2023-04-11 23:34:31 +08:00
// int num_menus = 0;
int repeat_cnt = 0;
Frame frame, pframe, infoframe;
Panel popup, infopanel;
Panel_item left_foot, right_foot;
Canvas EditCan, EditNameCan;
2022-03-08 04:43:05 +08:00
int DisplayType;
GmenuItem *current_item;
NA_Alignment *DataSet = NULL;
NA_Alignment *Clipboard = NULL;
char **TextClip;
2023-04-11 23:34:31 +08:00
int TextClipSize = 0, TextClipLength = 0;
2022-03-08 04:43:05 +08:00
/*
2023-04-11 23:34:31 +08:00
* Icon structure (pixmap dependent)
*/
2022-03-08 04:43:05 +08:00
2023-04-11 23:34:31 +08:00
static short GDEicon[258] = {
2022-03-08 04:43:05 +08:00
#include "icon_gde"
};
2023-04-11 23:34:31 +08:00
mpr_static(iconpr, 64, 64, 1, GDEicon);
2022-03-08 04:43:05 +08:00
2023-04-11 23:34:31 +08:00
main(argc, argv) int argc;
2022-03-08 04:43:05 +08:00
char **argv;
{
2023-04-11 23:34:31 +08:00
Icon tool_icon; /* obvious */
extern char FileName[], current_dir[];
2022-03-08 04:43:05 +08:00
2023-04-11 23:34:31 +08:00
int type = GENBANK; /* default file type */
2022-03-08 04:43:05 +08:00
DataSet = NULL;
2023-04-11 23:34:31 +08:00
Clipboard = (NA_Alignment *)Calloc(1, sizeof(NA_Alignment));
DisplayType = NASEQ_ALIGN; /* default data type */
2022-03-08 04:43:05 +08:00
Clipboard->maxnumelements = 5;
2023-04-11 23:34:31 +08:00
Clipboard->element = (NA_Sequence *)Calloc(Clipboard->maxnumelements,
sizeof(NA_Sequence));
2022-03-08 04:43:05 +08:00
2023-04-11 23:34:31 +08:00
/*
* Connect to server, and set up initial XView data types
* that are common to ALL display types
*/
xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, 0);
2022-03-08 04:43:05 +08:00
/*
2023-04-11 23:34:31 +08:00
* Main frame (primary window);
*/
2022-03-08 04:43:05 +08:00
2023-04-11 23:34:31 +08:00
frame = xv_create((int)NULL, FRAME, FRAME_NO_CONFIRM, FALSE,
2023-04-16 18:07:33 +08:00
FRAME_LABEL, "Genetic Data Environment 2.2.1",
2023-04-11 23:34:31 +08:00
FRAME_INHERIT_COLORS, TRUE, XV_WIDTH, 700, XV_HEIGHT,
500, FRAME_SHOW_FOOTER, TRUE, 0);
2022-03-08 04:43:05 +08:00
/*
2023-04-11 23:34:31 +08:00
* Popup frame (dialog box window), and default settings in
* the dialog box. These are changed to fit each individual
* command's needs in EventHandler().
*/
infoframe =
xv_create(frame, FRAME_CMD, FRAME_LABEL, "Messages",
WIN_DESIRED_HEIGHT, 100, WIN_DESIRED_WIDTH, 300,
FRAME_SHOW_RESIZE_CORNER, TRUE, FRAME_INHERIT_COLORS,
TRUE, FRAME_CLOSED, FALSE, WIN_SHOW, FALSE, 0);
pframe = xv_create(frame, FRAME_CMD, FRAME_CMD_PUSHPIN_IN, TRUE,
FRAME_DONE_PROC, FrameDone, XV_HEIGHT, 100, XV_WIDTH,
300, FRAME_SHOW_RESIZE_CORNER, FALSE, FRAME_CLOSED,
FALSE, XV_X, 300, XV_Y, 150, WIN_SHOW, FALSE, 0);
infopanel = xv_get(infoframe, FRAME_CMD_PANEL);
xv_set(infopanel, PANEL_LAYOUT, PANEL_VERTICAL, XV_WIDTH, 300,
XV_HEIGHT, 50, 0);
left_foot = xv_create(infopanel, PANEL_MESSAGE, 0);
right_foot = xv_create(infopanel, PANEL_MESSAGE, 0);
2022-03-08 04:43:05 +08:00
window_fit(infoframe);
2023-04-11 23:34:31 +08:00
/*
popup = xv_create(pframe,PANEL,
PANEL_LAYOUT,PANEL_HORIZONTAL,
0);
*/
popup = xv_get(pframe, FRAME_CMD_PANEL);
2022-03-08 04:43:05 +08:00
2023-04-11 23:34:31 +08:00
xv_create(popup, PANEL_BUTTON, PANEL_LABEL_STRING, "HELP",
PANEL_NOTIFY_PROC, HELP, 0);
2022-03-08 04:43:05 +08:00
2023-04-11 23:34:31 +08:00
xv_create(popup, PANEL_BUTTON, PANEL_LABEL_STRING, "OK",
PANEL_NOTIFY_PROC, DO, 0);
2022-03-08 04:43:05 +08:00
2023-04-11 23:34:31 +08:00
xv_create(popup, PANEL_BUTTON, PANEL_LABEL_STRING, "Cancel",
PANEL_NOTIFY_PROC, DONT, 0);
2022-03-08 04:43:05 +08:00
2023-04-11 23:34:31 +08:00
/*
* Keep original directory where program was started
*/
2022-03-08 04:43:05 +08:00
(void)getwd(current_dir);
ParseMenu();
GenMenu(type);
2023-04-11 23:34:31 +08:00
if (argc > 1) LoadData(argv[1]);
2022-03-08 04:43:05 +08:00
/*
2023-04-11 23:34:31 +08:00
* Set up the basics of the displays, and off to the main loop.
*/
2022-03-08 04:43:05 +08:00
BasicDisplay(DataSet);
2023-04-11 23:34:31 +08:00
if (DataSet != NULL)
((NA_Alignment *)DataSet)->na_ddata = (char *)SetNADData(
(NA_Alignment *)DataSet, EditCan, EditNameCan);
2022-03-08 04:43:05 +08:00
2023-04-11 23:34:31 +08:00
tool_icon = xv_create((int)NULL, ICON, ICON_IMAGE, &iconpr, ICON_LABEL,
strlen(FileName) > 0 ? FileName : "GDE", 0);
2022-03-08 04:43:05 +08:00
2023-04-11 23:34:31 +08:00
xv_set(frame, FRAME_ICON, tool_icon, 0);
2022-03-08 04:43:05 +08:00
window_main_loop(frame);
exit(0);
}