-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.cpp
More file actions
250 lines (235 loc) · 8.44 KB
/
app.cpp
File metadata and controls
250 lines (235 loc) · 8.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#include "stdlib.h"
#include <stdio.h>
#include <conio.h>
#include "app.h"
#include "deleteFile.h"
#include "kelolaText.h"
#include "saveToFile.h"
#include "openFile.h"
#include "duplicateFile.h"
#include "renameFile.h"
#include "findReplace.h"
void app()
{
home();
}
// menu utama home
void home()
{
int choose;
printf("+===========================================================+\n");
printf("| TITOR APPS |\n");
printf("+===========================================================+\n");
printf("| |\n");
printf("| 1. Run |\n");
printf("| 2. About |\n");
printf("| 3. Shorcut |\n");
printf("| 4. Exit |\n");
printf("| |\n");
printf("+===========================================================+\n");
printf("| Copyright (c) 2022 Kelompok RUBY. All rights reserved. |\n");
printf("+===========================================================+\n");
printf("Choose Menu : ");
scanf("%d", &choose);
switch (choose)
{
case 1:
run();
break;
case 2:
printf("About...\n");
procedure();
backMenuHome();
break;
case 3:
printf("Shorcut...\n");
procedureShorcut();
backMenuHome();
break;
case 4:
printf("Exit...\n");
exit(0);
break;
default:
printf("\n Wrong Input!");
getch();
system("cls");
home();
break;
}
}
// prosedure about application TiTOR
void procedure()
{
system("cls");
printf("+==================================================================+\n");
printf("| About TiTOR |\n");
printf("+==================================================================+\n");
printf("| |\n");
printf("| TiTOR or Text Editor is an application that can make it easier |\n");
printf("| for users to add, change, and save text with a simple and |\n");
printf("| easy-to-use interface. This application is based on a console |\n");
printf("| made using the C++ language. The making of this application was |\n");
printf("| compiled by : |\n");
printf("| Lolla Mariah |\n");
printf("| Luthfie Yannuardy |\n");
printf("| Muhamad Ardi Nur Insan |\n");
printf("| Muhammad Zidan Hidayat |\n");
printf("| Naufal Salman Mulyadi |\n");
printf("| Shofiyah |\n");
printf("| |\n");
printf("| --Titor2022 |\n");
printf("|+================================================================+|\n");
}
// prosedure shorcut application TiTOR
void procedureShorcut()
{
system("cls");
printf("+==================================================================+\n");
printf("| Shorcut TiTOR |\n");
printf("+==================================================================+\n");
printf("| |\n");
printf("| ctrl + n : Used to create file |\n");
printf("| ctrl + d : Used to duplicate file |\n");
printf("| ctrl + x : Used to delete file |\n");
printf("| ctrl + o : Used to open file |\n");
printf("| ctrl + n : Used to rename file |\n");
printf("| ctrl + q : Used to go out |\n");
printf("| ctrl + s : Used for save |\n");
printf("| ctrl + v : Used for paste |\n");
printf("| ctrl + y : Used for redo |\n");
printf("| ctrl + z : Used for undo |\n");
printf("|+================================================================+|\n");
}
// Sub-menu Run
void run1()
{
int choose;
printf("+===========================================================+\n");
printf("| Menu TiTOR |\n");
printf("+===========================================================+\n");
printf("| |\n");
printf("| 1. Create File |\n");
printf("| 2. Open File |\n");
printf("| 3. Edit File |\n");
printf("| 4. Delete File |\n");
printf("| 5. Rename File |\n");
printf("| 6. Exit |\n");
printf("| |\n");
printf("+===========================================================+\n");
printf("| Copyright (c) 2022 Kelompok RUBY. All rights reserved. |\n");
printf("+===========================================================+\n");
printf("Choose Menu :");
scanf("%d", &choose);
switch (choose)
{
case 1:
backMenuHome();
break;
case 2:
printf("About...\n");
backMenuHome();
break;
case 3:
printf("Shorcut...\n");
backMenuHome();
break;
case 4:
printf("Exit...\n");
backMenuHome();
break;
default:
break;
}
}
void textEditor()
{
printf(" TiTOR APPS\n");
printf("\t ctrl+n : New File ctrl+o : Open File\n");
printf("\t ctrl+d : Duplicate File ctrl+r : Rename File\n");
printf("\t ctrl+x : Delete File ctrl+q : Quit\n");
printf("\t ctrl+f : Find and Replace\n");
}
void newFile()
{
system("cls");
char choice;
char text[MAXBARIS][MAXKOLOMARR];
setArr(text);
int jmlBaris = insertMode(text, 1);
while (1)
{
printf("Do you want to save the file? (y/n) : ");
choice = getch();
if (choice == 'y')
{
saveFile(jmlBaris, text);
break;
}
else if (choice == 'n')
{
system("cls");
printf("\nYour file is not saved!");
getch();
break;
}
else
{
printf("\n");
printf("Wrong Input!\n");
}
}
}
void run()
{
int choose;
system("cls");
// View menu text editor
do
{
textEditor();
choose = getch();
switch (choose)
{
case NEWFILE: // ctrl + n = New file
newFile();
system("cls");
break;
case DUPLICATE:
duplicateFile(); // ctrl + d = Duplicate File
break;
case RENAMEFILE:
renameFile(); // ctrl + r = Rename File
break;
case OPENFILE: // ctrl + o = Open File
openFileTwoDimensi();
// openFile();
system("cls");
break;
case DELETEFILE: // ctrl + x = Delete File
deleteFile();
break;
case QUIT: // ctrl + q = Quit
backMenuHome();
break;
case SAVE_FILE:
// ctrl + s = Save File
break;
case FIND_REPLACE:
findAndReplaceFile();
system("cls");
break;
default:
system("cls");
printf("\t\t\t\tWrong Input!\n");
break;
}
} while (choose != QUIT);
}
void backMenuHome()
{
printf("Press Enter to return to the home menu ...\n");
getch();
system("cls");
home();
}