Home › Forums › C Programming › Dos Editor with menus
- This topic has 0 replies, 1 voice, and was last updated 19 years, 10 months ago by will.
Viewing 0 reply threads
- AuthorPosts
- February 25, 2005 at 9:57 am #1893willParticipant
This is a very easy to use DOS EDITOR. You can start typing as soon as Editor is Open. You can goto menu by pressing F10 and move using arrow keys.
To select some part of text just press Shift and use arrow keys. These shortcuts can be used along with selecting a option from menu-CTRL X – CUT
CTRL C – COPY
CTRL V – PASTEIt also provides options to search a given string and goto a particular line.
NOTE:-This the version 1.0 and is amature, so don’t try to play hard with it.
[email protected]
[email protected]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303<br />/* This file contains definition of menu and pull down menu functions */<br />//#include<editor.h><br />#include<iostream.h><br />#include<process.h><br />#include<fstream.h><br />#include<string.h><br />#include<conio.h><br />#include<stdio.h><br />#include<bios.h><br />#include<time.h><br />#include<dos.h><br />void edit::menu()<br />{<br />window(1,1,80,25);<br />_setcursortype(0);<br />int slct=1;<br />long int ch;<br />while((ch!=ESC)&&(ch!=ENTER)&&(ch!=DOWN))<br />{ gotoxy(5,2);<br />textbackground(BLACK);<br />cprintf("File Edit Search Help");<br />textbackground(GREEN);<br />switch(slct)<br />{ case 1:gotoxy(5,2);<br />cprintf("File");<br />break;<br />case 2:gotoxy(11,2);<br />cprintf("Edit");<br />break;<br />case 3:gotoxy(17,2);<br />cprintf("Search");<br />break;<br />case 4:gotoxy(25,2);<br />cprintf("Help");<br />break;<br />}<br />if(bioskey(1)!=0)<br />{ ch=bioskey(0);<br />switch(ch)<br />{ case RIGHT:if(slct==4) slct=1;<br />else slct++;<br />break;<br />case LEFT:if(slct==1) slct=4;<br />else slct--;<br />break;<br />case DOWN:<br />case ENTER: if(slct==1) file_options();<br />if(slct==2) edit_options();<br />if(slct==3) search_options();<br />if(slct==4) help_options();<br />break;<br />} //End of Switch<br />} //End of If<br />} //End of While<br />gotoxy(5,2);<br />textbackground(BLACK);<br />cprintf("File Edit Search Help");<br />window(3,4,79,22); //This is the active window to write text<br />textbackground(0);<br />_setcursortype(2);<br />gotoxy(col,row);<br />}<br />void edit::file_options()<br />{<br />for(int i=3;i<11;i++)<br />{ gotoxy(3,i); printf(" &nbs p; ");}<br />khidki(3,3,15,9);<br />int slct=1;<br />long int ch;<br />while((ch!=ESC)&&(ch!=ENTER))<br />{<br />textbackground(0);<br />gotoxy(5,4);<br />cprintf("New");<br />gotoxy(5,5);<br />cprintf("Open");<br />gotoxy(5,6);<br />cprintf("Save");<br />gotoxy(5,7);<br />cprintf("Save As...");<br />gotoxy(5,8);<br />cprintf("Exit");<br />textbackground(1);<br />switch(slct)<br />{ case 1: gotoxy(5,4);<br />cprintf("New");<br />break;<br />case 2: gotoxy(5,5);<br />cprintf("Open");<br />break;<br />case 3: gotoxy(5,6);<br />cprintf("Save");<br />break;<br />case 4: gotoxy(5,7);<br />cprintf("Save As...");<br />break;<br />case 5: gotoxy(5,8);<br />cprintf("Exit");<br />break;<br />}<br />if(bioskey(1)!=0)<br />{ ch=bioskey(0);<br />switch(ch)<br />{ case UP:if(slct==1) slct=5;<br />else slct--;<br />break;<br />case DOWN:if(slct==5) slct=1;<br />else slct++;<br />break;<br />case ENTER: if(slct==1) new_file();<br />else if(slct==2) open();<br />else if(slct==3) save();<br />else if(slct==4) save_as();<br />else if(slct==5) exit(0);<br />} //End of Swich<br />}<br />} //End of While<br />khidki(2,3,80,23); //Window Enclosing whole Text<br />}<br />void edit::edit_options()<br />{<br />for(int i=3;i<9;i++)<br />{ gotoxy(9,i); printf(" &nbs p; ");}<br />khidki(9,3,19,7);<br />int slct=1;<br />long int ch;<br />while((ch!=ESC)&&(ch!=ENTER))<br />{<br />textbackground(0);<br />gotoxy(11,4);<br />cprintf("Cut");<br />gotoxy(11,5);<br />cprintf("Copy");<br />gotoxy(11,6);<br />cprintf("Paste");<br />textbackground(1);<br />switch(slct)<br />{ case 1: gotoxy(11,4);<br />cprintf("Cut");<br />break;<br />case 2: gotoxy(11,5);<br />cprintf("Copy");<br />break;<br />case 3: gotoxy(11,6);<br />cprintf("Paste");<br />break;<br />}<br />if(bioskey(1)!=0)<br />{ ch=bioskey(0);<br />switch(ch)<br />{ case UP:if(slct==1) slct=3;<br />else slct--;<br />break;<br />case DOWN:if(slct==3) slct=1;<br />else slct++;<br />break;<br />case ENTER: if(slct==1) {cut=1; copy();}<br />else if(slct==2) copy();<br />else if(slct==3) paste();<br />break;<br />} //End of Swich<br />}<br />} //End of While<br />khidki(2,3,80,23); //Window Enclosing whole Text<br />}<br />void edit::search_options()<br />{<br />for(int i=3;i<9;i++)<br />{ gotoxy(15,i); printf(" &nbs p; ");}<br />khidki(15,3,32,7);<br />int slct=1;<br />long int ch;<br />while((ch!=ESC)&&(ch!=ENTER))<br />{<br />textbackground(0);<br />gotoxy(17,4);<br />cprintf("Find");<br />gotoxy(17,5);<br />cprintf("Search Again");<br />gotoxy(17,6);<br />cprintf("Go to Line No.");<br />textbackground(1);<br />switch(slct)<br />{ case 1: gotoxy(17,4);<br />cprintf("Find");<br />break;<br />case 2: gotoxy(17,5);<br />cprintf("Search Again");<br />break;<br />case 3: gotoxy(17,6);<br />cprintf("Go to Line No.");<br />break;<br />}<br />if(bioskey(1)!=0)<br />{ ch=bioskey(0);<br />switch(ch)<br />{ case UP:if(slct==1) slct=3;<br />else slct--;<br />break;<br />case DOWN:if(slct==3) slct=1;<br />else slct++;<br />break;<br />case ENTER: if(slct==1) { sear=0;find();}<br />else if(slct==2) { sear=1;find();}<br />else if(slct==3) goto_line();<br />break;<br />} //End of Swich<br />}<br />} //End of While<br />khidki(2,3,80,23); //Window Enclosing whole Text<br />}<br />void edit::help_options()<br />{<br />for(int i=3;i<9;i++)<br />{ gotoxy(23,i); printf(" &nbs p; ");}<br />khidki(23,3,38,6);<br />int slct=1;<br />long int ch;<br />while((ch!=ESC)&&(ch!=ENTER))<br />{<br />textbackground(0);<br />gotoxy(25,4);<br />cprintf("Help");<br />gotoxy(25,5);<br />cprintf("About");<br />textbackground(1);<br />switch(slct)<br />{ case 1: gotoxy(25,4);<br />cprintf("Help");<br />break;<br />case 2: gotoxy(25,5);<br />cprintf("About");<br />break;<br />}<br />if(bioskey(1)!=0)<br />{ ch=bioskey(0);<br />switch(ch)<br />{ case UP:if(slct==1) slct=2;<br />else slct--;<br />break;<br />case DOWN:if(slct==2) slct=1;<br />else slct++;<br />break;<br />case ENTER: if(slct==1) help();<br />else if(slct==2) about();<br />break;<br />} //End of Swich<br />}<br />} //End of While<br />khidki(2,3,80,23); //Window Enclosing whole Text<br />}<br />void edit::help()<br />{<br />/*khidki(2,3,80,23);<br />window(3,4,79,22);<br />*/textbackground(0);<br />clrscr();<br />gotoxy(1,1);<br />clreol();<br />textcolor(15);<br />c printf(" &nbs p; PANACEA INFOTECH INC. ");<br />printf("nn This is a very easy to use DOS EDITOR.");<br />printf("n You can start typing as soon as Editor is Open.");<br />printf("n You can goto menu by pressing F10 and move using arrow keys.");<br />printf("n To select some part of text just press Shift and use arrow keys.");<br />printf("n These shortcuts can be used along with selecting a option from menu-");<br />printf("n CTRL X - CUT");<br />printf("n CTRL C - COPY");<br />printf("n CTRL V - PASTE");<br />printf("n It also provides options to search a given string and goto a particular line.");<br />printf("nnnnnnnnnnnn NOTE:-This the version 1.0 and is amature, so don't try to play hard with it.");<br />printf("n Hit any key to continue !!");<br />getch();<br />clrscr();<br />}<br />void edit::about()<br />{<br />textbackground(7);<br />clrscr();<br />textcolor(15);<br />gotoxy(35,3);<br />cprintf("Dos Editor");<br />gotoxy(35,5);<br />cprintf("Version 1.0");<br />gotoxy(31,7);<br />cprintf("Copyright (c) 2001");<br />gotoxy(30,9);<br />cprintf("Panacea Infotech, Inc.");<br />gotoxy(20,13);<br />cprintf("In Case of any Problem or Query Mail at:");<br />gotoxy(26,15);<br />cprintf("<a href="mailto:invincible_virus@hotmail.com" target="_blank" rel="nofollow">[email protected]</a>");<br />gotoxy(30,16);<br />cprintf("<a href="mailto:coologics@hotmail.com" target="_blank" rel="nofollow">[email protected]</a>");<br />gotoxy(27,23);<br />cprintf("Hit any Key to Continue !!");<br />getch();<br />textbackground(0);<br />clrscr();<br />}<br /><br />
- AuthorPosts
Viewing 0 reply threads
- The forum ‘C Programming’ is closed to new topics and replies.