Example #1
0
void check_infowin(RESULT svar)
{

    if((svar.type==WINDOW_CLICKED)&&(svar.data[0]==WM_CLOSED))
    {
        close_dialog(&info_win);
        menu_icheck(menu_tree,MENU_INFORMATION,FALSE);
        menu_ienable(menu_tree,MENU_INFORMATION,TRUE);
    }
    else if(svar.type==DIALOG_CLICKED)
        switch(svar.data[0])
        {
        case INFO_OK:
            button(&info_win, INFO_OK, CLEAR_STATE, SELECTED);
            close_dialog(&info_win);
            menu_icheck(menu_tree,MENU_INFORMATION,FALSE);
            menu_ienable(menu_tree,MENU_INFORMATION,TRUE);
            break;
        case INFO_REGISTER:
            button(&info_win, INFO_REGISTER, CLEAR_STATE, SELECTED);
            close_dialog(&info_win);
            open_dialog(&register_win);
            break;
        default:
            ;
        }
}
Example #2
0
static int load_windows(XFILE *file)
{
	int type, error;
	long n;

	do
	{
		if ((n = x_fread(file, &type, sizeof(int))) != sizeof(int))
			 return (n < 0) ? (int) n : EEOF;

		switch (type)
		{
		case -1:
			error = 0;
			break;
		case DIR_WIND :
			error = dir_load_window(file);
			if ( !error )
			{
				menu_ienable(menu, MSHOWINF, TRUE); /* DjV 020 190103 */
				menu_ienable(menu, MPRINT, TRUE);	/* DjV 031 150203 */
			}
			break;
		case TEXT_WIND :
			error = txt_load_window(file);
			break;
		}

		if (error < 0)
			return error;
	}
	while (type >= 0);

	return 0;
}
Example #3
0
/****************************************************************
*																*
*					ferme la fenˆtre de tampon					*
*					mais ne libŠre pas la m‚moire				*
*																*
****************************************************************/
void fermer_tampon(void)
{
	register windowptr winptr = (windowptr)&Firstwindow;

	/* ferme la fenˆtre */
	close_window(Tampon -> win, TRUE);

	/* Remove window record from window list. */
	while(winptr -> next)
		if (winptr -> next == Tampon)
			break;
		else
			winptr = winptr -> next;

	if (!winptr -> next)
	{
		error_msg(Z_NO_CORRESPONDING_HANDLE);
		shutdown(FALSE);
	}

	/* on d‚gage de la liste */
	winptr -> next = winptr -> next -> next;

	/* Update the front window pointer. */
	if (!BottomIsMeaningful)
	{
		int place = Tampon -> place;

		for (winptr = Firstwindow; winptr; winptr = winptr -> next)
			if (winptr -> place > place)
				winptr -> place--;

		/* recherche la nouvelle fenˆtre de niveau 0 */
		for (winptr = Firstwindow; winptr; winptr = winptr -> next)
			if (!winptr -> place)
				break;

		if (winptr)
			make_frontwin(winptr);
	}

	if (Tampon -> menu_entry > FAIL)
	{
		memset(MenuShortCuts[6].menu[WINDOW_LIST_1 - CHOIX_FONTE + Tampon -> menu_entry].text, ' ', MenuShortCuts[6].size -SHORTCUT_SIZE -1);
		menu_ienable(Menu, WINDOW_LIST_1 + Tampon -> menu_entry, FALSE);
		menu_icheck(Menu, WINDOW_LIST_1 + Tampon -> menu_entry, FALSE);
		*(PopUpEntryTree[6][WINDOW_LIST_1 - CHOIX_FONTE +1 + Tampon -> menu_entry].ob_spec.free_string +1) = '\0';
		PopUpEntryTree[6][WINDOW_LIST_1 - CHOIX_FONTE +1 + Tampon -> menu_entry].ob_state |= DISABLED;
	}

	/* rend le menu 'Ouvrir Tampon' cliquable */
	menu_ienable(Menu, OUVRIR_TAMPON, 1);
} /* fermer_tampon */
Example #4
0
void check_registerwin(RESULT svar)
{
    short xy[4];
    if((svar.type==WINDOW_CLICKED)&&(svar.data[0]==WM_CLOSED))
    {
        close_dialog(&register_win);
        menu_icheck(menu_tree,MENU_INFORMATION,FALSE);
        menu_ienable(menu_tree,MENU_INFORMATION,TRUE);
    }
    else if(svar.type==DIALOG_CLICKED)
    {
        switch(svar.data[0])
        {
        case REG_EXIT:
            button(&register_win, REG_EXIT, CLEAR_STATE, SELECTED);
            close_dialog(&register_win);
            menu_icheck(menu_tree,MENU_INFORMATION,FALSE);
            menu_ienable(menu_tree,MENU_INFORMATION,TRUE);
            break;
        case REG_REGISTER:
            if(check_key(FALSE))
            {
                tempvar.registered=TRUE;
                button(&register_win, REG_REGISTER, CLEAR_STATE, SELECTED);
                close_dialog(&register_win);
                menu_icheck(menu_tree,MENU_INFORMATION,FALSE);
                menu_ienable(menu_tree,MENU_INFORMATION,TRUE);
            }
            else
            {
                tempvar.registered=FALSE;
                button(&register_win, REG_REGISTER, CLEAR_STATE, SELECTED);
            }
            tempvar.conf_change=TRUE;
            break;
        case REG_LOAD_KEY:
            load_reg_file();
            button(&register_win, REG_LOAD_KEY, CLEAR_STATE, SELECTED);
            wind_get(mailconv_win.ident,WF_WORKXYWH,xy,xy+1,xy+2,xy+3);
            update(&register_win,xy);
            break;
        default:
            ;
        }
    }
}
Example #5
0
int check_registerwin(RESULT svar)
{
  short xy[4];
  if((svar.type==WINDOW_CLICKED)&&(svar.data[0]==WM_CLOSED))
  {
    close_dialog(&register_win);
    menu_icheck(menu_tree,MENU_INFO,FALSE); 
    menu_ienable(menu_tree,MENU_INFO,TRUE); 
  }
  else if(svar.type==DIALOG_CLICKED)
    switch(svar.data[0])
    {
      case REG_EXIT:
        button(&register_win, REG_EXIT, CLEAR_STATE, SELECTED);
        close_dialog(&register_win);
        menu_icheck(menu_tree,MENU_INFO,FALSE); 
        menu_ienable(menu_tree,MENU_INFO,TRUE); 
        break;
      case REG_REGISTER:
        if(check_key(FALSE))
        {
          init_var.registered=TRUE;
          button(&register_win, REG_REGISTER, CLEAR_STATE, SELECTED);
          close_dialog(&register_win);
          menu_icheck(menu_tree,MENU_INFO,FALSE); 
          menu_ienable(menu_tree,MENU_INFO,TRUE); 
        }
        else
        {
          init_var.registered=FALSE;
          button(&register_win, REG_REGISTER, CLEAR_STATE, SELECTED);
        }
        break;
      case REG_LOAD_KEY:
        load_reg_file();
        button(&register_win, REG_LOAD_KEY, CLEAR_STATE, SELECTED);
        xy[0]=screenx;
        xy[1]=screeny;
        xy[2]=screenw;
        xy[3]=screenh;
        update(&register_win,xy);
        break;
    }

  return(FALSE);
}
Example #6
0
int close_socket(int cn)
	{
	int tstat,i,j;
	char out[80];

	tstat = (int)TCP_close(cn, 0);
	  /**/ sprintf(out, "%s", get_err_text(tstat));
	wind_set(win.handle, WF_INFO, (short)((long)out>>16), (short)(out), NULL,
 NULL);/**/
		sprintf(out, "Closing connection");
		wind_set(win.handle, WF_INFO, (short)((long)out>>16), (short)(out), NULL, NULL);
		menu_ienable(menu_ptr,OpenHostO,1);
		menu_ienable(menu_ptr,CloseC,0);
		menu_ienable(menu_ptr,OpenLocalL,1);
for (i=0;i<=10000;i++)
	{for (j=0; j<=100;j++);}
	return (tstat);
}
Example #7
0
int handle_menu(RESULT svar)
{
  if(svar.data[3]!=FAIL)
    objc_change(menu_tree,svar.data[3],0,0,0,0,0,0,O_REDRAW);

  switch(svar.data[4])
  {
    case MENU_INFORMATION:
      menu_icheck(menu_tree,MENU_INFORMATION,TRUE);
      menu_ienable(menu_tree,MENU_INFORMATION,FALSE);
      open_dialog(&info_win);
      break;
    case MENU_FILE_WRITE:
      open_writewin(FALSE);
      break;
    case MENU_FILE_QUIT:
      if(tempvar.conf_change)
        if(alertbox(1,alerts[Q_SAVE_CONF_EXIT])==1)
          save_datafile(TRUE,CONFIGFILE,(char *)config,sizeof(CONFIG));
      return(FALSE);
      break;
    case MENU_CONF_AUTO:
      menu_icheck(menu_tree,MENU_CONF_AUTO,TRUE);
      menu_ienable(menu_tree,MENU_CONF_AUTO,FALSE);
      open_autodatewin();
      break;
    case MENU_CONF_PATH:
      menu_icheck(menu_tree,MENU_CONF_PATH,TRUE);
      menu_ienable(menu_tree,MENU_CONF_PATH,FALSE);
      open_pathwin();
      break;
    case MENU_CONF_MISC:
      break;
    case MENU_CONF_SAVE:
      save_datafile(TRUE,CONFIGFILE,(char *)config,sizeof(CONFIG));
      break;
    case MENU_HELP_INDEX:
      break;
    default:
      break;
  }
  return(TRUE);
}
Example #8
0
/****************************************************************
*																*
*					ouvre la fenˆtre du tampon					*
*																*
****************************************************************/
void ouvrir_tampon(void)
{
	windowptr thewin = Tampon;
	WIN *win;
	GRECT rect;
	t_win_coord *window;
	int dummy;

	/* demande la taille de la fenˆtre */
	window = get_info(1, Tampon, &rect);

	thewin -> fonction.secteur.couleur_curseur = window -> fonction.texte.curseur_c;
	thewin -> fonction.secteur.trame_curseur = window -> fonction.texte.curseur_t;
	thewin -> fonction.text.couleur_texte = window -> fonction.texte.texte_c;
	thewin -> fonction.text.taille_pt = window -> fonction.texte.texte_pt;
	thewin -> fonction.text.couleur_fond = window -> fonction.texte.background_c;
	thewin -> fonction.text.trame_fond = window -> fonction.texte.background_t;

	/* Create the information for the window.  Max size is the desktop. */
	win = open_window(thewin -> title, thewin -> title, NULL, NULL, window -> type, TRUE, 10, 10, &desk, &rect, NULL, secteurproc, NULL, 0);

	/* Check for error. */
	if (win == NULL)
	{
		error_msg(Z_NO_MORE_WINDOW);
		return;
	}

	if (!open_work(&win -> vdi_handle, work_out))
	{
		my_alert(1, FAIL, X_ICN_STOP, Messages(MAIN_9), NULL);
		close_window(win, FALSE);
		return;
	}

	thewin -> win = win;

	vst_point(win -> vdi_handle, thewin -> fonction.text.taille_pt, &dummy, &dummy, &thewin -> fonction.text.taille_w, &thewin -> fonction.text.taille_h);
	vst_color(win -> vdi_handle, thewin -> fonction.secteur.couleur_texte);
	vsf_interior(win -> vdi_handle, FIS_SOLID);
	vswr_mode(win -> vdi_handle, MD_REPLACE);
	vsf_perimeter(win -> vdi_handle, 0);

	/* Insert into windowlist. */
	{
		register windowptr winptr = (windowptr)&Firstwindow;

		while(winptr -> next)
		{
			winptr = winptr -> next;
			winptr -> place++;
		}
	
		winptr -> next = thewin;
	}

	convert_sect(thewin -> fonction.secteur.secteurBin, thewin -> fonction.text.Ligne, thewin -> fonction.secteur.ascii);

	/* initialise les ascenseurs */
	wind_set(win -> handle, WF_HSLSIZE, (int)(thewin -> win -> work.g_w *1000. / max_w), 0, 0, 0);

	wind_set(win -> handle, WF_VSLSIZE, 1000, 0, 0, 0);
	wind_set(win -> handle, WF_VSLIDE, 1000, 0, 0, 0);

	/* entr‚e dans le menu */
	get_menu_entry(thewin, thewin -> title +1);

	make_frontwin(thewin);

	menu_ienable(Menu, OUVRIR_TAMPON, 0);
	ajoute(Firstwindow, Messages(TAMPON_13));
} /* ouvrir_tampon */
Example #9
0
/* ------------------------- */
void menu_on(void)
{
register int f = TRUE, i, fk, l;
register char *m_entry;

if (akt_id == -1)
	f = FALSE;

menu_ienable(menu_adr, MN_TINFO, f);
menu_ienable(menu_adr, MN_TSAVE, f);
menu_ienable(menu_adr, MN_TSVAS, f);
menu_ienable(menu_adr, MN_GOTO, f);
menu_ienable(menu_adr, MN_SONDR, f);
menu_ienable(menu_adr, MN_FORMT, f);
menu_ienable(menu_adr, MN_EINR, f);
menu_ienable(menu_adr, MN_REPL, f);
menu_ienable(menu_adr, MN_RLNEW, f);
menu_ienable(menu_adr, MN_CALC, f);
menu_ienable(menu_adr, MN_TPRNT, f);
menu_ienable(menu_adr, MN_RULER, f);
menu_ienable(menu_adr, MN_RLDEL, f);
menu_ienable(menu_adr, MN_BRIEF, f);
menu_ienable(menu_adr, MN_EDIT, f);
menu_ienable(menu_adr, MN_DATE, f);
menu_ienable(menu_adr, MN_TIME, f);

f &= modus[akt_id];
menu_ienable(menu_adr, MN_BOLD, f);
menu_ienable(menu_adr, MN_ITALC, f);
menu_ienable(menu_adr, MN_UNDER, f);
menu_ienable(menu_adr, MN_LIGHT, f);
menu_ienable(menu_adr, MN_OUTL, f);
menu_ienable(menu_adr, MN_SUBS, f);
menu_ienable(menu_adr, MN_SUPER, f);
menu_ienable(menu_adr, MN_CFONT, f);
menu_ienable(menu_adr, MN_PAINT, f);
menu_ienable(menu_adr, MN_CPFNT, f);
menu_ienable(menu_adr, MN_KILLP, f);
menu_ienable(menu_adr, MN_KFUSS, f);
menu_ienable(menu_adr, MN_PLOAD, f);
menu_ienable(menu_adr, MN_NOTE, f);
menu_ienable(menu_adr, MN_NOTSH, f);
menu_ienable(menu_adr, MN_INHLT, f);

for (i = 0; i < M_POINTS; i++)
	{
	m_entry = menu_adr[menu_id[i]].ob_spec.free_string;
	l = strlen(m_entry);
	
	if (m_entry[l - 3] == 'F')
		if (m_entry[l - 1] == '0')
			fk = 9;
		else
			fk = m_entry[l - 2] - '1';
	else
		fk = -1;
	
	if (fk > -1)
		{
		fk <<= 2;

		if (menu_adr[menu_id[i]].ob_state & DISABLED)
			l = G_BOX;
		else
			l = G_IBOX;
			
		if (back[F1_BUT + fk].ob_type != l)
			{
			back[F1_BUT + fk].ob_type = l;

			if (l == G_BOX)
				{
				back[F1_BUT + fk].ob_spec.index |= 0xFF0000;
				redraw_w0(F1_BUT + fk);
				}
			else
				{
				back[F1_BUT + fk].ob_spec.index &= 0xFF00FFFF;
				back[F1 + fk].ob_state &= ~SHADOWED;
				redraw_w0(F1 + fk);
				back[F1 + fk].ob_state |= SHADOWED;
				}
			}
		}
	}	
}
Example #10
0
/*
 *  Based on current selected icons, figure out which menu items
 *  should be selected (deselected)
 */
