From 315da0dbbc734ddb68a1a2ca7e3aa6f24fc9b98e Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 10 May 2012 23:59:21 -0400 Subject: [PATCH] Update presenter code Add centering support Change so loaded in HGR2 land. Use HGR in all cases, move shape table lower in memory. --- asoft_presenter.c | 96 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 30 deletions(-) diff --git a/asoft_presenter.c b/asoft_presenter.c index a77feb9c..c9cd2b19 100644 --- a/asoft_presenter.c +++ b/asoft_presenter.c @@ -163,6 +163,45 @@ static void print_number(int line_num, int x, int y, char *string) { } +void center_print(int line_num,char *string,int cols) { + + int i,centering=(cols-strlen(string))/2; + + printf("%d PRINT ",line_num); + if (centering<5) { + printf("\""); + for(i=0;i>8)&0xff); line_num++; @@ -326,28 +366,12 @@ static void generate_slide(int num, int max, char*filename) { /* Print remaining text */ printf("%d VTAB 21\n",line_num); line_num++; - while(1) { - result=fgets(string,BUFSIZ,fff); - if (result==NULL) break; - string[strlen(string)-1]='\0'; - printf("%d PRINT \"%s\"\n",line_num,string); line_num++; - } - - + print_til_eof(fff,&line_num); } else if (strstr(type,"HGR2")) { - printf("%d HGR2\n",line_num); line_num++; - while(1) { - result=fgets(string,BUFSIZ,fff); - if (result==NULL) break; - if ((string[0]=='#') || (string[0]=='\n')) continue; - } - string[strlen(string)-1]='\0'; - printf("%d PRINT CHR$(4);\"BLOAD %s,A$4000\"\n", - line_num,string); line_num++; - } - else if (strstr(type,"HGR")) { - printf("%d HGR\n",line_num); line_num++; + /* cheat and use HGR page 1 but text turned off */ + printf("%d HGR:POKE -16302,0\n",line_num); line_num++; + while(1) { result=fgets(string,BUFSIZ,fff); if (result==NULL) break; @@ -357,18 +381,31 @@ static void generate_slide(int num, int max, char*filename) { printf("%d PRINT CHR$(4);\"BLOAD %s,A$2000\"\n", line_num,string); line_num++; } + else if (strstr(type,"HGR")) { + printf("%d HGR\n",line_num); line_num++; + while(1) { + result=fgets(string,BUFSIZ,fff); + if (result==NULL) break; + if ((string[0]=='#') || (string[0]=='\n')) continue; + break; + } + string[strlen(string)-1]='\0'; + printf("%d PRINT CHR$(4);\"BLOAD %s,A$2000\"\n", + line_num,string); line_num++; + /* print rest of stuff */ + printf("%d VTAB 21\n",line_num); line_num++; + + print_til_eof(fff,&line_num); + + } else if (strstr(type,"80COL")) { } else if (strstr(type,"40COL")) { printf("%d TEXT:VTAB 1\n",line_num); line_num++; - while(1) { - result=fgets(string,BUFSIZ,fff); - if (result==NULL) break; - string[strlen(string)-1]='\0'; - printf("%d PRINT \"%s\"\n",line_num,string); line_num++; - } + print_til_eof(fff,&line_num); + } @@ -475,6 +512,7 @@ int main(int argc, char **argv) { fprintf(stderr,"Unexpected EOF finding END_SLIDES in %s\n",filename); exit(1); } + if ((string[0]=='#') || (string[0]=='\n')) continue; if (!strncmp("END_SLIDES",string,10)) break; string[strlen(string)-1]='\0'; @@ -525,8 +563,6 @@ int main(int argc, char **argv) { generate_slide(i,info.slides,slides[i].filename); } - printf("999 END\n"); - generate_keyhandler(); generate_footer(footer.left,footer.center,40);