Home Forums C Programming Dos Editor with menus

Viewing 0 reply threads
  • Author
    Posts
    • #1893
      will
      Participant

      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 – PASTE

      It 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]


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

Viewing 0 reply threads
  • The forum ‘C Programming’ is closed to new topics and replies.