static void men_update(OBJECT *tree)
{
    WORD item, nsel, isapp;
    const BYTE *pvalue;
    ANODE *appl;

    pvalue = 0;

    /* enable all items */
    for (item = OPENITEM; item <= PREFITEM; item++)
        menu_ienable(tree, item, 1);

    can_iapp = TRUE;
    can_show = TRUE;
    can_del = TRUE;

    /* disable some items */
    men_list(tree, ILL_ITEM, FALSE);

    nsel = 0;
    for (item = 0; (item=win_isel(G.g_screen, G.g_croot, item)) != 0; nsel++)
    {
        appl = i_find(G.g_cwin, item, NULL, &isapp);
        if (!appl)
            continue;
        switch(appl->a_type)
        {
        case AT_ISFILE:
            if (isapp || is_installed(appl))
                pvalue = ILL_FILE;
            else
            {
                pvalue = ILL_DOCU;
                can_iapp = FALSE;
            }
            break;
        case AT_ISFOLD:
            pvalue = ILL_FOLD;
            can_iapp = FALSE;
            break;
        case AT_ISDISK:
            pvalue = (appl->a_aicon == IG_FLOPPY) ? ILL_FDSK : ILL_HDSK;
            can_iapp = FALSE;
            break;
        case AT_ISTRSH:                 /* Trash */
            pvalue = ILL_TRASH;
            can_del = FALSE;
            break;
        }
        men_list(tree, pvalue, FALSE);       /* disable certain items */
    }

    if (win_ontop())
        pvalue = ILL_DESKTOP;
    else
        pvalue = ILL_NOTOP;
    if (pvalue == ILL_DESKTOP)
        men_list(tree, pvalue, TRUE);
    else
        men_list(tree, pvalue, FALSE);

    if (nsel != 1)
    {
        if (nsel)
        {
            pvalue = ILL_YSEL;
            can_show = FALSE;
        }
        else
        {
            pvalue = ILL_NOSEL;
            can_show = FALSE;
            can_del = FALSE;
            can_iapp = FALSE;
        }
        men_list(tree, pvalue, FALSE);
    }

#if CONF_WITH_SHUTDOWN
    menu_ienable(tree, QUITITEM, can_shutdown());
#else
    menu_ienable(tree, QUITITEM, 0);
#endif

#if WITH_CLI == 0
    menu_ienable(tree, CLIITEM, 0);
#endif

}
Example #11
0
/*
 *  Enable/Disable the menu items in dlist
 */
