TempleOSTS_130707.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:45:45 +02:00
1 parent 17b71f1a2d
commit 1343005a29
617 files changed
+14399 -25130

No files matched your search

+138 -60
View File
@@ -1,10 +1,10 @@
#define GEBM_END 0
#define GEBM_CONT 1
#define GEBM_EXIT 0
#define GEBM_MAIN_MENU 1
#define GEBM_COLOR 2
#define GEBM_DITHER_COLOR 3
#define GEBM_WIDTH 4
#define GEBM_SNAP 5
#define GEBM_PT 6
#define GEBM_PT 6
#define GEBM_LINE 7
#define GEBM_ARROW 8
#define GEBM_RECT 9
@@ -16,13 +16,26 @@
#define GEBM_FLOOD_FILL_NOT 15
#define GEBM_POLYLINE 16
#define GEBM_POLYPT 17
#define GEBM_CUT 18
#define GEBM_COPY 18
#define GEBM_DELETE 19
#define GEBM_PASTE 20
#define GEBM_PASTE_TRANSPARENT 21
#define GEBM_FIND_AND_REPLACE 22
#define GEBM_TRIM_TO_EXTENTS 23
#define GEBM_UNDO 24
#define GEBM_ADD_OUTLINE 24
#define GEBM_ETCH 25
#define GEBM_UNDO 26
U0 GrInit3()
{
DefineLstLoad("ST_SPRITE_BITMAP_MENU",
"Exit\0Main Menu\0Color\0Dither Color\0Width\0Snap\0Point\0Line\0Arrow\0"
"Rect\0Circle\0Text\0Text Box\0Text Diamond\0Flood Fill\0"
"Flood Fill Not Color\0PolyLine\0PolyPoint\0Copy\0Delete\0Paste\0"
"Paste Transparent\0Find and Replace\0Trim to Extents\0Add Outline\0"
"Etch\0Undo\0");
}
GrInit3;
I64 PopUpSpriteBitMap(CColorROPU32 color,I64 width,I64 snap,F64 ip_scaler)
{
@@ -39,16 +52,17 @@ I64 PopUpSpriteBitMap(CColorROPU32 color,I64 width,I64 snap,F64 ip_scaler)
st2="";
}
DocPrintF(doc,"$$FG,PURPLE$$$$TX+CX,\"BitMap Menu\"$$$$FG$$\n"
"$$FG,RED$$Settings$$FG$$\n"
"$$MU-UL,\"Color %s\",GEBM_COLOR$$\n"
DocPrintF(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite BitMap Menu\"$$\n"
"$$LK+PU+CX,\"Click for Help\",\"FI:::/TempleOS/Doc/SpriteBitMap.TXT.Z\"$$\n"
"\n$$FG,LTBLUE$$$$MU-UL,\"Color %s\",GEBM_COLOR$$\n"
"$$MU-UL,\"Dither Color %s\",GEBM_DITHER_COLOR$$\n"
"$$MU-UL,\"Width %d\",GEBM_WIDTH$$\n"
"$$MU-UL,\"Snap %d %5.3f\",GEBM_SNAP$$\n"
"$$MU-UL,\"Find & Replace Color\",GEBM_FIND_AND_REPLACE$$\n"
"$$MU-UL,\"Trim to Extents\",GEBM_TRIM_TO_EXTENTS$$\n"
"\n$$FG,RED$$Objects$$FG$$\n"
"$$MU-UL,\"Point\",GEBM_PT$$\n"
"$$MU-UL,\"Add Outline\",GEBM_ADD_OUTLINE$$\n"
"$$MU-UL,\"Etch\",GEBM_ETCH$$\n"
"\n$$MU-UL,\"Point\",GEBM_PT$$\n"
"$$MU-UL,\"Line\",GEBM_LINE$$\n"
"$$MU-UL,\"Arrow\",GEBM_ARROW$$\n"
"$$MU-UL,\"Rect\",GEBM_RECT$$\n"
@@ -60,15 +74,15 @@ I64 PopUpSpriteBitMap(CColorROPU32 color,I64 width,I64 snap,F64 ip_scaler)
"$$MU-UL,\"Flood Fill Not Color\",GEBM_FLOOD_FILL_NOT$$\n"
"$$MU-UL,\"PolyLine\",GEBM_POLYLINE$$\n"
"$$MU-UL,\"PolyPoint\",GEBM_POLYPT$$\n"
"\n$$FG,RED$$Clipboard$$FG$$\n"
"$$MU-UL,\"Cut\",GEBM_CUT$$\n"
"$$MU-UL,\"Delete\",GEBM_DELETE$$\n"
"$$MU-UL,\"Paste\",GEBM_PASTE$$\n"
"$$MU-UL,\"Paste Transparent\",GEBM_PASTE_TRANSPARENT$$\n"
"\n$$MU-UL,\"Copy to Clipboard\",GEBM_COPY$$\n"
"$$MU-UL,\"Delete to Clipboard\",GEBM_DELETE$$\n"
"$$MU-UL,\"Paste Clipboard\",GEBM_PASTE$$\n"
"$$MU-UL,\"Paste Transparent Clipboard\",GEBM_PASTE_TRANSPARENT$$\n"
"\n$$MU-UL,\"Undo\",GEBM_UNDO$$\n"
"\n$$FM,PURPLE$$$$MU-UL,\"+] Vect Object Menu\",GEBM_CONT$$$$FM,LTBLUE$$\n"
"$$MU-UL,\"End\",GEBM_END$$\n"
"$$MU-UL,\"Cancel\",DOCM_CANCEL$$\n",st1,st2,width,snap,ip_scaler);
"\n$$FG,PURPLE$$$$MU-UL,\"+] Sprite Main Menu\",GEBM_MAIN_MENU$$$$FG,LTBLUE$$\n"
"$$MU-UL,\"Exit Sprite\",GEBM_EXIT$$\n"
"$$MU-UL,\"Abort Sprite\",DOCM_CANCEL$$\n",st1,st2,width,snap,ip_scaler);
DocPutS(doc,"\nRight-Click to get back to this menu.");
i=PopUpMenu(doc);
DocDel(doc);
return i;
@@ -80,17 +94,6 @@ U0 GrBMEdPrepPersistentDC(CDC *dc,I64 xx1,I64 yy1,CDC *img)
GrBlot(dc,xx1,yy1,img);
}
U0 GrBMEFindReplaceColor(CDC *img,I64 pattern,I64 replace)
{
U8 *dst=img->body;
I64 d0=img->height*img->width_internal;
while (d0--) {
if (*dst==pattern)
*dst=replace;
dst++;
}
}
U0 GrBMETrimToExtents(CDC **_img,I64 *_xx1,I64 *_yy1,I64 *_xx2,I64 *_yy2,CColorROPU32 bkcolor)
{
CDC *img=*_img;
@@ -138,40 +141,95 @@ tr_done:
DCDel(img);
}
I64 SpriteBitMap(CDC *dc,I64 *_xx1,I64 *_yy1,I64 *_xx2,I64 *_yy2,CDC **_img,CColorROPU32 bkcolor,I64 *_import_snap=NULL,F64 *_import_ip_scaler=NULL)
U0 GrBMEAddOutline(CDC *img,I64 width,CColorROPU32 color,CColorROPU32 bkcolor)
{
I64 i,j,mode=GEBM_LINE,color=BLACK,width=1,msg_code,p1,p2,x1,y1,x11,y11,x22,y22,new_snap=1,
result,xx1=*_xx1,yy1=*_yy1,xx2=*_xx2,yy2=*_yy2;
I64 i,j,k,c;
CColorROPU32 old_color;
CDC *src;
if (img->width && img->height) {
old_color=img->color;
img->color=color;
while (width-->0) {
src=DCExtract(img,0,0,img->width-1,img->height-1);
for (i=0;i<img->height;i++)
for (j=0;j<img->width;j++)
if (GrPeek(src,j,i)==bkcolor)
for (k=0;k<8;k++) {
c=GrPeek(src,j+gr_x_offsets[k],i+gr_y_offsets[k]);
if (c>=0 && c!=bkcolor) {
GrPlot(img,j,i);
break;
}
}
DCDel(src);
}
img->color=old_color;
}
}
U0 GrBMEEtch(CDC *img,I64 width,CColorROPU32 bkcolor)
{
I64 i,j,k,c;
CColorROPU32 old_color;
CDC *src;
if (img->width && img->height) {
old_color=img->color;
img->color=bkcolor;
while (width-->0) {
src=DCExtract(img,0,0,img->width-1,img->height-1);
for (i=0;i<img->height;i++)
for (j=0;j<img->width;j++)
if (GrPeek(src,j,i)!=bkcolor)
for (k=0;k<8;k++) {
c=GrPeek(src,j+gr_x_offsets[k],i+gr_y_offsets[k]);
if (c<0 || c==bkcolor) {
GrPlot(img,j,i);
break;
}
}
DCDel(src);
}
img->color=old_color;
}
}
I64 SpriteBitMap(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,I64 *_xx2,I64 *_yy2,CDC **_img,CColorROPU32 bkcolor,I64 *_ip_snap,F64 *_ip_scaler)
{
I64 i,j,mode=GEBM_LINE,color=BLACK,width=1,msg_code,p1,p2,x1,y1,x11,y11,x22,y22,ip_snap=1,
result,xx1=*_xx1,yy1=*_yy1,xx2=*_xx2,yy2=*_yy2,
old_e_flags1=doc_e->flags1;
Bool down=FALSE;
F64 new_ip_scaler=1.0;
F64 ip_scaler=1.0;
U8 *st=NULL;
CDC *img=*_img,
*clipboard=NULL,*undo=NULL,*dc2;
*clipboard=NULL,*undo=NULL,*dc2;
SettingsPush; //See $LK,"SettingsPush","MN:SettingsPush"$
if (_import_snap) new_snap=*_import_snap;
if (_import_ip_scaler) new_ip_scaler=*_import_ip_scaler;
SetSnap(&Fs->snap,new_snap,new_ip_scaler);
if (_ip_snap) ip_snap=*_ip_snap;
if (_ip_scaler) ip_scaler=*_ip_scaler;
SetSnap(&Fs->snap,ip_snap,ip_scaler);
doc_e->flags1|=DOCEF1_DONT_DRAW;
goto bm_menu;
while (TRUE) {
if (sys_cur_scan_code&SCF_CTRL)//grab scroll update?
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
dc->color=ROPF_DITHER+WHITE<<16+ROP_EQU+BLACK;
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
dc->pen_width=1;
GrLineRect4(dc,xx1-1,yy1-1,xx2,yy2);//This is done little bit too often.
while (msg_code=ScanMsg(&p1,&p2,1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|1<<MSG_IP_R_DOWN|
1<<MSG_IP_MOVE|1<<MSG_KEY_DOWN)) {
1<<MSG_IP_MOVE|1<<MSG_KEY_DOWN)) {
switch (msg_code) {
case MSG_KEY_DOWN:
if (p1==CH_SHIFT_ESC) {
result=GE_CANCEL;
result=GE_ABORT;
goto bm_key_up_done;
} else if (p1==CH_ESC) {
result=GE_OKAY_CONT;
result=GE_CONT;
goto bm_key_up_done;
}
break;
@@ -179,15 +237,19 @@ I64 SpriteBitMap(CDC *dc,I64 *_xx1,I64 *_yy1,I64 *_xx2,I64 *_yy2,CDC **_img,CCol
case MSG_IP_R_DOWN:
bm_menu:
DCFill(dc);
switch (i=PopUpSpriteBitMap(color,width,new_snap,new_ip_scaler)) {
StrCpy(Fs->task_title,"Sprite BitMap Menu");
i=PopUpSpriteBitMap(color,width,ip_snap,ip_scaler);
if (i>=0)
StrCpy(Fs->task_title,DefineSub(i,"ST_SPRITE_BITMAP_MENU"));
switch (i) {
case DOCM_CANCEL:
result=GE_CANCEL;
result=GE_ABORT;
goto bm_done;
case GEBM_END:
result=GE_OKAY_DONE;
case GEBM_EXIT:
result=GE_EXIT;
goto bm_done;
case GEBM_CONT:
result=GE_OKAY_CONT;
case GEBM_MAIN_MENU:
result=GE_CONT;
goto bm_done;
case GEBM_COLOR:
@@ -200,7 +262,7 @@ bm_menu:
if (i>=0) {
j=PopUpColor("Replace Color\n",,FALSE);
if (j>=0) {
GrBMEFindReplaceColor(img,i,j);
DCColorChg(img,i,j);
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
}
}
@@ -211,9 +273,24 @@ bm_menu:
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
goto bm_menu;
case GEBM_ADD_OUTLINE:
i=PopUpRangeI64(1,16,1,"Outline Width\n");
if (i>=0) {
GrBMEAddOutline(img,i,color,bkcolor);
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
}
goto bm_menu;
case GEBM_ETCH:
i=PopUpRangeI64(1,16,1,"Etch Width\n");
if (i>=0) {
GrBMEEtch(img,i,bkcolor);
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
}
goto bm_menu;
case GEBM_DITHER_COLOR:
i=PopUpDitherColor;
i=PopUpColorDither;
if (i>=0) color=i;
goto bm_menu;
@@ -224,8 +301,8 @@ bm_menu:
case GEBM_SNAP:
PopUpSnap(&Fs->snap);
new_snap=Fs->snap.x;
new_ip_scaler=Fs->snap.dx;
ip_snap=Fs->snap.x;
ip_scaler=Fs->snap.dx;
goto bm_menu;
case GEBM_UNDO:
@@ -247,7 +324,7 @@ bm_menu:
case GEBM_FLOOD_FILL_NOT:
case GEBM_POLYPT:
case GEBM_POLYLINE:
case GEBM_CUT:
case GEBM_COPY:
case GEBM_DELETE:
case GEBM_PASTE:
case GEBM_PASTE_TRANSPARENT:
@@ -285,7 +362,7 @@ bm_menu:
case GEBM_ARROW:
case GEBM_RECT:
case GEBM_CIRCLE:
case GEBM_CUT:
case GEBM_COPY:
case GEBM_DELETE:
if (down)
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
@@ -306,9 +383,9 @@ bm_menu:
case GEBM_CIRCLE:
GrCircle3(dc,x1,y1,0,1);
break;
case GEBM_CUT:
case GEBM_COPY:
case GEBM_DELETE:
dc->color=ROPF_DITHER+WHITE<<16+ROP_EQU+BLACK;
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
dc->pen_width=1;
GrLineRect4(dc,x1,y1,x1,y1);
break;
@@ -410,7 +487,7 @@ bm_menu:
GrRect(dc,x11,y11,x22-x11+1,y22-y11+1);
}
break;
case GEBM_CUT:
case GEBM_COPY:
case GEBM_DELETE:
if (down) {
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
@@ -428,7 +505,7 @@ bm_menu:
y11=p2;
y22=y1;
}
dc->color=ROPF_DITHER+WHITE<<16+ROP_EQU+BLACK;
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
dc->pen_width=1;
GrLineRect4(dc,x11,y11,x22,y22);
}
@@ -521,7 +598,7 @@ bm_menu:
down=FALSE;
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
break;
case GEBM_CUT:
case GEBM_COPY:
case GEBM_DELETE:
if (x1<p1) {
x11=x1;
@@ -595,8 +672,9 @@ bm_done:
Free(st);
DCFill(dc);
SettingsPop;
if (_import_snap) *_import_snap=new_snap;
if (_import_ip_scaler) *_import_ip_scaler=new_ip_scaler;
doc_e->flags1=old_e_flags1;
if (_ip_snap) *_ip_snap=ip_snap;
if (_ip_scaler) *_ip_scaler=ip_scaler;
*_img=img;
*_xx1=xx1,*_yy1=yy1,*_xx2=xx2,*_yy2=yy2;
return result;