-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
1306 lines (1236 loc) · 51 KB
/
main.cpp
File metadata and controls
1306 lines (1236 loc) · 51 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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <windows.h>
#include <bits/stdc++.h>
#include <commctrl.h>
#include <commdlg.h>
#include <io.h>
#include <conio.h>
#include <tchar.h>
#include "main.h"
using namespace std;
HWND hwnd;
string codealltmp = "";
int wordsizepos = 4;
int wsizes[15] = {4,8,12,14,16,18,20,22,24,30,36,48,60,72,96};
string fontname = "Consolas";
bool fsaved=0, fopend=0, fcompiled=0;
bool programmeexiterrorstatusflag = 1;
unsigned long long variMsgCnt = 0;
HINSTANCE g_hInst;
char szFileName[MAX_PATH]="Untitled";
HWND g_hStatusBar, g_hToolBar;
bool hasstartopenfile = 0;
char commandline[MAX_PATH*10] = "";
string lasttimestr;
POINT cursorpoint;
BOOL runprocess(char szCommandLine[], int fwait, int fshow) {
BOOL ret = system(szCommandLine);
/*
if (fshow && (!fwait)) {
::ShellExecute(hwnd, "open", szCommandLine, NULL, NULL, SW_SHOWMAXIMIZED);
return 0;
}
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
memset(&si, 0, sizeof(si));
memset(&pi, 0, sizeof(pi));
si.wShowWindow = fshow?TRUE:FALSE;
si.dwFlags = STARTF_USESHOWWINDOW;
MessageBox(0, szCommandLine, "Caption", 0);
BOOL ret = ::CreateProcess(NULL, szCommandLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
//if (fwait) {
BOOL wret2 = ::WaitForSingleObject(pi.hProcess, INFINITE);
//}
char errorname[1000];
sprintf(errorname, "ERROR:ret=%d; LastError=%d; WaitRet=%d", ret, GetLastError(), wret2);
MessageBox(0, errorname, "", 0);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
*/
return ret;
}
string output_time() {
time_t rawtime;
time(&rawtime);
char pblgtime[20];
strftime(pblgtime, 20, "%Y-%m-%d %H-%M", localtime(&rawtime));
string tttmps="";
tttmps.insert(0, pblgtime);
return tttmps;
}
BOOL LoadFile(HWND hEdit, LPSTR pszFileName) {
HANDLE hFile;
BOOL bSuccess = FALSE;
hFile = CreateFile(pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
if(hFile != INVALID_HANDLE_VALUE) {
DWORD dwFileSize;
dwFileSize = GetFileSize(hFile, NULL);
if(dwFileSize != 0xFFFFFFFF) {
LPSTR pszFileText;
pszFileText = (LPSTR)GlobalAlloc(GPTR, dwFileSize + 1);
if(pszFileText != NULL) {
DWORD dwRead;
if(ReadFile(hFile, pszFileText, dwFileSize, &dwRead, NULL)) {
pszFileText[dwFileSize] = 0; // Null terminator
if(SetWindowText(hEdit, pszFileText)) {
bSuccess = TRUE; // It worked!
fopend=1;
SendMessage(g_hStatusBar, SB_SETTEXT, 4, (LPARAM)szFileName);
}
}
GlobalFree(pszFileText);
}
}
CloseHandle(hFile);
}
return bSuccess;
}
BOOL SaveFile(HWND hEdit, LPSTR pszFileName) {
HANDLE hFile;
BOOL bSuccess = FALSE;
hFile = CreateFile(pszFileName, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if(hFile != INVALID_HANDLE_VALUE) {
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hEdit);
if(dwTextLength > 0) {
LPSTR pszText;
pszText = (LPSTR)GlobalAlloc(GPTR, dwTextLength + 1);
if(pszText != NULL) {
if(GetWindowText(hEdit, pszText, dwTextLength + 1)) {
DWORD dwWritten;
if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL)) {
bSuccess = TRUE;
fsaved=1;
}
}
GlobalFree(pszText);
}
}
CloseHandle(hFile);
}
return bSuccess;
}
BOOL DoFileOpenSave(HWND hwnd, BOOL bSave) {
OPENFILENAME ofn;
ZeroMemory(&ofn, sizeof(ofn));
szFileName[0] = 0;
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = (bSave ? "C++ Files (*.cpp; *.c++)\0*.cpp;*.c++\0C++ Header Files (*.hpp)\0*.hpp\0Pascal Files (*.pp)\0*.pp\0Windows命令脚本 (*.bat; *.cmd)\0*.bat;*.cmd\0All Files (*.*)\0*.*\0\0" : "C++ Files (*.cpp; *.c++; *.cxx)\0*.cpp;*.c++;*.cxx\0C++ Header Files (*.hpp)\0*.hpp\0Pascal Files (*.pp)\0*.pp\0Windows命令脚本 (*.bat; *.cmd)\0*.bat;*.com;*.cmd\0ClickIDE Temporary Compilation Logs\0*_compile_tmp.log\0All Files (*.*)\0*.*\0\0");
ofn.lpstrFile = szFileName;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "";
if(bSave) {
ofn.Flags = OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT;
if(GetSaveFileName(&ofn)) {
if(!SaveFile(GetDlgItem(hwnd, IDC_MAIN_TEXT), szFileName)) {
MessageBox(hwnd, "Save file failed.\n(Or this is an empty file.)", "Error",MB_OK|MB_ICONEXCLAMATION);
fsaved=0;
return FALSE;
}
} else {
return FALSE;
}
} else {
ofn.Flags = OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;
if(GetOpenFileName(&ofn)) {
if(!LoadFile(GetDlgItem(hwnd, IDC_MAIN_TEXT), szFileName)) {
MessageBox(hwnd, "Load of file failed.", "Error",MB_OK|MB_ICONEXCLAMATION);
fopend=0;
return FALSE;
}
} else {
return FALSE;
}
}
return TRUE;
}
BOOL DoFileOpen(HWND hwnd, char rt[]) {
OPENFILENAME ofn;
ZeroMemory(&ofn, sizeof(ofn));
rt[0] = 0;
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = "配置设置(*.ini)\0*.ini\0\0";
ofn.lpstrFile = rt;
ofn.nMaxFile = MAX_PATH*4;
ofn.lpstrDefExt = "";
ofn.Flags = OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;
if(GetOpenFileName(&ofn)) {
;
} else {
return FALSE;
}
return TRUE;
}
string getpasfn (char yufn[]) {
string rtttmp = "";
for (int i = 0; i < strlen(yufn) - 3; i++) {
rtttmp += yufn[i];
}
return rtttmp;
}
string getcppfn (char yufn[]) {
string rtttmp = "";
for (int i = 0; i < strlen(yufn) - 4; i++) {
rtttmp += yufn[i];
}
return rtttmp;
}
string i_to_str(int int_num) {
string rt;
char tmp[100];
sprintf(tmp, "%d", int_num);
rt.clear();
rt+=tmp;
return rt;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
HMENU hMenu, hFileMenu, hCompileMenu;
ifstream wndfin;
bool GHELPEXITFLAG = 0;
string errreporti="";
string titlestr01="Click 4.6 ";
int errreportcnt = 0;
char cmdbuf1[MAX_PATH+40];
char cmdbuf2[MAX_PATH+40];
char cmdbuf3[MAX_PATH+40];
char cmdbuf4[MAX_PATH+40];
char cmdbuf5[MAX_PATH+40];
int iStatusWidths[] = {100, 230, 300, 320, -1};
RECT rectStatus;
bool isycl = 0;
bool iszfc = 0;
bool islfst = 1;
bool nlycl = 0;
bool issgzs = 0; /*//*/ //a
bool ismtzs = 0;
bool dontout = 0;
RECT rctA; //定义一个RECT结构体,存储窗口的长宽高
int wwidth = 1000, wheight = 600;
ofstream fout;
HFONT hFont;
HFONT hFont_ln;
FINDREPLACE repfindtag;
char getallcodetmpstr[200000];
int linecount = 0;
string linenumtmptext;
int cursorx=0, cursory=0;
int cursorytmp=-1, cursorxtmp=-1;
bool cursorxtmpset = 0;
bool tosetcur = 0;
/*4.8--
if (tosetcur) {
SetCaretPos((cursorpoint.x-6)/(wsizes[wordsizepos]/2.0), (cursorpoint.y-2)/wsizes[wordsizepos]);
tosetcur=0;
}
--4.8*/
switch(Message) {
case WM_CREATE:
GetWindowRect(hwnd,&rctA);//通过窗口句柄获得窗口的大小存储在rctA结构中
wwidth = rctA.right - rctA.left;
wheight = rctA.bottom - rctA.top;
CreateWindow("EDIT", "",WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|ES_MULTILINE|ES_WANTRETURN|WS_BORDER,115, 30, wwidth-115/*CW_USEDEFAULT*/, wheight-120,hwnd, (HMENU)IDC_MAIN_TEXT, GetModuleHandle(NULL), NULL);
CreateWindow("STATIC", "Welcome\nto\nClickIDE!\n\nVersion:\n4.6.0",WS_CHILD|WS_VISIBLE|WS_BORDER,0, 30, 60/*CW_USEDEFAULT*/, wheight-120,hwnd, (HMENU)IDC_LINE_NUM, GetModuleHandle(NULL), NULL);
CreateWindow("STATIC", "1",WS_CHILD|WS_VISIBLE|WS_BORDER|SS_RIGHT,60, 30, 55/*CW_USEDEFAULT*/, wheight-120,hwnd, (HMENU)IDC_LINE_NUMT, GetModuleHandle(NULL), NULL);
//CreateWindow("STATIC", "快捷功能:",WS_CHILD|WS_VISIBLE,60, wheight-112, 100, 19,hwnd, (HMENU)IDC_QUICKFUNC, GetModuleHandle(NULL), NULL);
//CreateWindow("BUTTON", "Compile && Run as C++ File",WS_CHILD|WS_VISIBLE,180, wheight-114, 200, 23,hwnd, (HMENU)IDC_COMPRUN_C, GetModuleHandle(NULL), NULL);
//CreateWindow("BUTTON", "Compile && Run as Pascal File",WS_CHILD|WS_VISIBLE,400, wheight-114, 200, 23,hwnd, (HMENU)IDC_COMPRUN_P, GetModuleHandle(NULL), NULL);
//CreateWindow("BUTTON", "Save",WS_CHILD|WS_VISIBLE,620, wheight-114, 100, 23,hwnd, (HMENU)IDC_SAVE, GetModuleHandle(NULL), NULL);
/*4.7*/hFont = CreateFont(wsizes[wordsizepos],0,0,0,0,FALSE,FALSE,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_SWISS,fontname.c_str());//创建字体
/*4.7*/hFont_ln = CreateFont(14,0,0,0,0,FALSE,FALSE,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_SWISS,"Consolas");//创建字体
/*4.7*/SendDlgItemMessage(hwnd, IDC_MAIN_TEXT, WM_SETFONT,(WPARAM)hFont/*GetStockObject(DEFAULT_GUI_FONT)*/, MAKELPARAM(TRUE,0));
/*4.7*/SendDlgItemMessage(hwnd, IDC_LINE_NUMT, WM_SETFONT,(WPARAM)hFont/*GetStockObject(DEFAULT_GUI_FONT)*/, MAKELPARAM(TRUE,0));
/*4.7*/SendDlgItemMessage(hwnd, IDC_LINE_NUM, WM_SETFONT,(WPARAM)hFont_ln/*GetStockObject(DEFAULT_GUI_FONT)*/, MAKELPARAM(TRUE,0));
///*4.7*/SendDlgItemMessage(hwnd, IDC_QUICKFUNC, WM_SETFONT,(WPARAM)hFont/*GetStockObject(DEFAULT_GUI_FONT)*/, MAKELPARAM(TRUE,0));
/*3.10: Statusbar*/
g_hStatusBar = CreateWindowEx(0, STATUSCLASSNAME, NULL,
WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, 0, 0, 0, 0,
hwnd, (HMENU)ID_STATUSBAR, g_hInst, NULL);
SendMessage(g_hStatusBar, SB_SETPARTS, 5, (LPARAM)iStatusWidths);
SendMessage(g_hStatusBar, SB_SETTEXT, 0, (LPARAM)"Click 4.6 IDE");
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(fcompiled ? "已编译" : "未编译"));
SendMessage(g_hStatusBar, SB_SETTEXT, 3, (LPARAM)"");
SendMessage(g_hStatusBar, SB_SETTEXT, 4, (LPARAM)szFileName);
/*--3.10*/
/*4.7: ToolBar*/
TBADDBITMAP tbab;
TBBUTTON tbb[14];
g_hToolBar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL,
WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
hwnd, (HMENU)ID_TOOLBAR, g_hInst, NULL);
/*--4.7*/
/*
***
*4.7 Tool Bar
*Add Bitmap
***
*/
SendMessage(g_hToolBar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
tbab.hInst = HINST_COMMCTRL;
tbab.nID = IDB_STD_SMALL_COLOR;
SendMessage(g_hToolBar, TB_ADDBITMAP, 0, (LPARAM)&tbab);
ZeroMemory(tbb, sizeof(tbb));
tbb[0].iBitmap = STD_FILENEW;
tbb[0].fsState = TBSTATE_ENABLED;
tbb[0].fsStyle = TBSTYLE_BUTTON;
tbb[0].idCommand = CM_FILE_NEW;
tbb[1].iBitmap = STD_FILEOPEN;
tbb[1].fsState = TBSTATE_ENABLED;
tbb[1].fsStyle = TBSTYLE_BUTTON;
tbb[1].idCommand = CM_FILE_OPEN;
tbb[2].iBitmap = STD_FILESAVE;
tbb[2].fsState = TBSTATE_ENABLED;
tbb[2].fsStyle = TBSTYLE_BUTTON;
tbb[2].idCommand = CM_FILE_SAVE;
tbb[3].fsStyle = TBSTYLE_SEP;
tbb[4].iBitmap = STD_CUT;
tbb[4].fsState = TBSTATE_ENABLED;
tbb[4].fsStyle = TBSTYLE_BUTTON;
tbb[4].idCommand = CM_EDIT_CUT;
tbb[5].iBitmap = STD_COPY;
tbb[5].fsState = TBSTATE_ENABLED;
tbb[5].fsStyle = TBSTYLE_BUTTON;
tbb[5].idCommand = CM_EDIT_COPY;
tbb[6].iBitmap = STD_PASTE;
tbb[6].fsState = TBSTATE_ENABLED;
tbb[6].fsStyle = TBSTYLE_BUTTON;
tbb[6].idCommand = CM_EDIT_PASTE;
tbb[7].fsStyle = TBSTYLE_SEP;
tbb[8].iBitmap = STD_UNDO;
tbb[8].fsState = TBSTATE_ENABLED;
tbb[8].fsStyle = TBSTYLE_BUTTON;
tbb[8].idCommand = CM_EDIT_UNDO;
tbb[9].iBitmap = STD_FIND;
tbb[9].fsState = TBSTATE_ENABLED;
tbb[9].fsStyle = TBSTYLE_BUTTON;
tbb[9].idCommand = CM_EDIT_FIND;
tbb[10].fsStyle = TBSTYLE_SEP;
tbb[11].iBitmap = STD_HELP;
tbb[11].fsState = TBSTATE_ENABLED;
tbb[11].fsStyle = TBSTYLE_BUTTON;
tbb[11].idCommand = CM_ABOUT;
tbb[12].fsStyle = TBSTYLE_SEP;
tbb[13].iBitmap = STD_DELETE;
tbb[13].fsState = TBSTATE_ENABLED;
tbb[13].fsStyle = TBSTYLE_BUTTON;
tbb[13].idCommand = CM_FILE_EXIT;
SendMessage(g_hToolBar, TB_ADDBUTTONS, 14, (LPARAM)&tbb);
/*
*--4.7
*/
if (hasstartopenfile) {
LoadFile(GetDlgItem(hwnd, IDC_MAIN_TEXT), commandline);
strcpy(szFileName, commandline);
SendMessage(g_hStatusBar, SB_SETTEXT, 4, (LPARAM)szFileName);
}
return 0;
break;
case WM_SIZE:
RECT rectClient, rectStatus, rectTool;
UINT uToolHeight, uStatusHeight, uClientAlreaHeight;
GetWindowRect(hwnd,&rctA);//通过窗口句柄获得窗口的大小存储在rctA结构中
wwidth = rctA.right - rctA.left;
wheight = rctA.bottom - rctA.top;
if(wParam != SIZE_MINIMIZED) {
MoveWindow(GetDlgItem(hwnd, IDC_MAIN_TEXT), 115, 30, /*LOWORD(lParam)*/wwidth-115,/*HIWORD(lParam)*/wheight-120, TRUE);
MoveWindow(GetDlgItem(hwnd, IDC_LINE_NUMT), 60, 30, /*LOWORD(lParam)*/55,/*HIWORD(lParam)*/wheight-120, TRUE);
MoveWindow(GetDlgItem(hwnd, IDC_LINE_NUM), 0, 30, /*LOWORD(lParam)*/60,/*HIWORD(lParam)*/wheight-120, TRUE);
}
SendMessage(g_hToolBar, TB_AUTOSIZE, 0, 0);
SendMessage(g_hStatusBar, WM_SIZE, 0, 0);
GetWindowRect(g_hStatusBar, &rectStatus);
GetClientRect(hwnd, &rectClient);
GetWindowRect(g_hStatusBar, &rectStatus);
GetWindowRect(g_hToolBar, &rectTool);
uToolHeight = rectTool.bottom - rectTool.top;
uStatusHeight = rectStatus.bottom - rectStatus.top;
uClientAlreaHeight = rectClient.bottom;
break;
case WM_SETFOCUS:
SetFocus(GetDlgItem(hwnd, IDC_MAIN_TEXT));
break;
case WM_COMMAND:
switch(LOWORD(wParam)) {
case CM_DT: {
MessageBox(NULL, i_to_str(GetScrollPos(GetDlgItem(hwnd, IDC_MAIN_TEXT), SB_VERT)).c_str(), "", MB_OK);
GetCaretPos(&cursorpoint);
MessageBox(NULL, i_to_str(cursorpoint.x).c_str(), "", MB_OK);
MessageBox(NULL, i_to_str(cursorpoint.y).c_str(), "", MB_OK);
GetCaretPos(&cursorpoint);
cursorx = (cursorpoint.x-6)/(wsizes[wordsizepos]/2.0)+1;
cursory = (cursorpoint.y-2)/wsizes[wordsizepos]+1;
MessageBox(NULL, i_to_str(cursorx).c_str(), "", MB_OK);
MessageBox(NULL, i_to_str(cursory).c_str(), "", MB_OK);
break;
}
case CM_FILE_OPEN:
if (MessageBox (hwnd, " If you open a new file, the unsaved contents will be lost!\n Sure to continue?", "Warning!", MB_YESNO | MB_ICONWARNING) != IDYES) {
break;
}
/*settitle*/
titlestr01="Click 4.6 [ Opening... ]";
SetWindowText (hwnd, titlestr01.c_str());
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"Opening...");
/*end:settitle*/
if (!DoFileOpenSave(hwnd, FALSE)) {
titlestr01="Click 4.6";
SetWindowText (hwnd, titlestr01.c_str());
SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(fcompiled ? "已编译" : "未编译"));
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
break;
}
fcompiled=0;
/*settitle*/
titlestr01="Click 4.6 [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SetWindowText (hwnd, titlestr01.c_str());
SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(fcompiled ? "已编译" : "未编译"));
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
/*end:settitle*/
break;
case CM_WLARGE: {
if (wordsizepos >= 14) {
MessageBox(hwnd, "已经是最大字体!", "", MB_OK);
break;
}
/*4.7*/hFont = CreateFont(wsizes[++wordsizepos],0,0,0,0,FALSE,FALSE,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_SWISS,fontname.c_str());//创建字体
/*4.7*/SendDlgItemMessage(hwnd, IDC_MAIN_TEXT, WM_SETFONT,(WPARAM)hFont/*GetStockObject(DEFAULT_GUI_FONT)*/, MAKELPARAM(TRUE,0));
/*4.7*/SendDlgItemMessage(hwnd, IDC_LINE_NUMT, WM_SETFONT,(WPARAM)hFont/*GetStockObject(DEFAULT_GUI_FONT)*/, MAKELPARAM(TRUE,0));
break;
}
case CM_WSMALL: {
if (wordsizepos <= 0) {
MessageBox(hwnd, "已经是最小字体!", "", MB_OK);
break;
}
/*4.7*/hFont = CreateFont(wsizes[--wordsizepos],0,0,0,0,FALSE,FALSE,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_SWISS,fontname.c_str());//创建字体
/*4.7*/SendDlgItemMessage(hwnd, IDC_MAIN_TEXT, WM_SETFONT,(WPARAM)hFont/*GetStockObject(DEFAULT_GUI_FONT)*/, MAKELPARAM(TRUE,0));
/*4.7*/SendDlgItemMessage(hwnd, IDC_LINE_NUMT, WM_SETFONT,(WPARAM)hFont/*GetStockObject(DEFAULT_GUI_FONT)*/, MAKELPARAM(TRUE,0));
break;
}
case CM_CFONT: {
if (fontname == "Inconsolata") {
fontname = "Consolas";
} else {
fontname = "Inconsolata";
}
/*4.7*/hFont = CreateFont(wsizes[wordsizepos],0,0,0,0,FALSE,FALSE,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_SWISS,fontname.c_str());//创建字体
/*4.7*/SendDlgItemMessage(hwnd, IDC_MAIN_TEXT, WM_SETFONT,(WPARAM)hFont/*GetStockObject(DEFAULT_GUI_FONT)*/, MAKELPARAM(TRUE,0));
/*4.7*/SendDlgItemMessage(hwnd, IDC_LINE_NUMT, WM_SETFONT,(WPARAM)hFont/*GetStockObject(DEFAULT_GUI_FONT)*/, MAKELPARAM(TRUE,0));
break;
}
case CM_IMPORTSET: {
char filenametoimport[MAX_PATH*10];
if (!DoFileOpen(hwnd, filenametoimport)) {
break;
}
wordsizepos = GetPrivateProfileInt(TEXT("FONT"), TEXT("SIZE"), 5, filenametoimport);
char fontnameini[100];
GetPrivateProfileString(TEXT("FONT"), TEXT("NAME"), TEXT("Inconsolata"), fontnameini, 100, filenametoimport);
/*4.7*/hFont = CreateFont(wsizes[wordsizepos],0,0,0,0,FALSE,FALSE,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_SWISS,fontnameini);//创建字体
/*4.7*/SendDlgItemMessage(hwnd, IDC_MAIN_TEXT, WM_SETFONT,(WPARAM)hFont/*GetStockObject(DEFAULT_GUI_FONT)*/, MAKELPARAM(TRUE,0));
break;
}
case CM_FILE_SAVEAS:
/*settitle*/
titlestr01="Click 4.6 [ Saving... ]";
SetWindowText (hwnd, titlestr01.c_str());
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"Saving...");
/*end:settitle*/
DoFileOpenSave(hwnd, TRUE);
/*settitle*/
titlestr01="Click 4.6 [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SetWindowText (hwnd, titlestr01.c_str());
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
/*end:settitle*/
break;
case CM_FILE_EXIT:
PostMessage(hwnd, WM_CLOSE, 0, 0);
break;
case CM_FILE_SAVE:
/*settitle*/
titlestr01="Click 4.6 [ Saving... ]";
SetWindowText (hwnd, titlestr01.c_str());
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"Saving...");
/*end:settitle*/
if ((!fsaved && !fopend) || strcmp(szFileName, "Untitled") == 0) {
if (!DoFileOpenSave(hwnd, TRUE)) {
SetWindowText (hwnd, "Click 4.6");
break;
}
} else {
if(!SaveFile(GetDlgItem(hwnd, IDC_MAIN_TEXT), szFileName)) {
MessageBox(hwnd, "Save file failed.\n(Or this is an empty file.)", "Error",MB_OK|MB_ICONEXCLAMATION);
fsaved=0;
}
}
/*settitle*/
titlestr01="Click 4.6 [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
break;
case CM_ABOUT:
/*settitle*/
SetWindowText (hwnd, "Click 4.6 [ About... ]");
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"About...");
/*end:settitle*/
MessageBox (hwnd, "Click IDE: 2020.4\nVersion: 4.6.5-Stable\nBy: 华育中学 Eric 倪天衡.\nGUI: Win32 API.\nIntroduction: Click is an light, open-source, convenient C++/Pascal IDE which based on MinGW and FPC.\nOnly for: Windows 7/8/8.1/10. You can contact us to get the XP Version.\nLicense: Apache License, Version 2.0\nTo learn more or get updates, please visit our official website: https://ericnth.cn/clickide/\nIf you meet some problems, please contact us or visit: Help->Get help..." , "About...", 0);
/*settitle*/
titlestr01="Click 4.6 [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
break;
case CM_RUN:
if (fcompiled) {
/*settitle*/
titlestr01="Click 4.6 [ Running ] [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"Running...");
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
sprintf (cmdbuf2, "start \"Click4.6-Executing [%s.exe]\" /max %s.exe",getcppfn(szFileName).c_str(),getcppfn(szFileName).c_str());
runprocess (cmdbuf2, 0, 1);
} else {
MessageBox (hwnd, "You haven't compiled this file yet (or have failed in it),\nPlease compile it first!", "Can't Run!", MB_OK | MB_ICONERROR);
}
/*settitle*/
titlestr01="Click 4.6 [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
break;
case CM_RUNPAS:
if (fcompiled) {
/*settitle*/
titlestr01="Click 4.6 [ Running ] [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"Running...");
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
sprintf (cmdbuf2, "start \"Click4.6-Executing [%s.exe]\" /max %s.exe",getpasfn(szFileName).c_str(),getpasfn(szFileName).c_str());
runprocess (cmdbuf2, 0, 1);
} else {
MessageBox (hwnd, "You haven't compiled this file yet (or have failed in it),\nPlease compile it first!", "Can't Run!", MB_OK | MB_ICONERROR);
}
/*settitle*/
titlestr01="Click 4.6 [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
break;
case CM_COMPILE:
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"Compiling...");
if ((!fsaved && !fopend) || strcmp(szFileName, "") == 0) {
if (!DoFileOpenSave(hwnd, TRUE)) {
break;
}
} else {
if(!SaveFile(GetDlgItem(hwnd, IDC_MAIN_TEXT), szFileName)) {
MessageBox(hwnd, "Save file failed.", "Error",MB_OK|MB_ICONEXCLAMATION);
fsaved=0;
}
}
/*settitle*/
titlestr01="Click 4.6 [ Compiling ] [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
sprintf (cmdbuf1, "g++.exe \"%s\" -o \"%s.exe\" 2> %s_compile_tmp.log",szFileName,getcppfn(szFileName).c_str(),szFileName);
sprintf (cmdbuf2, "start \"Click4.6-Executing [%s.exe]\" /max %s.exe",getcppfn(szFileName).c_str(),getcppfn(szFileName).c_str());
sprintf (cmdbuf3, "del \"%s.exe\"",getcppfn(szFileName).c_str());
sprintf (cmdbuf4, "del \"%s_compile_tmp.log\"",szFileName);
sprintf (cmdbuf5, "%s_compile_tmp.log",szFileName);
runprocess (cmdbuf3, 1, 0);
runprocess (cmdbuf1, 1, 0);
wndfin.open (cmdbuf5);
while (wndfin) {
errreportcnt++;
errreporti += wndfin.get();
}
wndfin.close();
if (errreportcnt>1) {
MessageBox (hwnd, errreporti.c_str(), "Click 4.6: Compile Error", MB_OK);
break;
fcompiled=0;
} else {
fcompiled=1;
}
runprocess (cmdbuf4, 1, 0);
/*settitle*/
titlestr01="Click 4.6 [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
SetWindowText (hwnd, titlestr01.c_str());
SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(fcompiled ? "已编译" : "未编译"));
/*end:settitle*/
break;
case CM_COMPILERUN:
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"Compiling...");
if ((!fsaved && !fopend) || strcmp(szFileName, "") == 0) {
if (!DoFileOpenSave(hwnd, TRUE)) {
break;
}
} else {
if(!SaveFile(GetDlgItem(hwnd, IDC_MAIN_TEXT), szFileName)) {
MessageBox(hwnd, "Save file failed.", "Error",MB_OK|MB_ICONEXCLAMATION);
fsaved=0;
}
}
/*settitle*/
titlestr01="Click 4.6 [ Compiling ] [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
sprintf (cmdbuf1, "g++ \"%s\" -o \"%s.exe\" 2> %s_compile_tmp.log",szFileName,getcppfn(szFileName).c_str(),szFileName);
sprintf (cmdbuf2, "start \"Click4.6-Executing [%s.exe]\" /max %s.exe",getcppfn(szFileName).c_str(),getcppfn(szFileName).c_str());
sprintf (cmdbuf3, "del \"%s.exe\"",getcppfn(szFileName).c_str());
sprintf (cmdbuf4, "del \"%s_compile_tmp.log\"",szFileName);
sprintf (cmdbuf5, "%s_compile_tmp.log",szFileName);
runprocess (cmdbuf3, 1, 0);
errreportcnt = 0;
runprocess (cmdbuf1, 1, 0);
wndfin.open (cmdbuf5);
while (wndfin) {
errreportcnt++;
errreporti += wndfin.get();
}
wndfin.close();
if (errreportcnt>1) {
MessageBox (hwnd, errreporti.c_str(), "Click 4.6: Compile Error", MB_OK);
fcompiled=0;
break;
} else {
fcompiled=1;
}
runprocess (cmdbuf4, 1, 0);
/*settitle*/
titlestr01="Click 4.6 [ Running ] [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"Running...");
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
runprocess (cmdbuf2, 0, 1);
/*settitle*/
titlestr01="Click 4.6 [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SetWindowText (hwnd, titlestr01.c_str());
SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(fcompiled ? "已编译" : "未编译"));
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
/*end:settitle*/
break;
case CM_COMPILPAS:
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"Compiling...");
if ((!fsaved && !fopend) || strcmp(szFileName, "") == 0) {
if (!DoFileOpenSave(hwnd, TRUE)) {
break;
}
} else {
if(!SaveFile(GetDlgItem(hwnd, IDC_MAIN_TEXT), szFileName)) {
MessageBox(hwnd, "Save file failed.", "Error",MB_OK|MB_ICONEXCLAMATION);
fsaved=0;
}
}
/*settitle*/
titlestr01="Click 4.6 [ Compiling ] [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
sprintf (cmdbuf1, "fpc.exe %s > %s_compile_tmp.log",szFileName,szFileName);
sprintf (cmdbuf2, "start /max %s.exe",getpasfn(szFileName).c_str());
sprintf (cmdbuf3, "del \"%s\"",getpasfn(szFileName).c_str());
sprintf (cmdbuf4, "del \"%s_compile_tmp.log\"",szFileName);
sprintf (cmdbuf5, "%s_compile_tmp.log",szFileName);
//runprocess (cmdbuf3);
runprocess (cmdbuf1, 1, 0);
errreportcnt = 0;
wndfin.open (cmdbuf5);
while (wndfin) {
errreportcnt++;
errreporti += wndfin.get();
}
wndfin.close();
if (errreportcnt>1) {
MessageBox (NULL, errreporti.c_str(), "Click 4.6: Compile Message", MB_OK | MB_ICONINFORMATION);
break;
fcompiled=1;
} else {
fcompiled=1;
}
runprocess (cmdbuf4, 1, 0);
/*settitle*/
titlestr01="Click 4.6 [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(fcompiled ? "已编译" : "未编译"));
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
break;
case CM_COMPILERUPAS:
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"Compiling...");
if ((!fsaved && !fopend) || strcmp(szFileName, "") == 0) {
if (!DoFileOpenSave(hwnd, TRUE)) {
break;
}
} else {
if(!SaveFile(GetDlgItem(hwnd, IDC_MAIN_TEXT), szFileName)) {
MessageBox(hwnd, "Save file failed.", "Error",MB_OK|MB_ICONEXCLAMATION);
fsaved=0;
}
}
/*settitle*/
titlestr01="Click 4.6 [ Compiling ] [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
sprintf (cmdbuf1, "fpc.exe %s > %s_compile_tmp.log",szFileName,szFileName);
sprintf (cmdbuf2, "start /max %s.exe",getpasfn(szFileName).c_str());
sprintf (cmdbuf3, "del \"%s\"",getpasfn(szFileName).c_str());
sprintf (cmdbuf4, "del \"%s_compile_tmp.log\"",szFileName);
sprintf (cmdbuf5, "%s_compile_tmp.log",szFileName);
//runprocess (cmdbuf3);
runprocess (cmdbuf1, 1, 0);
wndfin.open (cmdbuf5);
errreportcnt = 0;
while (wndfin) {
errreportcnt++;
errreporti += wndfin.get();
}
wndfin.close();
if (errreportcnt>1) {
/*
if (errreporti.find("Fatal:")&&errreporti.find("Error:")) {
fcompiled=0;
MessageBox (NULL, errreporti.c_str(), "Click 4.6: Compile Error", MB_OK | MB_ICONERROR);
break;
} else {
*/
fcompiled=1;
MessageBox (NULL, errreporti.c_str(), "Click 4.6: Compile Message", MB_OK | MB_ICONINFORMATION);
/*
}
*/
} else {
fcompiled=1;
}
runprocess (cmdbuf4, 1, 0);
/*settitle*/
titlestr01="Click 4.6 [ Running ] [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"Running...");
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
runprocess (cmdbuf2, 0, 1);
/*settitle*/
titlestr01="Click 4.6 [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(fcompiled ? "已编译" : "未编译"));
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
break;
case CM_STARTCMD:
runprocess ((char*)"start /max \"Click 4.6 [Command]\"", 0, 1);
break;
case CM_RUNBAT:
/*settitle*/
titlestr01="Click 4.6 [ Running (Bat) ] [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"Running Bat...");
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
if ((!fsaved && !fopend) || strcmp(szFileName, "") == 0) {
DoFileOpenSave(hwnd, TRUE);
} else {
if(!SaveFile(GetDlgItem(hwnd, IDC_MAIN_TEXT), szFileName)) {
MessageBox(hwnd, "Save file failed.\n(Or this is an empty file.)", "Error",MB_OK|MB_ICONEXCLAMATION);
fsaved=0;
}
}
sprintf (cmdbuf2, "start \"Click4.6-Executing [%s]\" /max %s", szFileName, szFileName);
runprocess (cmdbuf2, 0, 1);
/*settitle*/
titlestr01="Click 4.6 [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
break;
case CM_DEBUG:
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"Debugging...");
if ((!fsaved && !fopend) || strcmp(szFileName, "") == 0) {
DoFileOpenSave(hwnd, TRUE);
} else {
if(!SaveFile(GetDlgItem(hwnd, IDC_MAIN_TEXT), szFileName)) {
MessageBox(hwnd, "Save file failed.", "Error",MB_OK|MB_ICONEXCLAMATION);
fsaved=0;
}
}
sprintf (cmdbuf2, "start /max \"Click4.6-Debugging [%s]\" gdb %s.exe", getcppfn(szFileName).c_str(), getcppfn(szFileName).c_str());
runprocess (cmdbuf2, 0, 1);
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
break;
case CM_VVARI:
/*settitle*/
titlestr01="Click 4.6 [ Viewing Variables... ]";
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"Viewing Variables...");
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
sprintf (cmdbuf1, "szFileName\t= %s\nfsaved \t= %s\nfopened \t= %s\nfcompiled \t= %s\nCurrentTime\t= %s\nCurrentMessage\t= %d/%d\nMessageCount\t= %lld", szFileName, (fsaved ? "True" : "False"), (fopend ? "True" : "False"), (fcompiled ? "True" : "False"), output_time().c_str(), WM_COMMAND, CM_VVARI, variMsgCnt);
MessageBox (hwnd, cmdbuf1, "Variables...", MB_OK | MB_ICONINFORMATION);
/*settitle*/
titlestr01="Click 4.6 [ ";
titlestr01+=szFileName;
titlestr01+=" ]";
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
SetWindowText (hwnd, titlestr01.c_str());
/*end:settitle*/
break;
case CM_GHELP:
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"Helps...");
GHELPSTARTPLACE:
switch (MessageBox (0, "在您使用该软件进行编译运行前,请确保您已经将您的g++编译器bin目录和fpc编译器的bin\\i386-win32\\目录添加到环境变量PATH。(环境变量设置方法:右击“此电脑”->属性,点击左侧“高级系统设置”,在“高级”标签下单击“环境变量(N)...”,双击“系统变量”中的PATH项进行编辑,在后面添加“XXX\\FPC\\2.2.2\\bin\\i386-win32\\”和“XXX\\MinGW\\bin\\”(将XXX替换为你的安装位置,不要加引号!),然后全部点击“确定”即可。", "Help 01", MB_CANCELTRYCONTINUE | MB_ICONINFORMATION | MB_DEFBUTTON3)) {
case IDCANCEL: GHELPEXITFLAG = 1;break;
case IDCONTINUE:break;
case IDTRYAGAIN: goto GHELPSTARTPLACE;break;
default: GHELPEXITFLAG = 1;break;
}
if (GHELPEXITFLAG) {SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"..."); break;}
switch (MessageBox (0, "在您打开一个文件后,可以对它进行任何操作。我们并没有禁止类似打开一个C++文件后用\"Compile Pascal File...\"来进行编译等的操作(尽管这不对),因此您在使用编译/运行这些选项时,请务必确认是否选择了正确的语言!", "Help 02", MB_CANCELTRYCONTINUE | MB_ICONINFORMATION | MB_DEFBUTTON3)) {
case IDCANCEL: GHELPEXITFLAG = 1;break;
case IDCONTINUE:break;
case IDTRYAGAIN: goto GHELPSTARTPLACE;break;
default: GHELPEXITFLAG = 1;break;
}
if (GHELPEXITFLAG) {SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"..."); break;}
switch (MessageBox (0, "由于作者能力有限以及本软件向C++的偏向性,部分Pascal程序可能无法正确编译/运行,请您谅解。您也可选择使用其他Pascal编译器(只要把它的目录添加到环境变量PATH,并将软件安装时自带的FPC目录从环境变量PATH中移除即可。", "Help 03", MB_CANCELTRYCONTINUE | MB_ICONINFORMATION | MB_DEFBUTTON3)) {
case IDCANCEL: GHELPEXITFLAG = 1;break;
case IDCONTINUE:break;
case IDTRYAGAIN: goto GHELPSTARTPLACE;break;
default: GHELPEXITFLAG = 1;break;
}
if (GHELPEXITFLAG) {SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"..."); break;}
switch (MessageBox (0, "由于本软件开发时间较短,因此在使用过程中由以下限制:\n 1.仅用于Windows操作系统的部分支持Win32API的版本。\n 2.C++文件仅支持.cpp, .c++, .cxx后缀名,Pascal文件仅支持.pp后缀名,C++头文件仅支持.hpp后缀名,批处理文件仅支持.bat, .com, .cmd后缀名,请谅解。如您使用其他的后缀名(字符数量不符),可能导致编译运行失败。", "Help 04", MB_CANCELTRYCONTINUE | MB_ICONINFORMATION | MB_DEFBUTTON3)) {
case IDCANCEL: GHELPEXITFLAG = 1;break;
case IDCONTINUE:break;
case IDTRYAGAIN: goto GHELPSTARTPLACE;break;
default: GHELPEXITFLAG = 1;break;
}
if (GHELPEXITFLAG) {SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"..."); break;}
switch (MessageBox (0, "在您想要直接运行/调试一个程序时,必须先保存。并且,如果您想要运行/调试当前您写的程序,请先编译,否则运行/调试的是您上一次编译后生成的程序。", "Help 05", MB_CANCELTRYCONTINUE | MB_ICONINFORMATION | MB_DEFBUTTON3)) {
case IDCANCEL: GHELPEXITFLAG = 1;break;
case IDCONTINUE:break;
case IDTRYAGAIN: goto GHELPSTARTPLACE;break;
default: GHELPEXITFLAG = 1;break;
}
if (GHELPEXITFLAG) {SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"..."); break;}
switch (MessageBox (0, "若您的状态条被遮挡,且您想要查看,可以选择Help > Flush StatusBar进行刷新。", "Help 06", MB_CANCELTRYCONTINUE | MB_ICONINFORMATION | MB_DEFBUTTON3)) {
case IDCANCEL: GHELPEXITFLAG = 1;break;
case IDCONTINUE:break;
case IDTRYAGAIN: goto GHELPSTARTPLACE;break;
default: GHELPEXITFLAG = 1;break;
}
if (GHELPEXITFLAG) {SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"..."); break;}
switch (MessageBox (0, "本文件夹内Click4.6.exe是可以单独使用的,即:您可以把这个exe文件复制到任意位置(甚至其他Windows电脑)均可使用。但您需要自己设置MinGW和FPC库,在本发布版中已经自带(即MinGW和FPC文件夹),但您仍然可以使用自己的库。只要将它添加到环境变量即可。", "Help 07", MB_CANCELTRYCONTINUE | MB_ICONINFORMATION | MB_DEFBUTTON3)) {
case IDCANCEL: GHELPEXITFLAG = 1;break;
case IDCONTINUE:break;
case IDTRYAGAIN: goto GHELPSTARTPLACE;break;
default: GHELPEXITFLAG = 1;break;
}
if (GHELPEXITFLAG) {SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"..."); break;}
switch (MessageBox (0, "其次,若看到类似结尾为_compile_tmp.log的文件,是我们在编译过程中(可能会)生成的临时日志文件,您完全可以直接删除,对ClickIDE和其他软件的运行没有任何影响。", "Help 08", MB_CANCELTRYCONTINUE | MB_ICONINFORMATION | MB_DEFBUTTON3)) {
case IDCANCEL: GHELPEXITFLAG = 1;break;
case IDCONTINUE:break;
case IDTRYAGAIN: goto GHELPSTARTPLACE;break;
default: GHELPEXITFLAG = 1;break;
}
if (GHELPEXITFLAG) {SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"..."); break;}
switch (MessageBox (0, "在您编译时,若是C++程序,仅当发生错误/警告时才会发出提示,否则直接编译完成;若是Pascal程序,任何情况下都会发出编译提示,所以请认真留意提示中是否存在例如\"Fatal\"或\"Error\"之类的字眼,如有,则表明编译出错,反之,则表明编译通过。", "Help 09", MB_CANCELTRYCONTINUE | MB_ICONINFORMATION | MB_DEFBUTTON3)) {
case IDCANCEL: GHELPEXITFLAG = 1;break;
case IDCONTINUE:break;
case IDTRYAGAIN: goto GHELPSTARTPLACE;break;
default: GHELPEXITFLAG = 1;break;
}
if (GHELPEXITFLAG) {SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"..."); break;}
switch (MessageBox (0, "若有其他困难,问题,意见或者建议,请您一定要及时联系作者邮箱eric_ni2008@163.com进行咨询或投诉,以便我们今后把ClickIDE做得更加完善!", "Help 10", MB_CANCELTRYCONTINUE | MB_ICONINFORMATION | MB_DEFBUTTON3)) {
case IDCANCEL: GHELPEXITFLAG = 1;break;
case IDCONTINUE:break;
case IDTRYAGAIN: goto GHELPSTARTPLACE;break;
default: GHELPEXITFLAG = 1;break;
}
if (GHELPEXITFLAG) {SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"..."); break;}
MessageBox (0, "没有更多提示了......", "Message", MB_OK | MB_ICONINFORMATION);
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
break;
case CM_EDIT_UNDO:
SendDlgItemMessage(hwnd, IDC_MAIN_TEXT, EM_UNDO, 0, 0);
break;
case CM_EDIT_CUT:
SendDlgItemMessage(hwnd, IDC_MAIN_TEXT, WM_CUT, 0, 0);
break;
case CM_EDIT_COPY:
SendDlgItemMessage(hwnd, IDC_MAIN_TEXT, WM_COPY, 0, 0);
break;
case CM_EDIT_PASTE:
SendDlgItemMessage(hwnd, IDC_MAIN_TEXT, WM_PASTE, 0, 0);
break;
case CM_EDIT_FIND:
ZeroMemory(&repfindtag, sizeof(repfindtag));
repfindtag.hwndOwner = hwnd;
repfindtag.lpstrFindWhat = "\0";
repfindtag.Flags = FR_DOWN|FR_FINDNEXT|FR_MATCHCASE;
repfindtag.wFindWhatLen = MAX_PATH;
repfindtag.wReplaceWithLen = MAX_PATH;
//repfindtag.lpstrFindWhat = szFindWhat;
repfindtag.lCustData = 0;
repfindtag.lpfnHook = NULL;
repfindtag.lStructSize = sizeof(repfindtag);
FindText(&repfindtag);
break;
case CM_FLSTB:
SendMessage(g_hStatusBar, SB_SETTEXT, 0, (LPARAM)"Click 4.6 IDE");
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"...");
SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(fcompiled ? "已编译" : "未编译"));
SendMessage(g_hStatusBar, SB_SETTEXT, 3, (LPARAM)"");
SendMessage(g_hStatusBar, SB_SETTEXT, 4, (LPARAM)szFileName);
break;
case CM_GHTML: {
SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)"GeneratingHTML...");
GetDlgItemText(hwnd, IDC_MAIN_TEXT, getallcodetmpstr, 200000);
codealltmp.clear();
codealltmp+=getallcodetmpstr;
codealltmp+="\n ";
//MessageBox(hwnd, codealltmp.c_str(), "", MB_OK);
char hlfilename[MAX_PATH*6];
strcpy(hlfilename, szFileName);
strcat(hlfilename, (char*)"_highlight.html");
char titlefilename[MAX_PATH*6];
strcpy(titlefilename, "Click4.6-");
strcat(titlefilename, hlfilename);
fout.open(hlfilename);
fout << "<!DOCTYLE html>" << endl;
fout << "<html><head><meta charset=\"utf-8\"/><title>";
fout << titlefilename;
fout << "</title><style>body{font-family:Consolas,Arial,Helvetica,sans-serif;}h3{font-style:italic}.operator{color:#ff2c0f;}.zfc{color:#0000ff;}.ycl{color:#80ab66}.zs{color:#0078d7;}.gjz{font-weight:bold;}.vari{font-weight:bold;color:#8e37a7;}</style></head>" << endl;
fout << "<body><h3>Exported by ClickIDE 4.6</h3><p>";
for (int i = 0; i < codealltmp.size(); i++) {
if (dontout) {
dontout = 0;