⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cool.cpp

📁 c语言写的VB编译器
💻 CPP
📖 第 1 页 / 共 2 页
字号:
////////////////////////////////////////////
//                                        //
//    Cool.cpp                            //
//    初始化模块                          //
//    处理系统配置文件                    //
//    初始化变量                          //
//    最后更新时间:2004年4月23日16:10    //
//                                        //
////////////////////////////////////////////



#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <conio.h>

#include "Cool.h"

extern unsigned _stklen = 543210U;

void main()
{
	// 初始化
	Inititation();

	// 显示界面
	ShowScreen();

	// 打开默认文件
	NewFile(DefaultFileName);

	// 对当前菜单项赋值
	int MenuNo = MenuFile;
	int ItemNo;

	do
	{
		// 处理用户编辑输入
		EditProgram(MenuNo, ItemNo);

		// 处理用户请求
		Explain(MenuNo, ItemNo);
	} while (true);
}

void Inititation()
{
	// 配置文件指针
	FILE *fi;

	char strTemp1[MaxY], strTemp2[MaxY];

	strcpy(DefaultFileName, "NONAME.BAS");
	
	// Tab键的宽度
	TabSize = 4;

	// 显示About窗口标志
	ShowAbout = true;

	if ((fi = fopen("nb.ini", "r")) != NULL)
	{
		fscanf(fi, "%s %s", strTemp1, strTemp2);
		strupr(strTemp1);
		if (strcmp(strTemp1, "TABSIZE") == 0)
		{
			// 设置TAB宽度

			TabSize = atoi(strTemp2);
		}
		else if (strcmp(strTemp1, "DEFAULTFILENAME") == 0)
		{
			// 默认打开文件

			strcpy(DefaultFileName, strupr(strTemp2));
		}
		else if (strcmp(strTemp1, "SHOWABOUT") == 0)
		{
			// 启动是否现实About窗口标志

			ShowAbout = atoi(strTemp2);
		}
		fclose(fi);

		if (TabSize < 1 || TabSize > 8) 
		{
			// TabSize设置非法则改为4

			TabSize = 4;
		}
	}

	// 建立具体的窗口对象
	CreateWindow();

	// 建立具体的菜单对象
	CreateMenu();

	// 建立列表对象
	CreateList();

	// 建立Tab分区表
	CreateTab();

	window(1, 1, 80, 25);

	randomize();
}

