void iText_Field(char* text) { //TEXT FIELD PORTION START iSetcolor(0,0,64); iFilledRectangle(0,20,640,80); iSetcolor(255,255,255); iFilledRectangle(320,30,310,60); iText(20,40,text,GLUT_BITMAP_TIMES_ROMAN_24); iSetcolor(0,0,0); if(char_top>=0) for(int i=0;i<=char_top;i++) iText(stack[i].pos,50,stack[i].num,GLUT_BITMAP_TIMES_ROMAN_24); //printing the numbers if(char_flag==0) { iLine(char_x+315,80,315+char_x,35); //blinking portion char_flag=1; } }
void iDraw() { int m,n; iClear(); iSetcolor(1,1,1); iFilledRectangle(1,1,width-19,height-18); //draw text box iSetcolor(0,0,0); iRectangle(1,1,width-19,height-19); //draw text boundary if (selflag) { for (int l=selSI; l<=selEI; l++) { int sx = (l==selSI)?( (selSJ==0)?3:selSJ*charSpace) : 3; int sy = height - 17 - (l+1-s)*lineSpace - 5; int w; if (l==selSI) w = (selSI == selEI) ? selEJ-selSJ : strlen(str+l*charMax*sizeof(char))-selSJ; else if (l==selEI) w = selEJ; else w = (strlen(str+l*charMax*sizeof(char))==0)?1:strlen(str+l*charMax*sizeof(char)); iSetcolor(.8,.8,.9); iFilledRectangle(sx,sy,w*charSpace,lineSpace); } } iSetcolor(0,0,0); for (m=height-17-lineSpace, n=s; n<=imax; m-=lineSpace, n++) { iText(3, m, str+n*charMax*sizeof(char),font); //print text } if (fOpen) { fileopen(); iSetcolor(0,0,0); iText((width-15)/2-135,(height-19)/2+62,subTemp+r); //print file open text } else if (fsave) { filesave(); iSetcolor(0,0,0); iText((width-15)/2-135,(height-19)/2+62,subTemp+r); //print file save as text } else if (aboutR) { aboutRword(); } cursor(); //draw cursor iSetcolor(.9,.9,.9); iFilledRectangle(3,height-17,width-19,17); iSetcolor(0,0,0); iLine(2,height-18,width-19,height-18); iSetcolor(0,0,0); iText(5,height-12,"File",GLUT_BITMAP_HELVETICA_12); iSetcolor(0,0,0); iText(45,height-12,"Edit",GLUT_BITMAP_HELVETICA_12); iSetcolor(0,0,0); iText(85,height-12,"Format",GLUT_BITMAP_HELVETICA_12); iSetcolor(0,0,0); iText(141,height-12,"Help",GLUT_BITMAP_HELVETICA_12); //draw menus if (menuflag == 1) { fileMenu(); //draw file drop down menu } else if (menuflag == 2) { editMenu(); //draw edit drop down menu } else if (menuflag == 3) { formatMenu(); //draw format drop down menu } else if (menuflag == 4) { helpMenu(); //draw help drop down menu } if (fontflag) { fontlist(); //draw font list } else if (saveM) { saveMessage(); //message box while exitting } scrollbar(); // draw scrollbar if (load) loading(); //load window }