static void men_list(OBJECT *mlist, const BYTE *dlist, WORD enable)
{
    while (*dlist)
        menu_ienable(mlist, *dlist++, enable);
}
Example #12
0
void check_path_win(const RESULT svar)
{
#ifdef LOGGING
Log(LOG_FUNCTION,"check_path_win(...)\n");
#endif

  if((svar.type==WINDOW_CLICKED)&&(svar.data[SVAR_WINDOW_MESSAGE]==WM_CLOSED))
  {
    close_dialog(&path_win);
  }
  else if(svar.type==DIALOG_CLICKED)
    switch(svar.data[SVAR_OBJECT])
    {
      case PATH_CHOOSE_MAIL:
        sprintf(tempvar.tempstring,"Mailclient|%s|%s|%s|-%s",MAILTYPE_T_ANTMAIL,MAILTYPE_T_NEWSIE,MAILTYPE_T_INFITRA,MAILTYPE_T_MYMAIL);
        tempconf.mailtype=popup(tempvar.tempstring,tempconf.mailtype,path_win.dialog,PATH_CHOOSE_MAIL,path_win.dialog[PATH_CHOOSE_MAIL].ob_spec);
        button(&path_win, PATH_CHOOSE_MAIL, CLEAR_STATE, SELECTED,TRUE);
        break;
      case PATH_NEWSDIR:
        strcpy(tempvar.lastpath,tempconf.newsdir);
        strcpy(tempvar.lastfile,"*.*");
        fsel_exinput(tempvar.lastpath,tempvar.lastfile,(short *)&tempvar.tempcounter,(char *)alerts[FS_NEWSDIR]);
        if(tempvar.tempcounter)
        {
          strcpy(tempconf.newsdir,tempvar.lastpath);
          ((char *)strrchr(tempconf.newsdir,'\\'))[1]='\0';
          str2ted(path_win.dialog,PATH_NEWSDIR,tempconf.newsdir);
          button(&path_win, PATH_NEWSDIR,UPDATE,NOLL,TRUE);
        }
        break;
      case PATH_EDITOR:
        if(strrchr(tempconf.editor,'\\')!=NOLL)
        {
          strcpy(tempvar.lastpath,tempconf.editor);
          ((char *)strrchr(tempvar.lastpath,'\\'))[1]='\0';
          strcat(tempvar.lastpath,"*.*");
          strcpy(tempvar.lastfile,strrchr(tempconf.editor,'\\')+1);
        }
        else
        {
          strcpy(tempvar.lastpath,system_dir);
          strcat(tempvar.lastpath,"*.*");
          strcpy(tempvar.lastfile,"");
        }
        fsel_exinput(tempvar.lastpath,tempvar.lastfile,(short *)&tempvar.tempcounter,(char *)alerts[FS_EDITOR]);
        if(tempvar.tempcounter)
        {
          strcpy(tempconf.editor,tempvar.lastpath);
          ((char *)strrchr(tempconf.editor,'\\'))[1]='\0';
          strcat(tempconf.editor,tempvar.lastfile);
          str2ted(path_win.dialog,PATH_EDITOR,tempvar.lastfile);
          button(&path_win, PATH_EDITOR,UPDATE,NOLL,TRUE);
        }
        break;
      case PATH_NNTP:
        if(strrchr(tempconf.nntpd,'\\')!=NOLL)
        {
          strcpy(tempvar.lastpath,tempconf.nntpd);
          ((char *)strrchr(tempvar.lastpath,'\\'))[1]='\0';
          strcat(tempvar.lastpath,"*.*");
          strcpy(tempvar.lastfile,strrchr(tempconf.nntpd,'\\')+1);
        }
        else
        {
          strcpy(tempvar.lastpath,system_dir);
          strcat(tempvar.lastpath,"*.*");
          strcpy(tempvar.lastfile,"");
        }
        fsel_exinput(tempvar.lastpath,tempvar.lastfile,(short *)&tempvar.tempcounter,(char *)alerts[FS_NNTP]);
        if(tempvar.tempcounter)
        {
          strcpy(tempconf.nntpd,tempvar.lastpath);
          ((char *)strrchr(tempconf.nntpd,'\\'))[1]='\0';
          strcat(tempconf.nntpd,tempvar.lastfile);
          str2ted(path_win.dialog,PATH_NNTP,tempvar.lastfile);
          button(&path_win, PATH_NNTP,UPDATE,NOLL,TRUE);
        }
        break;
      case PATH_MAILDATA:
        if(strrchr(tempconf.maildata,'\\')!=NOLL)
        {
          strcpy(tempvar.lastpath,tempconf.maildata);
          ((char *)strrchr(tempvar.lastpath,'\\'))[1]='\0';
          strcat(tempvar.lastpath,"*.*");
          strcpy(tempvar.lastfile,strrchr(tempconf.maildata,'\\')+1);
        }
        else
        {
          strcpy(tempvar.lastpath,system_dir);
          strcat(tempvar.lastpath,"*.*");
          strcpy(tempvar.lastfile,"");
        }
        if(tempconf.mailtype==MAILTYPE_ANTMAIL)
          fsel_exinput(tempvar.lastpath,tempvar.lastfile,(short *)&tempvar.tempcounter,(char *)alerts[FS_ANTMAIL]);
        else if(tempconf.mailtype==MAILTYPE_NEWSIE)
          fsel_exinput(tempvar.lastpath,tempvar.lastfile,(short *)&tempvar.tempcounter,(char *)alerts[FS_NEWSIE]);
        else if(tempconf.mailtype==MAILTYPE_INFITRA)
          fsel_exinput(tempvar.lastpath,tempvar.lastfile,(short *)&tempvar.tempcounter,(char *)alerts[FS_INFITRA]);
        else if(tempconf.mailtype==MAILTYPE_MYMAIL)
          fsel_exinput(tempvar.lastpath,tempvar.lastfile,(short *)&tempvar.tempcounter,(char *)alerts[FS_MYMAIL]);
        if(tempvar.tempcounter)
        {
          strcpy(tempconf.maildata,tempvar.lastpath);
          ((char *)strrchr(tempconf.maildata,'\\'))[1]='\0';
          strcat(tempconf.maildata,tempvar.lastfile);
          str2ted(path_win.dialog,PATH_MAILDATA,tempvar.lastfile);
          button(&path_win, PATH_MAILDATA,UPDATE,NOLL,TRUE);
        }
        break;
      case PATH_SIGNATUR:
        if(strrchr(tempconf.signature,'\\')!=NOLL)
        {
          strcpy(tempvar.lastpath,tempconf.signature);
          ((char *)strrchr(tempvar.lastpath,'\\'))[1]='\0';
          strcat(tempvar.lastpath,"*.*");
          strcpy(tempvar.lastfile,strrchr(tempconf.signature,'\\')+1);
        }
        else
        {
          strcpy(tempvar.lastpath,system_dir);
          strcat(tempvar.lastpath,"*.*");
          strcpy(tempvar.lastfile,"");
        }
        fsel_exinput(tempvar.lastpath,tempvar.lastfile,(short *)&tempvar.tempcounter,(char *)alerts[FS_SIGNATURE]);
        if(tempvar.tempcounter)
        {
          strcpy(tempconf.signature,tempvar.lastpath);
          ((char *)strrchr(tempconf.signature,'\\'))[1]='\0';
          strcat(tempconf.signature,tempvar.lastfile);
          str2ted(path_win.dialog,PATH_SIGNATUR,tempvar.lastfile);
          button(&path_win,PATH_SIGNATUR,UPDATE,NOLL,TRUE);
        }
        break;
      case PATH_OK:
        strcpy(config.nntpd,tempconf.nntpd);
        strcpy(config.editor,tempconf.editor);
        ted2str(path_win.dialog,PATH_STRINGSERV,config.stringserver);
        
        if(strcmp(config.maildata, tempconf.maildata)||(config.mailtype!=tempconf.mailtype))
        {
          strcpy(config.maildata,tempconf.maildata);
          if(tempconf.mailtype==MAILTYPE_ANTMAIL)
            load_antmail();
          else if(tempconf.mailtype==MAILTYPE_NEWSIE)
            load_newsie();
          else if(tempconf.mailtype==MAILTYPE_INFITRA)
            load_infitra();
          else if(tempconf.mailtype==MAILTYPE_MYMAIL)
            load_mymail();
        }
        else
          strcpy(config.maildata,tempconf.maildata);
        config.mailtype=tempconf.mailtype;
        if(strcmp(config.newsdir,tempconf.newsdir))
        {
          if(msglist_win.status!=WINDOW_CLOSED)
            close_msglistwin();
          if(read_win.status!=WINDOW_CLOSED)
            close_readwin();
          if(sublist_win.status!=WINDOW_CLOSED)
            close_sublistwin();
          if(unsublist_win.status!=WINDOW_CLOSED)
            close_unsublistwin();
          close_dialog(&server_win);
          if(active.ungroups)
            free(active.ungroups),active .ungroups=NULL;
          free_list(&active.mlist);
          menu_ienable(menu_tree,MENU_REPLY_E,FALSE); 
          menu_ienable(menu_tree,MENU_REPLY_G,FALSE);
          menu_ienable(menu_tree,MENU_WRITE_NEW,FALSE); 
          menu_ienable(menu_tree,MENU_CHANGE_MESS,FALSE); 
          menu_ienable(menu_tree,MENU_SAVE_MESS,FALSE);
          menu_ienable(menu_tree,MENU_DEL_FLAGS,FALSE);
          menu_ienable(menu_tree,MENU_SET_FLAGS,FALSE);
          strcpy(config.newsdir,tempconf.newsdir);
          load_active();
        }  
        else
          strcpy(config.newsdir,tempconf.newsdir);
        strcpy(config.signature,tempconf.signature);
        button(&path_win, PATH_OK, CLEAR_STATE, SELECTED,TRUE);
        close_dialog(&path_win);
        break;
      case PATH_CANCEL:
        button(&path_win, PATH_CANCEL, CLEAR_STATE, SELECTED,FALSE);
        close_dialog(&path_win);
        break;
      default:;
    }
 
  Return;
}
Example #13
0
/********************************************************************
*																	*
*					cherche une chaŒne (gestion)					*
*																	*
********************************************************************/
boolean search_proc(t_dialog *dialog, int exit)
{
	char *text;
	int c, i;

	switch (exit)
	{
		case SEARCH_ANNULER:
			return TRUE;

		case ASCII_ACTIF:
			ob_set_cursor(dialog -> info, SEARCH_ASCII, MAX_EDIT, TRUE);
			break;

		case HEXA_ACTIF:
			ob_set_cursor(dialog -> info, SEARCH_HEXA, MAX_EDIT, TRUE);
			break;

		case SEARCH_CALC:
			if (dialog -> tree[SEARCH_HEXA].ob_spec.tedinfo -> te_ptext[0] == '\0' && dialog -> tree[SEARCH_ASCII].ob_spec.tedinfo -> te_ptext[0] == '\0')
				break;

			if (ob_isstate(dialog -> tree, ASCII_ACTIF, SELECTED) && dialog -> tree[SEARCH_ASCII].ob_spec.tedinfo -> te_ptext[0] == '\0')
			{
				ob_dostate(dialog -> tree, HEXA_ACTIF, SELECTED);
				ob_undostate(dialog -> tree, ASCII_ACTIF, SELECTED);
				ob_set_cursor(dialog -> info, SEARCH_HEXA, MAX_EDIT, TRUE);

				ob_draw_chg(dialog -> info, ASCII_ACTIF, NULL, FAIL);
				ob_draw_chg(dialog -> info, HEXA_ACTIF, NULL, FAIL);
			}
			else
				if (ob_isstate(dialog -> tree, HEXA_ACTIF, SELECTED) && dialog -> tree[SEARCH_HEXA].ob_spec.tedinfo -> te_ptext[0] == '\0')
				{
					ob_undostate(dialog -> tree, HEXA_ACTIF, SELECTED);
					ob_dostate(dialog -> tree, ASCII_ACTIF, SELECTED);
					ob_set_cursor(dialog -> info, SEARCH_ASCII, MAX_EDIT, TRUE);

					ob_draw_chg(dialog -> info, ASCII_ACTIF, NULL, FAIL);
					ob_draw_chg(dialog -> info, HEXA_ACTIF, NULL, FAIL);
				}

			if (ob_isstate(dialog -> tree, ASCII_ACTIF, SELECTED))
			{
				strcpy(SearchString, dialog -> tree[SEARCH_ASCII].ob_spec.tedinfo -> te_ptext);
				SearchLength = (int)strlen(SearchString);
			}
			else
			{
				text = dialog -> tree[SEARCH_HEXA].ob_spec.tedinfo -> te_ptext;
				for (i=0; i<SEARCH_PATTERN_SIZE && text[i*2]; i++)
				{
					sscanf(&text[i*2], "%02x", &c);
					SearchString[i] = c;
				}
				SearchString[i] = '\0';
				SearchLength = i;
			}

			text = dialog -> tree[SEARCH_ASCII].ob_spec.tedinfo -> te_ptext;
			for (i=0; i<SearchLength; i++)
				if (SearchString[i])
					text[i] = (unsigned char)SearchString[i];
				else
					text[i] = '.';
			text[i] = '\0';

			text = dialog -> tree[SEARCH_HEXA].ob_spec.tedinfo -> te_ptext;
			for (i=0; i<min(20, SearchLength); i++)
				sprintf(&text[i*2], "%02X", (unsigned char)SearchString[i]);
			text[2*i] = '\0';

			ob_draw(dialog -> info, SEARCH_ASCII);
			ob_draw(dialog -> info, SEARCH_HEXA);

			/* Exit-Objekt selektiert? */
			if (ob_isstate(dialog -> tree, exit, SELECTED))
			{
				/* angew„hltes Objekt deselektieren und neu zeichnen */
				ob_undostate(dialog -> tree, exit, SELECTED);
				ob_draw_chg(dialog -> info, exit, NULL, FAIL);
			}
			break;
	}

	if (exit == SEARCH_GO)
	{
		/* Exit-Objekt selektiert? */
		if (ob_isstate(dialog -> tree, exit, SELECTED))
		{
			/* angew„hltes Objekt deselektieren und neu zeichnen */
			ob_undostate(dialog -> tree, exit, SELECTED);
			ob_draw_chg(dialog -> info, exit, NULL, FAIL);
		}

		my_close_dialog(dialog);

		/* attend la fin des redessins */
		Event_Timer(0, 0, TRUE);

		if (dialog -> tree[SEARCH_HEXA].ob_spec.tedinfo -> te_ptext[0] == '\0' && dialog -> tree[SEARCH_ASCII].ob_spec.tedinfo -> te_ptext[0] == '\0')
		{
			menu_ienable(Menu, CHERCHER_NOUVEAU, 0);
			my_alert(1, FAIL, X_ICN_STOP, Messages(SEARCH_4), NULL);
			return TRUE;
		}

		if (ob_isstate(dialog -> tree, ASCII_ACTIF, SELECTED) && dialog -> tree[SEARCH_ASCII].ob_spec.tedinfo -> te_ptext[0] == '\0')
		{
			ob_dostate(dialog -> tree, HEXA_ACTIF, SELECTED);
			ob_undostate(dialog -> tree, ASCII_ACTIF, SELECTED);
			ob_set_cursor(dialog -> info, SEARCH_HEXA, MAX_EDIT, TRUE);

			ob_draw_chg(dialog -> info, ASCII_ACTIF, NULL, FAIL);
			ob_draw_chg(dialog -> info, HEXA_ACTIF, NULL, FAIL);
		}
		else
			if (ob_isstate(dialog -> tree, HEXA_ACTIF, SELECTED) && dialog -> tree[SEARCH_HEXA].ob_spec.tedinfo -> te_ptext[0] == '\0')
			{
				ob_undostate(dialog -> tree, HEXA_ACTIF, SELECTED);
				ob_dostate(dialog -> tree, ASCII_ACTIF, SELECTED);
				ob_set_cursor(dialog -> info, SEARCH_ASCII, MAX_EDIT, TRUE);

				ob_draw_chg(dialog -> info, ASCII_ACTIF, NULL, FAIL);
				ob_draw_chg(dialog -> info, HEXA_ACTIF, NULL, FAIL);
			}

		if (ob_isstate(dialog -> tree, ASCII_ACTIF, SELECTED))
		{
			strcpy(SearchString, dialog -> tree[SEARCH_ASCII].ob_spec.tedinfo -> te_ptext);
			SearchLength = (int)strlen(SearchString);
		}
		else
		{
			text = dialog -> tree[SEARCH_HEXA].ob_spec.tedinfo -> te_ptext;
			for (i=0; i<20 && text[i*2]; i++)
			{
				sscanf(&text[i*2], "%02x", &c);
				SearchString[i] = c;
			}
			SearchString[i] = '\0';
			SearchLength = i;
		}

		menu_ienable(Menu, CHERCHER_NOUVEAU, 1);

		switch (dialog -> thewin -> type)
		{
			case SECTEUR:
				if (SavePos)
					marquer_position(dialog -> thewin);

				search_secteur(dialog -> thewin, ob_isstate(dialog -> tree, DIFF_MAJ_MIN, SELECTED), TRUE);

				if (dialog -> thewin -> fonction.secteur.fichier)
					print_secteur_file(dialog -> thewin);
				break;

			case FICHIER:
			case FICHIER_FS:
			case RAW_FLOPPY:
			case RAW_HARD:
				if (SavePos)
					marquer_position(dialog -> thewin);

				search_secteur(dialog -> thewin, ob_isstate(dialog -> tree, DIFF_MAJ_MIN, SELECTED), TRUE);
				break;

			case TAMPON:
				search_tampon(dialog -> thewin, ob_isstate(dialog -> tree, DIFF_MAJ_MIN, SELECTED));
		}

		return TRUE;
	}

	return FALSE;
} /* search_proc */
Example #14
0
/* static  DjV 017 290103 */
void itm_set_menu(WINDOW *w)
{
	int n, *list, i = 0;
	boolean showinfo = FALSE, ch_icon = FALSE, enab = FALSE, enab2 = FALSE; /* DjV 029 030103 added enab2 */
	char drive[8]; /* DjV 006 291202 */

	ITMTYPE type;

	if ((w == NULL) || (xw_exist(w) == FALSE) || (itm_list(w, &n, &list) == FALSE))
	{
		w = NULL;
		n = 0;
	}

	while ((i < n) && ((showinfo == FALSE) || (ch_icon == FALSE)))
	{
		type = itm_type(w, list[i++]);
		if ((type != ITM_PRINTER) && (type != ITM_TRASH) && (type != ITM_PREVDIR))
			showinfo = TRUE;
		ch_icon = TRUE;
	}

	/* DjV 020 120103 ---vvv--- */
	if ( ( n == 0 ) && ( w=xw_top() ) != NULL && xw_type(w) == DIR_WIND  )
		 showinfo = TRUE;
	/* DjV 020 120103 ---^^^--- */

	if (n == 1)
		type = itm_type(w, list[0]);

	enab = ((n == 1) && (type != ITM_TRASH) && (type != ITM_PRINTER)) ? 1 : 0;
	/* menu_ienable(menu, MOPEN, enab); DjV 028 280103 */
	menu_ienable(menu, MSHOWINF, (showinfo == TRUE) ? 1 : 0);
	menu_ienable(menu, MSEARCH, (showinfo == TRUE && n > 0 ) ? 1 : 0); /* DjV 017 150103 DjV 017 280103 added n > 0 */
	menu_ienable(menu, MAPPLIK, ((n == 1) && (type == ITM_PROGRAM)) ? 1 : 0);

	/* DjV 025 140103  DjV 029 030103 ---vvv--- */
	/* 
	 * Enable delete only if there are only files, programs and folders among selected items
	 * Enable print only if there are only files among selected or
	 * a dir window is open (to print directory)
	 */
	enab = n > 0; 
	enab2 = enab; /* DjV 029 030103 will always sooner then enab become false */
	i = 0;
	while ( (i < n) && enab )
	{
		type = itm_type(w, list[i++]);
		enab =    type == ITM_FILE
		       || type == ITM_FOLDER
		       || type == ITM_PROGRAM			/* HR 240203 */
		       ;  
		enab2 = type == ITM_FILE;  
	}	

	if ( ( n == 0 ) && ( ( w = xw_top() ) != NULL )  ) 	/* DjV 029 150203 */
		if ( xw_type(w) == DIR_WIND )					/* DjV 031 150203 */
				enab2 = 1; 								/* DjV 029 150203 */

	menu_ienable(menu, MDELETE, enab);
	menu_ienable(menu, MPRINT, enab2);
	/* DjV 025 140103 DjV 029 030103 ---^^^--- */

	/* DjV 006 291202 ---vvv--- */
  	/* 
	 * enable disk formatting and disk copying
	 * only if single drive is selected and it is A or B;
	 * use the opportunity to say which drive is to be used 
	 * (is it always A or B even in other filesystems ?)
	 */
	enab=FALSE;
	if ( (n == 1) && (type == ITM_DRIVE) )
	{
		strsncpy ( drive, itm_fullname ( w, list[0] ) , sizeof(drive) );		/* HR 120203: secure cpy */
		drive[0] &= 0xDF; /* to uppercase */
		if (   ( drive[0] >= 'A' )
		    && ( drive[0] <= 'B' )
		    && ( drive[1] == ':' )
		   )
		{  
			floppy = drive[0];      /* i.e. floppy=65dec or 66dec */
			enab = TRUE;
		}  
	}

#if MFFORMAT				/* HR 050303 */
	menu_ienable(menu, MFCOPY, enab );
	menu_ienable(menu, MFFORMAT, enab );
#endif
	
	/* DjV 006 291202 ---^^^--- */

	if ((ch_icon == TRUE) && (xw_type(w) == DESK_WIND))
	{
		menu_ienable(menu, MREMICON, 1);
		menu_ienable(menu, MCHNGICN, 1);
	}
	else
	{
		menu_ienable(menu, MREMICON, 0);
		menu_ienable(menu, MCHNGICN, 0);
	}

	selection.w = (n > 0) ? w : NULL;
	selection.selected = (n == 1) ? list[0] : -1;
	selection.n = n;

	if (n > 0)
		free(list);
}
Example #15
0
int handle_menu(RESULT svar)
{
  
  if(svar.data[SVAR_OBJECT_MENU_ROW]!=FAIL)
    objc_change(menu_tree,svar.data[SVAR_OBJECT_MENU_ROW],0,0,0,0,0,0,O_REDRAW);

  switch(svar.data[SVAR_OBJECT])
  {
    case MENU_INFO:
      menu_icheck(menu_tree,MENU_INFO,TRUE);
      menu_ienable(menu_tree,MENU_INFO,FALSE);
      open_dialog(&info_win,NULL);
      break;
    case MENU_FILE_DISABL:
      deinit_port();
      break;
    case MENU_FILE_ENABLE:
      config->disabled=FALSE;
      init_port();
      break;
    case MENU_LIST_OWIND:
      open_listwin();
      break;
    case MENU_LIST_SAVE:
      if(!tempvar.accessory)
      {
        save_list();
        tempvar.list_change=FALSE;
      }
      break;
    case MENU_LIST_EXPORT:
      menu_icheck(menu_tree,MENU_LIST_EXPORT,TRUE);
      menu_ienable(menu_tree,MENU_LIST_EXPORT,FALSE);
      open_exportwin(TRUE);
    case MENU_SAVE_SETUP:
      save_datafile(TRUE,CONFIGFILE,(char *)config,sizeof(CONFIG));
      tempvar.conf_change=FALSE;
      break;
    case MENU_SETUP:
      menu_icheck(menu_tree,MENU_SETUP,TRUE);
      menu_ienable(menu_tree,MENU_SETUP,FALSE);
      set_timer(FAIL);
      open_setupwin();
      break;
    case MENU_LOG_VIEW:
      open_logwin();
      break;
    case MENU_QUIT:
      if(config->save_exit)
      {
        save_datafile(TRUE,CONFIGFILE,(char *)config,sizeof(CONFIG));
        if(!tempvar.accessory)
        {
          save_list();
          tempvar.list_change=FALSE;
        }
        tempvar.conf_change=FALSE;
      }
      if(tempvar.conf_change)
        if(alertbox(1,alerts[Q_SAVE_CONF_EXIT])==1)
          save_datafile(TRUE,CONFIGFILE,(char *)config,sizeof(CONFIG));
      if((tempvar.list_change)&&(!tempvar.accessory))
        if(alertbox(1,alerts[Q_SAVE_LIST_EXIT])==1)
          save_list();
      return(FALSE);
      break;
    case MENU_HELP_INDEX:
    {
      long stguide_id;
      char temprow[MAXSTRING];
      stguide_id=appl_find("ST-GUIDE");
      strcpy(temprow,"*:\\firecall.hyp");
      if(stguide_id!=FAIL)
      {
        svar.data[0]=(short)0x4711;
        svar.data[1]=(short)ap_id;
        svar.data[2]=(short)0;
        svar.data[3]=(short)temprow >> 16;
        svar.data[4]=(short)temprow & 0xffff;
        svar.data[5]=(short)0;
        svar.data[6]=(short)0;
        svar.data[7]=(short)0;
        appl_write(stguide_id,16,svar.data);
      }
      break;
    }  
    default:
      break;
  }
Example #16
0
/* MAIN()
 * ================================================================
 */
VOID
main( VOID )
{
	WORD    button;
	BOOLEAN done;
	OBJECT  *tree;
       

	appl_init();

	phys_handle = graf_handle( &gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox );

	open_vwork();
	
        graf_mouse( ARROW, 0L );
        
        rsrc_load( "DEMO.RSC" );

        rsrc_gaddr( 0, MENUBAR, &ad_menubar );
        rsrc_gaddr( 0, ATREE, &ad_tree );
	rsrc_gaddr( 0, FONTTREE, &ad_fonts );
	rsrc_gaddr( 0, STREE, &ad_style );
	rsrc_gaddr( 0, POSTREE, &ad_position );
	rsrc_gaddr( 0, CTREE, &ad_color );
        rsrc_gaddr( 0, PTREE, &ad_pattern );
	rsrc_gaddr( 0, MTREE, &ad_modem );

	rsrc_gaddr( 0, BAUDRATE, &ad_baudrate );
	rsrc_gaddr( 0, PARTREE, &ad_parity );
	rsrc_gaddr( 0, BITTREE, &ad_bittree );
	rsrc_gaddr( 0, STOPTREE, &ad_stoptree );
	rsrc_gaddr( 0, PORTTREE, &ad_porttree );
	rsrc_gaddr( 0, FLOWTREE, &ad_flowtree );

	rsrc_gaddr( 0, LTREE, &ad_list );
	rsrc_gaddr( 0, TOOLBOX, &ad_tools );
	rsrc_gaddr( 0, BLANK, &ad_blank );
	rsrc_gaddr( 0, TOOLBOX2, &ad_box2 );
	rsrc_gaddr( 0, TOOLBAR, &ad_box3 );

	rsrc_gaddr( 0, FONT2, &ad_font2 );


	/* Attach all Submenus that are being attached */
	AttachMenus();


	/* CheckMark the Current Menu Items in their respective menus */
	menu_icheck( ad_baudrate, CurBaudRate, 1 );
	menu_icheck( ad_parity, CurParity, 1 );
	menu_icheck( ad_bittree, CurBits, 1 );
	menu_icheck( ad_stoptree, CurStopBits, 1 );
	menu_icheck( ad_porttree, CurPort, 1 );
	menu_icheck( ad_flowtree, CurFlow, 1 );

	menu_icheck( ad_style, CurStyle, 1 );
	menu_icheck( ad_position, CurPos, 1 );
	menu_icheck( ad_fonts, CurFonts, 1 );
	menu_icheck( ad_font2, CurFont2, 1 );

        /* display menubar stuff here */
        menu_bar( ad_menubar, TRUE );

	/* initialize windows */
        wind_get( 0, WF_FULLXYWH, &desk.g_x, &desk.g_y, &desk.g_w, &desk.g_h );
	cur_tree = ad_tools;
	menu_flag = TRUE;			/* Set Toggle Flags */
	SubFlag   = TRUE;
	ToolFlag  = TRUE;

	CurRect.g_x = desk.g_x;
	CurRect.g_y = desk.g_y;
	CurRect.g_w = 320;
	CurRect.g_h = 200;

	InitObjects();

	InitWindow();
	menu_ienable( ad_menubar, FOPEN, 0 );
	menu_ienable( ad_menubar, FCLOSE, 1 );



        done = FALSE;
	do
	{

	    evnt_mesag( msg );
	    
	    wind_update( BEG_UPDATE );

	    if( msg[0] == MN_SELECTED )
	    {
		/* msg[7] is the parent of FQUIT - which the user can't know */
		ptr = ( OBJECT **)&msg[5];
	if( *ptr == ad_menubar )
		{
		   switch( msg[4] )
		   {
		      case FQUIT:
				  button = form_alert( 1, "[1][ |  EXIT PROGRAM? ][OK|Cancel]");
				  if( button == 1 )
		 		      done = TRUE;
		       		  break;

		      case ABOUTX: execform( ad_tree, 0 );
				   break;

		      case PHONE: do_modem();
				  break;

		      case TABOUT: /* Enable, Disable About PLUS change TEXT */
				   menu_flag ^= 1;
				   menu_ienable( ad_menubar, ABOUTX, menu_flag );
				   menu_text( ad_menubar, TABOUT, TextAbout[ menu_flag ] );

				  if( menu_flag )
				    menu_text( ad_menubar, ABOUTX, "  About Demo...     " );
				  else
				    menu_text( ad_menubar, ABOUTX, "  Disabled...       " );
				  break;

		       case TSUB: /* Enable/Disable all Submenus */
				  SubFlag ^= 1;
				  menu_text( ad_menubar, TSUB, TextSubMenu[ SubFlag ] );
				  if( SubFlag )
				    AttachMenus();
				  else
				    DetachMenus();
				  break;

		       case SLISTS: DoList();			/* Do A Drop Down List Dialog */
				    break;

		       case TOOLFLAG: /* Enable/Disable ToolBox */
				      ToolFlag ^= 1;
				      menu_text( ad_menubar, TOOLFLAG, TextToolBox[ ToolFlag ] );
				      if( ToolFlag )
				      {
					*( (LONG *)&tree_data[0] ) = ( LONG )cur_tree;
					wind_set( wid, WF_TOOLBAR, tree_data[0], tree_data[1], dummy, dummy );
				      }
				      else
					wind_set( wid, WF_TOOLBAR, 0, 0, dummy, dummy );
				      break;

		        case SWITCH: /* Switch ToolBoxes */
					if( cur_tree == ad_tools )
					   cur_tree = ad_box2;
					else if( cur_tree == ad_box2 ) {
					         cur_tree = ad_box3;

					         ActiveTree( ad_fonts );
      						 textptr = ObString( CurFonts );
						 strncpy( &tbuff[0], &textptr[1], 28 );

      						 ActiveTree( ad_box3 );
      						 TedText( FBUTT1 ) = &tbuff[0];
					     }
					     else
					       cur_tree = ad_tools;
					*( (LONG *)&tree_data[0] ) = ( LONG )cur_tree;
					ToolFlag = TRUE;
	  	    		        menu_text( ad_menubar, TOOLFLAG, TextToolBox[ ToolFlag ] );
					wind_set( wid, WF_TOOLBAR, tree_data[0], tree_data[1], dummy, dummy );
				     break;

			case FCLOSE: /* close Window */
				     if( wid ) {
					wind_get( wid, WF_CURRXYWH,
						  &CurRect.g_x, &CurRect.g_y,
						  &CurRect.g_w, &CurRect.g_h );
			                wind_close( wid );
			                wind_delete( wid );
			                wid = 0;
					menu_ienable( ad_menubar, FCLOSE, 0 );
					menu_ienable( ad_menubar, FOPEN, 1 );
				     }
				     break;

			case FOPEN:  /* open Window */
				     if( !wid ) {
					InitWindow();
					menu_ienable( ad_menubar, FOPEN, 0 );
					menu_ienable( ad_menubar, FCLOSE, 1 );
				     }				 
				     break;

		      default:
				   break;
		   }
		}

		
		/* MENU SELECTED -> Font Style Menu Clicked on as a SUBMENU from the Menubar*/
		if( *ptr == ad_style )
		{
		   menu_icheck( ad_style, CurStyle, 0 );	/* Turn OFF Old Checkmark */
		   menu_icheck( ad_style, msg[4], 1 );		/* Turn ON New CheckMark  */
		   CurStyle = msg[4];				/* Update Current Var     */
		   menu_istart( 1, ad_style, ROOT, CurStyle );	/* Reset Starting Position*/
		}


		/* MENU SELECTED -> Font Position Clicked on as a SUBMENU from the menubar */
		if( *ptr == ad_position )
		{
		   menu_icheck( ad_position, CurPos, 0 );
		   menu_icheck( ad_position, msg[4], 1 );
		   CurPos = msg[4];
		   menu_istart( 1, ad_position, ROOT, CurPos );
		}


		/* MENU SELECTED -> Fonts Menu Clicked on as a SUBMENU from the menubar */
		if( *ptr == ad_fonts )
		{
		   menu_icheck( ad_fonts, CurFonts, 0 );
		   menu_icheck( ad_fonts, msg[4], 1 );
		   CurFonts = msg[4];
		   menu_istart( 1, ad_fonts, ROOT, CurFonts );
		}

		menu_tnormal( ad_menubar, msg[3], TRUE );
            }

	    if( msg[0] != MN_SELECTED ) {
		switch( msg[0] ) {
		   case WM_FULLED:
			DoFull( msg[3] );
			break;

		   case WM_REDRAW:
			 DoRedraw( msg );
			 break;

		   case WM_ARROWED:
		   case WM_HSLID:
		   case WM_VSLID:
			 break;

		   case WM_MOVED:
			 if( msg[3] == wid ) {
			    wind_set( wid, WF_CURRXYWH, msg[4],
				      msg[5], msg[6], msg[7] );
			 }
			 break;

		   case WM_TOPPED:
			 if( msg[3] == wid ) {
			    wind_set( wid, WF_TOP );
			 }
			 break;

		   case WM_CLOSED:
			 if( msg[3] == wid ) {
			    wind_get( wid, WF_CURRXYWH,
				      &CurRect.g_x, &CurRect.g_y,
				      &CurRect.g_w, &CurRect.g_h );

			    wind_close( wid );
			    wind_delete( wid );
			    wid = 0;
			    menu_ienable( ad_menubar, FCLOSE, 0 );
			    menu_ienable( ad_menubar, FOPEN, 1 );
			 }
			 break;

		   case WM_SIZED:
			DoSizer( msg );
			break;

		   case WM_TOOLBAR:
			if( msg[3] == wid ) {
			      /* Button Handling for ToolBox #1 */
			      if( cur_tree == ad_tools ) {
			        switch( msg[4] ) {
			           case T1B1:  button = B1B1;
				        break;
			           case T1B2:  button = B1B2;
				        break;
			           case T1B3:  button = B1B3;
				        break;
			           case T1B4:  button = B1B4;
				        break;
			           case T1B5:  button = B1B5;
				        break;
				}
			      }

			      /* Button Handling for TOOLBOX 2 */
			      if( cur_tree == ad_box2 ) {
			        switch( msg[4] ) {
			           case T2I1:  button = T2B1;
				        break;
			           case T2I2:  button = T2B2;
				        break;
			           case T2I3:  button = T2B3;
				        break;
			           case T2I4:  button = T2B4;
				        break;
			           case T2I5:  button = T2B5;
				        break;
				}
			      }

			      /* Word Processing Tree */
			      if( cur_tree == ad_box3 ) {
				switch( msg[4] ) {
				   case FBUTT1:
				   case FBUTT2: DoFonts();
						break;

				   default:
					    break;
				}
			      }



			   if( cur_tree != ad_box3 ) {
			     if( cur_tree[ button ].ob_state & SELECTED )
			       cur_tree[ button ].ob_state &= ~SELECTED;
			     else
			       cur_tree[ button ].ob_state |= SELECTED;

			     objc_offset( cur_tree, button, &r.g_x, &r.g_y );
			     r.g_x -= 2;
			     r.g_y -= 2;
			     r.g_w = cur_tree[ button ].ob_width + 4;
			     r.g_h = cur_tree[ button ].ob_height + 4;
			     do_redraw( cur_tree, button, &r );
			   }

			}  /* end of msg[3] == wid */
			break;

			case WM_ICONIFY:
			     if( msg[3] == wid )
			       wind_set( msg[3], WF_ICONIFY, msg[4], msg[5], msg[6], msg[7] );
			     break;

			case WM_UNICONIFY:
			     if( msg[3] == wid )
			       wind_set( msg[3], WF_UNICONIFY, msg[4], msg[5], msg[6], msg[7] );
			     break;

		   default:
			break;
		}  /* end of switch */
	    }
	    wind_update( END_UPDATE );
	    	    
	}while( !done );
	if( wid > 0 )
	   wind_delete( wid );

        menu_bar( ad_menubar, FALSE );
	
	graf_mouse( ARROW, 0L );	
	
        rsrc_free();

       	close_vwork();
	appl_exit();
}