Commit fa9e35bf authored by rswindell's avatar rswindell
Browse files

Update copy/cut/paste-over/insert support. You can now cut a group/lib/section

and when pasted, all the child subs/dirs/xtrns will be pasted with it.
If however, you cut a group/lib/section and then exit SCFG, you'll lose all the
children subs/dir/xtrns that were on the "clipboard" along with the parent.

Copy - F5, Ctrl-C, Ctrl-Insert
Cut - Shift-Del, Ctrl-X
Paste Over - F6, Ctrl-V
Paste Insert - Shift-Insert
parent 530f236f
......@@ -617,11 +617,11 @@ void txt_cfg()
opt[i][0]=0;
j=WIN_ORG|WIN_ACT|WIN_CHE;
if(cfg.total_txtsecs)
j|=WIN_DEL|WIN_GET;
j|=WIN_DEL | WIN_COPY;
if(cfg.total_txtsecs<MAX_OPTS)
j|=WIN_INS|WIN_INSACT|WIN_XTR;
if(savtxtsec.name[0])
j|=WIN_PUT;
j|=WIN_PASTE;
uifc.helpbuf=
"`Text File Sections:`\n"
"\n"
......@@ -649,8 +649,9 @@ void txt_cfg()
}
return;
}
if((i&MSK_ON)==MSK_INS) {
i&=MSK_OFF;
int msk = i & MSK_ON;
i &= MSK_OFF;
if (msk == MSK_INS) {
strcpy(str,"ANSI Artwork");
uifc.helpbuf=
"`Text Section Name:`\n"
......@@ -699,9 +700,7 @@ void txt_cfg()
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_DEL || (i&MSK_ON) == MSK_CUT) {
int msk = i&MSK_ON;
i&=MSK_OFF;
if (msk == MSK_DEL || msk == MSK_CUT) {
if(msk == MSK_CUT)
savtxtsec = *cfg.txtsec[i];
free(cfg.txtsec[i]);
......@@ -711,17 +710,17 @@ void txt_cfg()
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_GET) {
i&=MSK_OFF;
if (msk == MSK_COPY) {
savtxtsec=*cfg.txtsec[i];
continue;
}
if((i&MSK_ON)==MSK_PUT) {
i&=MSK_OFF;
if (msk == MSK_PASTE_OVER) {
*cfg.txtsec[i]=savtxtsec;
uifc.changes=1;
continue;
}
if (msk != 0)
continue;
i=txt_dflt;
j=0;
done=0;
......@@ -791,11 +790,11 @@ void shell_cfg()
opt[i][0]=0;
j=WIN_ORG|WIN_ACT|WIN_CHE;
if(cfg.total_shells)
j|=WIN_DEL|WIN_GET;
j|=WIN_DEL|WIN_COPY;
if(cfg.total_shells<MAX_OPTS)
j|=WIN_INS|WIN_INSACT|WIN_XTR;
if(savshell.name[0])
j|=WIN_PUT;
j|=WIN_PASTE;
uifc.helpbuf=
"`Command Shells:`\n"
"\n"
......@@ -822,8 +821,9 @@ void shell_cfg()
}
return;
}
if((i&MSK_ON)==MSK_INS) {
i&=MSK_OFF;
int msk = i & MSK_ON;
i &= MSK_OFF;
if (msk == MSK_INS) {
strcpy(str,"Menu Shell");
uifc.helpbuf=
"`Command Shell Name:`\n"
......@@ -876,9 +876,7 @@ void shell_cfg()
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_DEL || (i&MSK_ON) == MSK_CUT) {
int msk = i&MSK_ON;
i&=MSK_OFF;
if (msk == MSK_DEL || msk == MSK_CUT) {
if(msk == MSK_CUT)
savshell = *cfg.shell[i];
free(cfg.shell[i]);
......@@ -888,17 +886,17 @@ void shell_cfg()
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_GET) {
i&=MSK_OFF;
if (msk == MSK_COPY) {
savshell=*cfg.shell[i];
continue;
}
if((i&MSK_ON)==MSK_PUT) {
i&=MSK_OFF;
if (msk == MSK_PASTE_OVER) {
*cfg.shell[i]=savshell;
uifc.changes=1;
continue;
}
if (msk != 0)
continue;
i=shell_dflt;
j=0;
done=0;
......
......@@ -34,6 +34,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <limits.h> /* USHRT_MAX */
#include "gen_defs.h"
......
......@@ -48,11 +48,11 @@ while(1) {
opt[i][0]=0;
j=WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT;
if(cfg.total_pages)
j|=WIN_DEL|WIN_GET;
j|=WIN_DEL|WIN_COPY;
if(cfg.total_pages<MAX_OPTS)
j|=WIN_INS|WIN_INSACT|WIN_XTR;
if(savpage.cmd[0])
j|=WIN_PUT;
j|=WIN_PASTE;
uifc.helpbuf=
"`External Sysop Chat Pagers:`\n"
"\n"
......@@ -67,8 +67,9 @@ while(1) {
i=uifc.list(j,0,0,45,&dflt,&bar,"External Sysop Chat Pagers",opt);
if((signed)i==-1)
return;
if((i&MSK_ON)==MSK_INS) {
i&=MSK_OFF;
int msk = i & MSK_ON;
i &= MSK_OFF;
if (msk == MSK_INS) {
sprintf(str,"%%!tone +chatpage.ton");
uifc.helpbuf=
"`External Chat Pager Command Line:`\n"
......@@ -98,9 +99,7 @@ while(1) {
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_DEL || (i&MSK_ON) == MSK_CUT) {
int msk = i&MSK_ON;
i&=MSK_OFF;
if (msk == MSK_DEL || msk == MSK_CUT) {
if(msk == MSK_CUT)
savpage = *cfg.page[i];
free(cfg.page[i]);
......@@ -110,17 +109,17 @@ while(1) {
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_GET) {
i&=MSK_OFF;
if (msk == MSK_COPY) {
savpage=*cfg.page[i];
continue;
}
if((i&MSK_ON)==MSK_PUT) {
i&=MSK_OFF;
if (msk == MSK_PASTE_OVER) {
*cfg.page[i]=savpage;
uifc.changes=1;
continue;
}
if (msk != 0)
continue;
j=0;
done=0;
while(!done) {
......@@ -214,11 +213,11 @@ while(1) {
opt[i][0]=0;
j=WIN_ACT|WIN_SAV|WIN_BOT|WIN_RHT;
if(cfg.total_chans)
j|=WIN_DEL|WIN_GET;
j|=WIN_DEL|WIN_COPY;
if(cfg.total_chans<MAX_OPTS)
j|=WIN_INS|WIN_INSACT|WIN_XTR;
if(savchan.name[0])
j|=WIN_PUT;
j|=WIN_PASTE;
uifc.helpbuf=
"`Multinode Chat Channels:`\n"
"\n"
......@@ -234,8 +233,9 @@ while(1) {
i=uifc.list(j,0,0,45,&chan_dflt,&chan_bar,"Multinode Chat Channels",opt);
if((signed)i==-1)
return;
if((i&MSK_ON)==MSK_INS) {
i&=MSK_OFF;
int msk = i & MSK_ON;
i &= MSK_OFF;
if (msk == MSK_INS) {
strcpy(str,"Open");
uifc.helpbuf=
"`Channel Name:`\n"
......@@ -284,9 +284,7 @@ while(1) {
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_DEL || (i&MSK_ON) == MSK_CUT) {
int msk = i&MSK_ON;
i&=MSK_OFF;
if (msk == MSK_DEL || msk == MSK_CUT) {
if(msk == MSK_CUT)
savchan = *cfg.chan[i];
free(cfg.chan[i]);
......@@ -296,17 +294,17 @@ while(1) {
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_GET) {
i&=MSK_OFF;
if (msk == MSK_COPY) {
savchan=*cfg.chan[i];
continue;
}
if((i&MSK_ON)==MSK_PUT) {
i&=MSK_OFF;
if (msk == MSK_PASTE_OVER) {
*cfg.chan[i]=savchan;
uifc.changes=1;
continue;
}
if (msk != 0)
continue;
j=0;
done=0;
while(!done) {
......@@ -482,11 +480,11 @@ while(1) {
opt[j][0]=0;
i=WIN_ACT|WIN_SAV;
if(j)
i|=WIN_DEL|WIN_GET;
i|=WIN_DEL|WIN_COPY;
if(j<MAX_OPTS)
i|=WIN_INS|WIN_INSACT|WIN_XTR;
if(savchatact.cmd[0])
i|=WIN_PUT;
i|=WIN_PASTE;
uifc.helpbuf=
"`Multinode Chat Actions:`\n"
"\n"
......@@ -509,8 +507,9 @@ while(1) {
i=uifc.list(i,0,0,70,&chatact_dflt,&chatact_bar,str,opt);
if((signed)i==-1)
return;
if((i&MSK_ON)==MSK_INS) {
i&=MSK_OFF;
int msk = i & MSK_ON;
i &= MSK_OFF;
if (msk == MSK_INS) {
uifc.helpbuf=
"`Chat Action Command:`\n"
"\n"
......@@ -549,9 +548,7 @@ while(1) {
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_DEL || (i&MSK_ON) == MSK_CUT) {
int msk = i&MSK_ON;
i&=MSK_OFF;
if (msk == MSK_DEL || msk == MSK_CUT) {
if(msk == MSK_CUT)
savchatact = *cfg.chatact[chatnum[i]];
free(cfg.chatact[chatnum[i]]);
......@@ -561,18 +558,18 @@ while(1) {
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_GET) {
i&=MSK_OFF;
if (msk == MSK_COPY) {
savchatact=*cfg.chatact[chatnum[i]];
continue;
}
if((i&MSK_ON)==MSK_PUT) {
i&=MSK_OFF;
if (msk == MSK_PASTE_OVER) {
*cfg.chatact[chatnum[i]]=savchatact;
cfg.chatact[chatnum[i]]->actset=setnum;
uifc.changes=1;
continue;
}
if (msk != 0)
continue;
uifc.helpbuf=
"`Chat Action Command:`\n"
"\n"
......@@ -610,11 +607,11 @@ while(1) {
opt[i][0]=0;
j=WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT;
if(cfg.total_gurus)
j|=WIN_DEL|WIN_GET;
j|=WIN_DEL|WIN_COPY;
if(cfg.total_gurus<MAX_OPTS)
j|=WIN_INS|WIN_INSACT|WIN_XTR;
if(savguru.name[0])
j|=WIN_PUT;
j|=WIN_PASTE;
uifc.helpbuf=
"`Gurus:`\n"
"\n"
......@@ -630,8 +627,9 @@ while(1) {
i=uifc.list(j,0,0,45,&guru_dflt,&guru_bar,"Artificial Gurus",opt);
if((signed)i==-1)
return;
if((i&MSK_ON)==MSK_INS) {
i&=MSK_OFF;
int msk = i & MSK_ON;
i &= MSK_OFF;
if (msk == MSK_INS) {
uifc.helpbuf=
"`Guru Name:`\n"
"\n"
......@@ -678,9 +676,7 @@ while(1) {
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_DEL || (i&MSK_ON) == MSK_CUT) {
int msk = i&MSK_ON;
i&=MSK_OFF;
if (msk == MSK_DEL || msk == MSK_CUT) {
if(msk == MSK_CUT)
savguru = *cfg.guru[i];
free(cfg.guru[i]);
......@@ -690,17 +686,17 @@ while(1) {
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_GET) {
i&=MSK_OFF;
if (msk == MSK_COPY) {
savguru=*cfg.guru[i];
continue;
}
if((i&MSK_ON)==MSK_PUT) {
i&=MSK_OFF;
if (msk == MSK_PASTE_OVER) {
*cfg.guru[i]=savguru;
uifc.changes=1;
continue;
}
if (msk != 0)
continue;
j=0;
done=0;
while(!done) {
......@@ -771,11 +767,11 @@ while(1) {
opt[i][0]=0;
j=WIN_ACT|WIN_RHT|WIN_BOT|WIN_SAV;
if(cfg.total_actsets)
j|=WIN_DEL|WIN_GET;
j|=WIN_DEL|WIN_COPY;
if(cfg.total_actsets<MAX_OPTS)
j|=WIN_INS|WIN_INSACT|WIN_XTR;
if(savactset.name[0])
j|=WIN_PUT;
j|=WIN_PASTE;
uifc.helpbuf=
"`Chat Action Sets:`\n"
"\n"
......@@ -792,8 +788,9 @@ while(1) {
i=uifc.list(j,0,0,45,&actset_dflt,&actset_bar,"Chat Action Sets",opt);
if((signed)i==-1)
return;
if((i&MSK_ON)==MSK_INS) {
i&=MSK_OFF;
int msk = i & MSK_ON;
i &= MSK_OFF;
if (msk == MSK_INS) {
uifc.helpbuf=
"`Chat Action Set Name:`\n"
"\n"
......@@ -822,9 +819,7 @@ while(1) {
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_DEL || (i&MSK_ON) == MSK_CUT) {
int msk = i&MSK_ON;
i&=MSK_OFF;
if (msk == MSK_DEL || msk == MSK_CUT) {
if(msk == MSK_CUT)
savactset = *cfg.actset[i];
free(cfg.actset[i]);
......@@ -834,17 +829,18 @@ while(1) {
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_GET) {
i&=MSK_OFF;
if (msk == MSK_COPY) {
savactset=*cfg.actset[i];
continue;
}
if((i&MSK_ON)==MSK_PUT) {
i&=MSK_OFF;
if (msk == MSK_PASTE_OVER) {
*cfg.actset[i]=savactset;
uifc.changes=1;
continue;
}
if (msk != 0)
continue;
j=0;
done=0;
while(!done) {
......
This diff is collapsed.
......@@ -183,8 +183,9 @@ while(1) {
,"QWK Network Hubs",opt);
if(i==-1)
break;
if((i&MSK_ON)==MSK_INS) {
i&=MSK_OFF;
int msk = i & MSK_ON;
i &= MSK_OFF;
if (msk == MSK_INS) {
if((cfg.qhub=(qhub_t **)realloc(cfg.qhub
,sizeof(qhub_t *)*(cfg.total_qhubs+1)))==NULL) {
errormsg(WHERE,ERR_ALLOC,nulstr
......@@ -223,8 +224,7 @@ while(1) {
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_DEL) {
i&=MSK_OFF;
if (msk == MSK_DEL) {
free(cfg.qhub[i]->mode);
free(cfg.qhub[i]->conf);
free(cfg.qhub[i]->sub);
......@@ -328,9 +328,9 @@ while(1) {
,"System Addresses",opt);
if(i==-1)
break;
if((i&MSK_ON)==MSK_INS) {
i&=MSK_OFF;
int msk = i & MSK_ON;
i &= MSK_OFF;
if (msk == MSK_INS) {
if(!cfg.total_faddrs)
strcpy(str,"1:1/0");
else
......@@ -356,8 +356,7 @@ while(1) {
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_DEL) {
i&=MSK_OFF;
if (msk == MSK_DEL) {
cfg.total_faddrs--;
while(i<cfg.total_faddrs) {
cfg.faddr[i]=cfg.faddr[i+1];
......@@ -672,8 +671,9 @@ while(1) {
,"PostLink Hubs",opt);
if(i==-1)
break;
if((i&MSK_ON)==MSK_INS) {
i&=MSK_OFF;
int msk = i & MSK_ON;
i &= MSK_OFF;
if (msk == MSK_INS) {
if((cfg.phub=(phub_t **)realloc(cfg.phub
,sizeof(phub_t *)*(cfg.total_phubs+1)))==NULL) {
errormsg(WHERE,ERR_ALLOC,nulstr
......@@ -710,8 +710,7 @@ while(1) {
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_DEL) {
i&=MSK_OFF;
if (msk == MSK_DEL) {
free(cfg.phub[i]);
cfg.total_phubs--;
while(i<cfg.total_phubs) {
......
This diff is collapsed.
......@@ -131,8 +131,9 @@ while(1) {
i=uifc.list(i,24,1,LEN_SLNAME+5,&dflt,&bar,str,opt);
if((signed)i==-1)
return;
if((i&MSK_ON)==MSK_INS) {
i&=MSK_OFF;
int msk = i & MSK_ON;
i &= MSK_OFF;
if(msk==MSK_INS) {
strcpy(str,"General");
uifc.helpbuf=
"`Sub-board Long Name:`\n"
......@@ -198,9 +199,7 @@ while(1) {
uifc.changes=1;
continue;
}
if((i&MSK_ON) == MSK_DEL || (i&MSK_ON) == MSK_CUT) {
int msk = (i&MSK_ON);
i&=MSK_OFF;
if(msk == MSK_DEL || msk == MSK_CUT) {
uifc.helpbuf=
"`Delete Data in Sub-board:`\n"
"\n"
......@@ -244,14 +243,11 @@ while(1) {
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_COPY) {
i&=MSK_OFF;
if(msk==MSK_COPY) {
savsub=*cfg.sub[subnum[i]];
continue;
}
if((i&MSK_ON)==MSK_PASTE_OVER || (i&MSK_ON) == MSK_PASTE_INSERT) {
int msk = i&MSK_ON;
i&=MSK_OFF;
if(msk == MSK_PASTE_OVER || msk == MSK_PASTE_INSERT) {
if (msk == MSK_PASTE_INSERT) {
if (!new_sub(subnum[i], grpnum))
continue;
......
......@@ -238,9 +238,9 @@ uifc.helpbuf=
if(cfg.total_fviews<MAX_OPTS)
i|=WIN_INS|WIN_XTR;
if(cfg.total_fviews)
i|=WIN_DEL|WIN_GET;
i|=WIN_DEL|WIN_COPY;
if(savfview.cmd[0])
i|=WIN_PUT;
i|=WIN_PASTE;
uifc.helpbuf=
"Viewable File Types:\n"
"\n"
......@@ -251,9 +251,9 @@ uifc.helpbuf=
i=uifc.list(i,0,0,50,&fview_dflt,NULL,"Viewable File Types",opt);
if(i==-1)
break;
if((i&MSK_ON)==MSK_DEL || (i&MSK_ON) == MSK_CUT) {
int msk = i&MSK_ON;
i&=MSK_OFF;
int msk = i & MSK_ON;
i &= MSK_OFF;
if(msk == MSK_DEL || msk == MSK_CUT) {
if(msk == MSK_CUT)
savfview = *cfg.fview[i];
free(cfg.fview[i]);
......@@ -265,8 +265,7 @@ uifc.helpbuf=
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_INS) {
i&=MSK_OFF;
if(msk == MSK_INS) {
if((cfg.fview=(fview_t **)realloc(cfg.fview
,sizeof(fview_t *)*(cfg.total_fviews+1)))==NULL) {
errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_fviews+1);
......@@ -302,17 +301,17 @@ uifc.helpbuf=
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_GET) {
i&=MSK_OFF;
if(msk == MSK_COPY) {
savfview=*cfg.fview[i];
continue;
}
if((i&MSK_ON)==MSK_PUT) {
i&=MSK_OFF;
if(msk == MSK_PASTE_OVER) {
*cfg.fview[i]=savfview;
uifc.changes=1;
continue;
}
if (msk != 0)
continue;
done=0;
while(!done) {
j=0;
......@@ -356,9 +355,9 @@ uifc.helpbuf=
if(cfg.total_ftests<MAX_OPTS)
i|=WIN_INS|WIN_XTR;
if(cfg.total_ftests)
i|=WIN_DEL|WIN_GET;
i|=WIN_DEL|WIN_COPY;
if(savftest.cmd[0])
i|=WIN_PUT;
i|=WIN_PASTE;
uifc.helpbuf=
"Testable File Types:\n"
"\n"
......@@ -378,9 +377,9 @@ uifc.helpbuf=
i=uifc.list(i,0,0,50,&ftest_dflt,NULL,"Testable File Types",opt);
if(i==-1)
break;
if((i&MSK_ON)==MSK_DEL || (i&MSK_ON) == MSK_CUT) {
int msk = i&MSK_ON;
i&=MSK_OFF;
int msk = i & MSK_ON;
i &= MSK_OFF;
if(msk == MSK_DEL || msk == MSK_CUT) {
if(msk == MSK_CUT)
savftest = *cfg.ftest[i];
free(cfg.ftest[i]);
......@@ -392,8 +391,7 @@ uifc.helpbuf=
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_INS) {
i&=MSK_OFF;
if(msk == MSK_INS) {
if((cfg.ftest=(ftest_t **)realloc(cfg.ftest
,sizeof(ftest_t *)*(cfg.total_ftests+1)))==NULL) {
errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_ftests+1);
......@@ -431,17 +429,17 @@ uifc.helpbuf=
uifc.changes=1;
continue;
}
if((i&MSK_ON)==MSK_GET) {
i&=MSK_OFF;
if(msk == MSK_COPY) {