void CreateWindow()
{
	// 编辑窗口对象
	winEdit.SetTitle(DefaultFileName);
	winEdit.SetColor(WHITE, BLUE, YELLOW, BLUE);

	// 观察监视变量窗口对象
	winWatch.SetTitle("Watch");
	winWatch.SetColor(WHITE, LIGHTGRAY, BLACK, LIGHTGRAY);
	winWatch.Add(" Watch Expression :");
	winWatch.Add("");
	winWatch.Add("");
	winWatch.Add(" Result :");

	// 搜索文本窗口对象
	winFind.SetTitle("Find Text");
	winFind.SetColor(WHITE, LIGHTGRAY, BLACK, LIGHTGRAY);
	winFind.Add(" Text to find :");
	winFind.Add(" From current line to the last one.");

	// 读入文件名窗口对象
	winGetFileName.SetTitle("Answer my question");
	winGetFileName.SetColor(WHITE, LIGHTGRAY, BLACK, LIGHTGRAY);
	winGetFileName.Add(" Enter the file name :");

	winAsk.SetTitle("Question");
	winAsk.SetColor(WHITE, LIGHTGRAY, BLACK, LIGHTGRAY);

	// 编辑帮助窗口对象
	winHelpOnEdit.SetTitle("Help On Edit");
	winHelpOnEdit.SetColor(WHITE, LIGHTGRAY, BLACK, LIGHTGRAY);
	winHelpOnEdit.SetTotHigh(36);
	winHelpOnEdit.Add("    ===============  BASIC OPERATION ===============    ");
	winHelpOnEdit.Add("    Up         : Move the cursor upwards                ");
	winHelpOnEdit.Add("    Down       : Move the cursor downwards              ");
	winHelpOnEdit.Add("    Left       : Move the cursor left                   ");
	winHelpOnEdit.Add("    Right      : Move the cursor Right                  ");
	winHelpOnEdit.Add("    Home       : Move the cursor to the head            ");
	winHelpOnEdit.Add("    End        : Move the cursor to the end             ");
	winHelpOnEdit.Add("    PageUp     : Move the cursor to the previous page   ");
	winHelpOnEdit.Add("    PageDown   : Move the cursor to the next page       ");
	winHelpOnEdit.Add("    Esc        : Cancel the current window, menu or list");
	winHelpOnEdit.Add("    Insert     : Switch between insert and rewrite      ");
	winHelpOnEdit.Add("    Delete     : Delete the current character           ");
	winHelpOnEdit.Add("    BackSpace  : Delete the character before            ");
	winHelpOnEdit.Add("    Tab        : Move to next tab zone                  ");
	winHelpOnEdit.Add("                                                        ");
	winHelpOnEdit.Add("    ===================  Hot Key ===================    ");
	winHelpOnEdit.Add("    F1            : Help on edit, this window           ");
	winHelpOnEdit.Add("    F2            : Save                                ");
	winHelpOnEdit.Add("    F3            : Open                                ");
	winHelpOnEdit.Add("    F4            : Run to cursor                       ");
	winHelpOnEdit.Add("    F7            : Step into                           ");
	winHelpOnEdit.Add("    F8            : Step over, not into the sub         ");
	winHelpOnEdit.Add("    F10           : Open then menu                      ");
	winHelpOnEdit.Add("    Alt + F6      : Open the output window              ");
	winHelpOnEdit.Add("    Alt + X       : Quit                                ");
	winHelpOnEdit.Add("    Alt + F       : Open the menu FILE                  ");
	winHelpOnEdit.Add("    Alt + E       : Open the menu EDIT                  ");
	winHelpOnEdit.Add("    Alt + R       : Open the menu RUN                   ");
	winHelpOnEdit.Add("    Alt + D       : Open the menu DEBUG                 ");
	winHelpOnEdit.Add("    Alt + H       : Open the menu HELP                  ");
	winHelpOnEdit.Add("    Ctrl + Y      : Delete the current line             ");
	winHelpOnEdit.Add("    Ctrl + L      : Search again                        ");
	winHelpOnEdit.Add("    Ctrl + F1     : Help on syntax                      ");
	winHelpOnEdit.Add("    Ctrl + F2     : Stop debugging                      ");
	winHelpOnEdit.Add("    Ctrl + F7     : Watch the expression                ");
	winHelpOnEdit.Add("    Ctrl + F8     : Set or cancel the current breakpoint");
	winHelpOnEdit.Add("    Ctrl + F9     : Run                                 ");
	winHelpOnEdit.Add("    Ctrl + Enter  : Mark or unmark the current line     ");
	winHelpOnEdit.Add("    Ctrl + [      : Locate the previous mark line       ");
	winHelpOnEdit.Add("    Ctrl + ]      : Locate the next mark line           ");
	winHelpOnEdit.Add("    Ctrl+PageUp   : Move the cursor to the head line    ");
	winHelpOnEdit.Add("    Ctrl+PageDown : Move the cursor to the end line     ");
	winHelpOnEdit.Add("                                                        ");
	winHelpOnEdit.Add("                       The END                          ");

	// 语法帮助窗口对象
	winHelpOnSyntax.SetTitle("Help On Syntax");
	winHelpOnSyntax.SetColor(WHITE, LIGHTGRAY, BLACK, LIGHTGRAY);
	winHelpOnSyntax.SetTotHigh(44);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -