source: dev/trunk/ab5.0/abdev/abdev/Common.h@ 653

Last change on this file since 653 was 653, checked in by dai_9181, 16 years ago

FileTreeView周りをリファクタリング

File size: 32.0 KB
Line 
1#pragma once
2
3#define OEMRESOURCE
4#define _CRT_SECURE_NO_DEPRECATE //セキュリティ警告を出さない
5#define _CRT_NONSTDC_NO_DEPRECATE
6#include <windows.h>
7#include <stdio.h>
8#include <string.h>
9#include <commctrl.h>
10#include "htmlhelp.h"
11#include <shlobj.h>
12#include <zmouse.h>
13#include <math.h>
14#include <limits.h>
15#include <process.h>
16#include <wininet.h>
17
18#include "nkf_class.h"
19#include "WebSearch.h"
20#include "ruler.h"
21#include "TabCtrl.h"
22#include "ExtensionLink.h"
23#include "HtmlAnalysis.h"
24#include "FileTree.h"
25#include "menu.h"
26#include "LuxCtrl.h"
27#include "MdiTextEdit.h"
28#include "BREGEXP.H"
29#include "../compiler_x86/CommandValue.h"
30
31
32#include "Attach.h"
33#include "Debugger.h"
34
35
36#pragma comment(lib, "wininet.lib")
37
38
39
40#ifdef THETEXT
41
42////////////////////////////
43// TheTextのバージョン情報
44////////////////////////////
45#define APPLICATION_NAME "TheText"
46#define VERSION_APPLI_NAME APPLICATION_NAME
47#define VERSION_STRING "1.02"
48
49#else
50
51/////////////////////////////////////////////////
52// ActiveBasic/ProjectEditorのバージョン情報
53/////////////////////////////////////////////////
54#define APPLICATION_NAME "ActiveBasic 5.0"
55#define VERSION_APPLI_NAME APPLICATION_NAME
56#define VERSION_STRING "5.00.00"
57
58#endif
59
60
61
62#ifndef IMAGE_FILE_MACHINE_AMD64
63#define IMAGE_FILE_MACHINE_AMD64 0x8664 // AMD64 (K8)
64#endif
65
66
67#if defined(JPN)
68
69#ifdef THETEXT
70//TheText日本語
71#include "../res_TheText/resource.h"
72#include "common_msg_jpn.h"
73#else
74//日本語
75#include "../res/resource.h"
76#include "common_msg_jpn.h"
77#endif
78
79#else
80//英語
81#include "../res_e/resource.h"
82#include "common_msg_eng.h"
83#endif
84
85//アイコンリソース
86#include "../icon_res/resource.h"
87
88
89
90
91#define GENERAL_SIZE 8192
92#define MAX_ARRAYDIM 16
93
94#define MAX_WNDNUM 255
95
96
97#ifdef _AMD64_
98#else
99typedef long LONG_PTR;
100typedef DWORD ULONG_PTR;
101#endif
102
103//ファイルタイプ
104#define FT_BASICPROGRAM 1
105#define FT_SUBPROGRAM 2
106#define FT_TEXT 3
107#define FT_PROJECT 4
108#define FT_ICON 5
109#define FT_HTML 6
110#define FT_OTHER 0
111
112#define BMPNUM_STANDARDTOOLBAR 10 //hDefaultToolbarのビットマップ数
113#define SEPNUM_STANDARDTOOLBAR 4 //hDefaultToolbarのセパレータ数
114#define BMPNUM_DEBUGGERTOOLBAR 8 //hDebuggerToolbarのビットマップ数
115#define SEPNUM_DEBUGGERTOOLBAR 2 //hDebuggerToolbarのセパレータ数
116#define BMPNUM_RADTOOLBAR 18 //コントロール挿入用ツールバーのビットマップ数(区切り用BMPを最後の1つに用意する)
117#define SEPNUM_RADTOOLBAR 3 //コントロール挿入用ツールバーのセパレータ数
118
119//MDIクライアントウィンドウ下のドキュメントウィンドウタイプ
120#define WNDTYPE_BASIC 1
121#define WNDTYPE_TEXT 2
122#define WNDTYPE_RAD 3
123#define WNDTYPE_MENU 4
124#define WNDTYPE_ICONEDIT 5
125#define WNDTYPE_HTML 6
126
127#define IS_DOCUMENT_TEXT(a) (a==WNDTYPE_BASIC||a==WNDTYPE_TEXT||a==WNDTYPE_HTML)
128
129#define IS_RETURN(buffer,p) (buffer[p]=='\r'&&buffer[p+1]=='\n')
130#define IS_BLANK(c) (c==' '||c=='\t')
131
132//Rebarコントロールの個数(レバー追加)
133#define MAX_REBARBANDS 5
134
135//RebarコントロールのID(レバー追加)
136#define ID_DOCCOMBO 1
137#define ID_STANDARDTOOLBAR 2
138#define ID_RELEASETOOLBAR 3
139#define ID_DEBUGGERTOOLBAR 4
140#define ID_SELECTCOMPILERCOMBO 5
141#define ID_WEB_SEARCH 6
142
143//検索コンボボックスの最大リスト数
144#define MAX_FINDLIST 20
145
146#define ID_FIRSTCHILD 100
147
148
149//タブカラー
150#define TABCOLOR_GRAY RGB(230,230,230) //灰色
151#define TABCOLOR_WHITE RGB(255,255,255) //白
152#define TABCOLOR_RED RGB(255,200,200) //赤
153#define TABCOLOR_GREEN RGB(200,255,200) //緑
154#define TABCOLOR_BLUE RGB(200,220,255) //青
155#define TABCOLOR_YELLOW RGB(255,255,180) //黄色
156
157
158#define WM_RESETCARETPOS WM_USER+80 //オートスクロールスレッドからのキャレット設定
159
160#define WM_SEARCH_TAB_CREATE WM_USER+90 //Web検索のタブアイテムの生成メッセージ
161#define WM_SEARCH_TAB_CLOSE WM_USER+91 //Web検索のタブアイテムの破棄メッセージ
162
163//SideWeb
164#define WM_BROWS_CREATE WM_USER+100
165#define WM_BROWS_DESTROY WM_USER+101
166#define WM_BROWS_GO WM_USER+102
167#define WM_BROWS_NAVI WM_USER+103
168
169
170
171#define MAX_HASH 32768
172
173
174//////////////////////////////////
175// メインウィンドウのタイマーID
176
177#define ID_TIMER_BACKUP 10
178#define ID_DEBUGSAFTY 20
179
180// ここまで
181//////////////////////////////////
182
183
184
185extern HANDLE hHeap;
186extern HINSTANCE hInst,hResInst,hIconResInst;
187extern HWND hOwner;
188extern HWND hClient;
189extern int ScreenX,ScreenY;
190extern char pj_editor_Dir[MAX_PATH];
191
192
193//アルファブレンド用のAPI
194#define WS_EX_LAYERED 0x00080000
195#define LWA_ALPHA 0x00000002
196typedef BOOL (WINAPI *FWINLAYER)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags );
197
198
199
200//新規プロジェクトのベース
201#define BASE_VOID 0
202#define BASE_PROMPT 1
203#define BASE_NORMAL 2
204
205struct POINTANDSIZE{
206 POINT pos;
207 SIZE size;
208};
209
210
211
212//////////////////////////////////////////
213// リソース ヘッダ(アイコン、カーソル用)
214typedef struct{
215 WORD idReserved;
216 WORD idType;
217 WORD idCount;
218}ICONDIR,CURSORDIR;
219
220////////////////////////////
221//.icoファイルのヘッダ情報
222struct ICONDIRENTRY{
223 BYTE bWidth;
224 BYTE bHeight;
225 BYTE bColorCount;
226 BYTE bReserved;
227 WORD wPlanes;
228 WORD wBitCount;
229 DWORD dwBytesInRes;
230 DWORD dwImageOffset;
231};
232
233
234/////////////////////
235//MDIウィンドウ情報
236
237#define MAX_UNDONUM 300//512未完成
238#define MAX_ICONEDIT_UNDONUM 32
239
240#define TEXTEDIT_UNDO_KEY 1
241#define TEXTEDIT_UNDO_PASTE 2
242#define TEXTEDIT_UNDO_SELKEY 3
243struct TEXTEDIT_UNDOSTATE{
244 int NowPos;
245 int Command[MAX_UNDONUM];
246 char *KeyStr[MAX_UNDONUM];
247 char *DelStr[MAX_UNDONUM];
248 CHARRANGE Range[MAX_UNDONUM];
249 CHARRANGE DelRange[MAX_UNDONUM];
250};
251
252struct RAD_UNDOSTATE_NAME{
253 std::string name;
254};
255#define RAD_UNDO_INSERTWND 1
256#define RAD_UNDO_DELETEWND 2
257#define RAD_UNDO_INSERTITEM 3
258#define RAD_UNDO_DELETEITEM 4
259#define RAD_UNDO_NAME 5
260#define RAD_UNDO_CAPTION 6
261#define RAD_UNDO_FONT 7
262#define RAD_UNDO_BGCOLOR 8
263#define RAD_UNDO_WINDOWMENU 9
264#define RAD_UNDO_ICONRES 10
265#define RAD_UNDO_STYLE 11
266#define RAD_UNDO_EXSTYLE 12
267#define RAD_UNDO_POSITION 13
268#define RAD_UNDO_IMAGESTATE 14
269#define RAD_UNDO_TYPE 15
270struct RAD_UNDOSTATE{
271 int NowPos;
272 int Command[MAX_UNDONUM];
273 int SelectItemNum[MAX_UNDONUM];
274 DWORD lpdwData[MAX_UNDONUM];
275};
276
277#define MAX_RAD_SELITEM 255
278struct MDIRADINFO{
279 //Radツール用
280
281 HWND hTools;
282
283 HWND hProperty;
284 HWND hProp_Dlg;
285
286 HWND hSupport;
287
288 HWND hRad;
289
290 HBITMAP hBitmap;
291 HBITMAP hOldBitmap;
292 HDC hMemDC;
293 int SelectingItem[MAX_RAD_SELITEM];
294 int ButtonSelect;
295
296 //ウィンドウクライアント領域
297 POINT ClientPos;
298 SIZE ClientSize;
299
300 //変更情報
301 RAD_UNDOSTATE undo;
302};
303
304struct MDIMENUINFO{
305 HWND hList;
306 HWND hMenuEdit;
307 HWND hEdit_Dlg;
308};
309
310#define ICONTYPE_16_16 0
311#define ICONTYPE_16_256 1
312#define ICONTYPE_32_16 2
313#define ICONTYPE_32_256 3
314struct ICONEDIT_UNDOSTATE{
315 int NowPos;
316 BYTE *lpData[MAX_ICONEDIT_UNDONUM];
317};
318struct MDIICONEDITINFO{
319 HWND hMain;
320 HWND hToolDlg;
321 HWND hButtonsDlg;
322 HWND hColorDlg;
323
324 HDC memdc;
325 HBITMAP hMemBmp;
326
327 HBITMAP hSelectingBmp;
328 int SelectLevel;
329 RECT DraggingRect;
330
331 int num;
332 int SelectIconNum;
333 union{
334 BYTE *pIconImage[8]; //アイコンのイメージデータ配列(マップ配列、カラー配列、マスク配列)
335 BITMAPINFOHEADER *pBmpHdr[8];
336 };
337 DWORD dwBytesInRes[8];
338
339 DWORD NowTool;
340 COLORREF MainColor;
341 COLORREF SubColor;
342
343 ICONEDIT_UNDOSTATE undo[8];
344 BOOL bModify;
345};
346
347struct MDIINFO{
348 HWND hwnd;
349 int DocType;
350 std::string title;
351 std::string path;
352
353 union{
354 MDIRADINFO *MdiRadInfo;
355 MDIMENUINFO *MdiMenuInfo;
356 MDIICONEDITINFO *MdiIconEditInfo;
357 CMdiTextEdit *pMdiTextEdit;
358 };
359
360 char *IndentStr;
361};
362extern std::vector<MDIINFO *> MdiInfo;
363
364//RADツールのマウスドラッグ
365#define FRAME_CHANGEPOS_START 1 //----- ここから -----
366#define FRAME_UPPER_LEFT 1
367#define FRAME_UPPER_RIGHT 2
368#define FRAME_LOWER_LEFT 3
369#define FRAME_LOWER_RIGHT 4
370#define FRAME_LEFT 5
371#define FRAME_RIGHT 6
372#define FRAME_UPPER 7
373#define FRAME_LOWER 8
374#define FRAME_INSIDE 9
375#define FRAME_CHANGEPOS_END 9 //----- ここまで -----
376#define ITEM_MAKING 10
377#define SELECTING_FRAME 11
378
379//アイテムの大きさの限界値
380#define MIN_ITEM_X 12
381#define MIN_ITEM_Y 9
382
383//選択アイテム
384#define SELECT_WINDOW -1
385#define NON_TOOL -1
386
387struct RADINFO{
388 int NowDragging;
389 POINT DragStartPos;
390 RECT DragStartRect[MAX_RAD_SELITEM];
391 RECT DraggingRect[MAX_RAD_SELITEM];
392 RECT OldDraggingRect[MAX_RAD_SELITEM];
393};
394
395
396//////////////////
397//リソース情報
398extern HTREEITEM hCursorTreeItemForProjectView;
399extern HTREEITEM hBitmapTreeItemForProjectView;
400extern HTREEITEM hIconTreeItemForProjectView;
401
402
403////////////////////
404//プロジェクト情報
405
406#define PROJECT_VERSION 10
407
408class CFileInfo{
409 std::string filepath;
410public:
411 HTREEITEM m_hTreeItem;
412 CFileInfo( const std::string &filepath, HTREEITEM hTreeItem );
413
414 const std::string &GetPath() const
415 {
416 return filepath;
417 }
418
419 void GetFullPath(char *buffer);
420};
421class CDBFileInfo{
422public:
423 int iNum;
424 CFileInfo **ppobj_FileInfo;
425
426 CDBFileInfo();
427 ~CDBFileInfo();
428
429 void add(char *path,HTREEITEM hTreeItem);
430 void del(HTREEITEM hTreeItem);
431 const std::string &GetPath(HTREEITEM hTreeItem);
432 BOOL IsMainFile(HTREEITEM hTreeItem);
433
434 BOOL dupli_check(char *path);
435};
436
437struct PROCINFO{
438 char *name;
439 int FileNum;
440 HTREEITEM hTreeItem;
441
442 int code_pos;
443};
444struct INCPROCINFO{
445 char *name;
446 char *Parms;
447 char *type;
448};
449
450//ダイアログアイテムの種類
451#define CT_BUTTON 1
452#define CT_CHECKBOX 2
453#define CT_COMBOBOX 3
454#define CT_EDIT 4
455#define CT_GROUPBOX 5
456#define CT_HSCROLLBAR 6
457#define CT_IMAGEBOX 7
458#define CT_LISTBOX 8
459#define CT_LISTVIEW 9
460#define CT_RADIOBUTTON 10
461#define CT_STATIC 11
462#define CT_TREEVIEW 12
463#define CT_VSCROLLBAR 13
464#define CT_UPDOWN 14
465#define CT_PROGRESSBAR 15
466#define CT_TRACKBAR 16
467#define CT_MENU 99
468
469//イベント タイプ
470#define EVENTTYPE_DEFAULT 0
471#define EVENTTYPE_MENU 1
472#define EVENTTYPE_MMSYS 2
473
474
475struct NEWPROJECTINFO{
476 char name[MAX_PATH];
477 DWORD dwTypeID;
478 _int8 ShowHelloWorld;
479 DWORD dwOption;
480};
481struct MENU_INFO{
482 char *IdName;
483 char *caption;
484 UINT type;
485 UINT state;
486
487 int NumberOfMenu;
488 MENU_INFO *pMenuInfo;
489
490 HTREEITEM hTreeItem;
491};
492#define MT_EXE 0 //EXEモジュールタイプ
493#define MT_DLL 1 //DLLモジュールタイプ
494#define MT_SLL 2 //SLLモジュールタイプ
495#define PJ_OP_SOURCE_MASK 0x00FFFFFF
496#define PJ_OP_MMSYSTEM 0x00000001
497#define PJ_OP_COMMCTRL 0x00000002
498#define PJ_OP_RICHEDIT 0x00000004
499#define PJ_OP_WINSOCK 0x00000008
500#define PJ_OP_STRICT 0x00010000 // #strictディレクティブは今は使われていない
501#define PJ_OP_RC_MANIFEST 0x00020000
502#define PJ_OP_UNICODE 0x00040000
503
504
505
506struct SAVEREBAR{
507 int RebarID;
508 int RebarLength;
509 int IsBandBreak;
510};
511
512struct ITEMEVENTINFO{
513 char *IdName;
514 char **pEventNames;
515 int ClassID;
516 int EventNum;
517};
518
519#define PARAMETER_HINT_MAX_SIZE 8192
520struct METHODCHECKINFO{
521 HWND hWnd;
522 LOGFONT LogFont;
523 HFONT hFont;
524 HFONT hBoldFont;
525 char BeforeMethodName[VN_SIZE];
526 char msg[PARAMETER_HINT_MAX_SIZE];
527 int ParmNum;
528 int HeadPos;
529};
530
531
532/////////////////////
533// コード補完機能
534/////////////////////
535
536#define ACCESS_NON 0
537#define ACCESS_PRIVATE 1
538#define ACCESS_PUBLIC 2
539#define ACCESS_PROTECTED 3
540#define ACCESS_PAIRCOMMAND 4
541#define ACCESS_HTML_GENERAL_PARAM 5
542#define ACCESS_HTML_PARAM 6
543struct MEMBERINFO{
544 //クラス名
545 char *pName;
546 DWORD dwProc;
547 DWORD dwAccess;
548
549 int code_pos;
550};
551struct COMPLEMENT_WINDOW_INFO{
552 HWND hWnd;
553 HWND hList;
554
555 int iPos;
556 int iLength;
557
558 MEMBERINFO *pMemberInfo;
559 int MemberNum;
560
561 //ペアステートメントのインデント格納用
562 char szIndent[255];
563};
564
565
566
567class CSettingFile{
568 BOOL GetDataLine(const char *name,char *parms);
569protected:
570 char *buffer;
571
572 BOOL GetWholeValue(const char *name,int *pi32data);
573 bool GetBoolean( const char *name,bool &b );
574 BOOL Get3WholeValue(char *name,int *pd1,int *pd2,int *pd3);
575 BOOL GetRGBValue(char *name,COLORREF *prgb);
576 BOOL GetStringValue(char *name,char *str);
577 BOOL GetRectValue(char *name,RECT *prc);
578 BOOL GetLogFont(char *name,LOGFONT *plf);
579 BOOL GetRebarBand(SAVEREBAR *psr,int num);
580
581 void SetWholeValue( const char *name,long i32data);
582 void SetBoolean( const char *name,bool b);
583 void Set3WholeValue(char *name,long d1,long d2,long d3);
584 void SetRGBValue(char *name,COLORREF rgb);
585 void SetStringValue(char *name,char *str);
586 void SetRectValue(char *name,RECT *prc);
587 void SetLogFont(char *name,LOGFONT *plf);
588 void SetRebarBand(SAVEREBAR *psr,int num);
589};
590#include "DesignTheme.h"
591
592
593
594//ProjectEditor.cpp
595void HeapDefaultFree(LPVOID lpMem);
596void ToBigChar(char str[]);
597int GetWndNum(HWND hChild);
598int GetNowWndNum(void);
599int GetFileNum(int WndNum);
600void SendTextEditResizeEvent(HWND hwnd);
601void RedrawAllWindow(void);
602int DocumentModifyCheck(HWND hChild);
603void SetStatusText(char *MenuText);
604void ResetState_UndoMenu(void);
605void ResetState_EditMenu(void);
606void ResetState_DocMenu(void);
607void DuplicateTitleCheck(char *lpszTitle);
608HWND NewTextEditWindow(char *filepath,_int8 DocumentType,COLORREF TabColor=TABCOLOR_GRAY);
609void CloseDocWindow(int WndNum);
610void ResizeTextEditWnd(HWND hwnd,int cx,int cy);
611#define FLAG_DBLCLK 1
612#define FLAG_BEAMCURSOR 2
613int RegWndClass(WNDPROC WndProc,char *lpClassName,HBRUSH hBackBrush,DWORD dwFlag);
614
615//Backup.cpp
616void CreateBackupDir(void);
617void backup(void *dummy);
618BOOL restore(void);
619
620//DialogBoxes.cpp
621void SetPosCenter(HWND hParent,HWND hwnd);
622void SetPosCenter(HWND hwnd);
623BOOL SetFontDialog(HWND hwnd,LOGFONT *lf,BOOL bFixedPitchOnly,int *lpiPointSize=0);
624void DlgNewProjectWizard(HWND hwnd);
625BOOL CALLBACK DlgNewFile(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
626void DlgProjectOptionSetting(HWND hwnd);
627void DlgOptionSetting(HWND hwnd);
628BOOL CALLBACK DialogAbout(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
629
630//FileOperation.cpp
631void MakeUserSettingDir(void);
632char *ReadBuffer( const std::string &path );
633char *ReadBuffer_NonErrMsg( const std::string &path );
634_int8 WriteBuffer(const std::string &path,const char *buffer,int length, bool isEnableError = true);
635_int8 WriteBuffer_NonErrMsg(const std::string &path,char *buffer,int length);
636void GetRelationalPath(char *path,char *dir);
637void GetFullPath(char *path,const char *dir);
638void RemoveDirectoryStrong(const char *dirPath);
639BOOL GetFilePathDialog(HWND hwnd,char *filename,LPSTR Filter,LPSTR Title,_int8 IsOpen);
640BOOL GetFolder(HWND hWnd,char *folder,char *OpenFolderTitle);
641int GetFileExtension( const char *path );
642HWND OpenFileWithExtension( const std::string &filePath );
643BOOL SaveDocument(HWND hChild,char *SaveFileName);
644BOOL ShortPathToLongPath(char ShortPath[MAX_PATH],char *LongPath);
645bool IsExistFile( const char *FilePath );
646bool IsExistDirectory( const char *DirPath );
647
648//rebar.cpp
649#define MAX_BAND 255
650typedef HWND (*AddBandProc)(HWND hRebar,int num,char *lpszText);
651class CDBRebarBand{
652 int BandId[MAX_BAND];
653 AddBandProc pAddProc[MAX_BAND];
654 int iMaxBandNum;
655public:
656 HWND hRebar;
657 CDBRebarBand();
658 ~CDBRebarBand();
659 void add(int band_id,AddBandProc add_proc);
660 HWND call_add(int band_id,int num,char *lpszText);
661};
662class CMainRebar{
663 CDBRebarBand *pobj_DBRebarBand;
664
665 void SetupRebar(HWND hwnd);
666public:
667 HWND hParent;
668 HWND hRebar;
669
670 CMainRebar(HWND hwnd_parent);
671 ~CMainRebar();
672
673 void ResetInitRebar();
674 void ResetRebar();
675 void SaveRebarState(void);
676 void ChangeRebarBand(int BandID);
677 void menu_popup(HWND hwnd,int PosX,int PosY);
678};
679extern CMainRebar *pobj_Rebar;
680void ResetRebarData(void);
681LRESULT CALLBACK DefaultToolbarProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
682LRESULT CALLBACK DocComboProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
683LRESULT CALLBACK DebuggerToolbarProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
684
685//SubOperation.cpp
686void ScreenToClient(HWND hwnd,RECT *pRect);
687void ClientToScreen(HWND hwnd,RECT *pRect);
688BOOL IsWow64(void);
689void URLEncode(LPSTR pszSrc);
690void Digit(int num,char *buffer);
691void RectNaturalFormat(RECT *ReadRect,RECT *CopyRect);
692void RectNaturalFormat(int *x1,int *y1,int *x2,int *y2);
693void KillSpaces(char *str1,char *str2);
694void RemoveStringQuotes(char *str);
695void SlideString(char *str,int slide);
696void SlideBuffer(char *buffer,int length,int slide);
697BOOL IsVariableTopChar(char c);
698BOOL IsVariableChar(char c);
699BOOL IsCommandBackDelimitation(char *buffer,int pos);
700BOOL IsCommandDelimitation(char *buffer,int p);
701char *ComparisonString( char *str1, char *str2, bool isBigSmall, bool isWordUnit );
702int GetOneParameter(char *Parameter,int pos,char *retAns);
703int GetStringInPare(char *buffer,char *ReadBuffer);
704int GetStringInBracket(char *buffer,char *ReadBuffer);
705void JumpBlank(char *pBuf,int *piPos);
706BOOL CheckParenthesis(char *buffer);
707DWORD GetValue(char *value);
708BOOL IsManagementCommand(int ComNum);
709int IsBasicReservedWord(char *str);
710HBITMAP CreateGradationBitmap(SIZE *pSize,COLORREF color1,COLORREF color2);
711HBITMAP CreateVertGradationBitmap(SIZE *pSize,COLORREF color1,COLORREF color2);
712HBITMAP CreateHorzGradationBitmap(SIZE *pSize,COLORREF color1,COLORREF color2);
713HICON CreateGrayIcon(HICON hBaseIcon);
714void GetSize(SIZE *pSize,RECT *pRect);
715BOOL HitTest(RECT *pRect,POINT *pPos);
716BOOL Rectangle(HDC hdc,RECT *pRect);
717void ComboBox_SetSelText(HWND hCombo,char *lpszText);
718void SetCursorByState(int state);
719void SetTextEditColorDesign(TEXTEDIT_COLOR_INFO *pColorInfo,CTheme *pobj_Theme,BOOL bRedraw);
720BOOL SetupProjectEditor(void);
721void EndProjectEditor(void);
722BOOL SetRunning(HWND hChild);
723BOOL IsNeedCompile( const std::string &filepath, BOOL bDebug );
724std::string GetLastErrorString();
725
726//DocumentAdvice.cpp
727void MenuAdvice(WPARAM msg);
728void ShowToolTipText(LPTOOLTIPTEXT TipText);
729char *IncludeFiles(char *buffer);
730void AddParameterHints_ToProject(char *path);
731
732
733
734/////////////////////
735// テキスト エディタ
736/////////////////////
737
738#define CONTROL_TAB_SPACE_DEFAULT 10 //エディタ画面左端のコントロールタブ(通常)
739
740//DrawBuffer.cpp
741void TextEdit_DrawBuffer(HDC hdc,int WndNum);
742
743//TextEditor.cpp
744int GetControlTabSpace(int WndNum,int *piCount=0);
745void ResetTextEditFont(HWND hwnd);
746void SetTextEditWordColor(int WndNum);
747BOOL IsHiragana(char *pBuf);
748BOOL IsAlphabet(char c);
749BOOL IsReturnCode(char *pBuf);
750void ResetScrollbar(int WndNum,int max_x,int max_y);
751#define WORDCARET_BEFORE 1
752#define WORDCARET_AFTER 2
753void TextEdit_GetWordCaret(HWND hwnd,int WndNum,POINT *pPos,int *piStart,int *piEnd,BOOL bBeforeAfterFlag);
754void CancelBeforeAutoIndent(int WndNum);
755LRESULT CALLBACK TextEditProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
756
757//Caret.cpp
758BOOL IsRightTurn(char *pBuf,int i,int now_x);
759int GetBufferIndexFromCaretPos(char *pBuf,int now_x,int now_y);
760void GetCaretPosFromBufferIndex(char *pBuf,int index,POINT *pCaretPos);
761void TextEdit_GetSel(int WndNum,CHARRANGE *pCharRange);
762void TextEdit_GetSelText(int WndNum,CHARRANGE *pCharRange,char *buffer);
763void GetScrollBaseCaretPos(int WndNum,int *pNaturalBaseX,int *pNaturalBaseY);
764void GetNaturalBaseCaretPos(int WndNum,int *pScrollBaseX,int *pScrollBaseY);
765void TextEdit_SetSel(int WndNum,int StartIndex,int EndIndex,BOOL bShowCenter=0);
766void TextEdit_SelectOneLine(int WndNum,int code_pos,BOOL bShowCenter=0);
767void ResetCaretPos(int WndNum,BOOL bInputAndReset=0);
768BOOL TextEdit_ScrollCaret(int WndNum,BOOL bScrollOneStep_x,BOOL bShowCenter=0);
769void CaretPos_LooseToNatural(int WndNum,int loose_x,int loose_y,POINT *pCaretPos);
770void GetNaturalCaretPos_Click(int WndNum,int mouse_x,int mouse_y,POINT *pCaretPos);
771void GetNaturalCaretPos_Left(int WndNum);
772void GetNaturalCaretPos_Right(int WndNum,POINT *pCaretPos);
773void GetNaturalCaretPos_Up(int WndNum,POINT *pCaretPos);
774void GetNaturalCaretPos_Down(int WndNum,POINT *pCaretPos);
775void GetNaturalCaretPos_PageUp(int WndNum,POINT *pCaretPos);
776void GetNaturalCaretPos_PageDown(int WndNum,POINT *pCaretPos);
777
778//Replace.cpp
779void TextEdit_Replace(int WndNum,char *str,BOOL bRedraw);
780void TextEdit_ReplaceUpdateUndoData(int WndNum,char *str,BOOL bPaste,BOOL bRedraw);
781void TextEdit_Convert(int id);
782
783//TextEditor_UndoRedo.cpp
784void TextEdit_UndoCommand(int WndNum);
785void TextEdit_RedoCommand(int WndNum);
786void TextEdit_NoticeChanging(int WndNum,int Command,char *KeyStr,char *DelStr,CHARRANGE *Range,CHARRANGE *DelRange);
787void TextEdit_DeleteUndoData(TEXTEDIT_UNDOSTATE *pUndoState,int pos);
788
789//Search.cpp
790void AddFindData(HWND hwnd,char ppData[MAX_FINDLIST][MAX_PATH],char *str);
791BOOL CALLBACK DlgFind(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
792BOOL CALLBACK DlgPermutation(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
793
794//analysis.cpp
795BOOL GetVarFormatString(char *buffer,char *array,char *array2,char *NestMember,int *pRefType);
796BOOL CheckReferType(char *ClassName,BOOL bArray,char *VarArray,int VarRefType);
797void GetOriginalClassName(char *ClassName);
798int GetClassPos(char *pBuf,char *ClassName,DWORD *pdwClassType);
799BOOL GetClassNameFromClassMember(char *pBuf,int iPos,char *VarName,char *ClassName,BOOL *pbArray);
800void GetCodeAreaType(char *pBuf,int iPos,int *piProcPos,char *NowClass);
801BOOL GetVariableClassName(char *pEditBuf,int iPos,char *VarName,char *ClassName,BOOL *pbArray);
802
803//EndPairCommandComplement.cpp
804BOOL GetEndPairCommandInfo(char *buffer,int p);
805BOOL IsNeedNewIndentCommand(char *name);
806void GetWithObjectVariable(char *buffer,int p,char *pObjectVar);
807
808//Complement.cpp
809void DeleteComplementInfo(void);
810BOOL GetComplementInfo(char *variable,char *pEditBuf,int iPos);
811void CodeComplement(int WndNum,int iPos);
812LRESULT CALLBACK ComplementWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
813
814//ParameterHint.cpp
815char *GetUserSourceCode(void);
816void ChangeReturnCode(char *buffer);
817void DeleteComment(char *buffer);
818LRESULT CALLBACK MethodCheckWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
819void ShowParameterHint(int WndNum);
820
821//CodeFormatter.cpp
822char *CodeFormatter(char *lpszReadBuffer);
823
824#ifdef THETEXT
825//StringCount.cpp
826BOOL CALLBACK DlgStringCount(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
827#endif
828
829//Print.cpp
830class CPage{
831public:
832 PAGESETUPDLG psd;
833 CPage();
834 ~CPage();
835
836 BOOL SetupDlg(void);
837};
838extern CPage obj_Page;
839LRESULT CALLBACK PreviewWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
840void Preview(void);
841void Printout(void);
842
843//History.cpp
844#define IS_FILEHISTORY_COMMAND(a) (100<=a&&a<=199)
845class CHistory{
846 int iNum;
847 int iMaxHistoryNum;
848
849 int m_BaseID;
850public:
851 char *lpszPath[255];
852
853 CHistory(int BaseID);
854 ~CHistory();
855
856 void load(char *path);
857 void save(char *path);
858
859 void add(char *path);
860 void insert(const char *path);
861
862 void ResetFileMenu(CSubMenuEx *pobj_SubMenu,BOOL bOwnerDraw);
863};
864
865
866
867
868//////////////////////
869/* プロジェクト解析 */
870
871//CClassInfo.cpp
872class CClassInfo{
873public:
874 char ClassName[VN_SIZE];
875 MEMBERINFO *pMemberInfo;
876 int MemberNum;
877 CClassInfo();
878 ~CClassInfo();
879 int Analyze(char *pBuf,int *p);
880};
881
882//ClassTree.cpp
883struct TREEHASH{
884 HTREEITEM hItem;
885 int iFileNum;
886 TREEHASH *pNextData;
887};
888#define CTV_ROOT 1 //ルート
889#define CTV_FOLDER 2 //フォルダ
890#define CTV_GLOBAL_PROC 3 //プロシージャ
891#define CTV_CLASS 4 //クラス
892#define CTV_PUBLIC_MEMBER 5 //公開cメンバ変数
893#define CTV_PUBLIC_METHOD 6 //公開メソッド
894#define CTV_PRIVATE_MEMBER 7 //非公開メンバ変数
895#define CTV_PRIVATE_METHOD 8 //非公開メソッド
896class CClassTreeView{
897 HWND hTreeWnd;
898 int iNowFile;
899 TREEHASH tree_data[MAX_HASH];
900
901 HTREEITEM hGlobalProcedureFolder;
902 HTREEITEM hNowClassFolder;
903
904 int hash_default(LONG_PTR lpdata);
905
906 void AddValidItem(HTREEITEM hItem,int iFileNum);
907 BOOL delete_check(HTREEITEM hItem);
908 void DeleteInvalidItems(HTREEITEM hItem);
909 void DeleteTreeHash(TREEHASH *pth);
910
911 HTREEITEM insert(HTREEITEM hParentItem,int flag,char *lpszName,int iFileNum);
912
913public:
914 HTREEITEM hRootFolder;
915
916 int NumberOfProcedures;
917 PROCINFO *pProcInfo;
918
919 BOOL bCloseSwitch;
920 BOOL bShowSwitch;
921
922 CClassTreeView();
923 ~CClassTreeView();
924 void init(HWND hwnd,int iFileNum);
925
926 void InsertRootFolder(void);
927 void InsertGlobalProcedureFolder(void);
928 HTREEITEM InsertGlobalProcedure(int flag,char *lpszName,int iFileNum);
929 HTREEITEM insert_code_item(HTREEITEM hParentItem,int flag,char *lpszName,int iFileNum,char *pBuf,int p);
930 void InsertClassFolder(char *lpszName,int iFileNum,char *pBuf,int p);
931 void InsertClassMember(int flag,char *lpszName,int iFileNum,char *pBuf,int p);
932 void finish();
933};
934extern CClassTreeView *pobj_ClassTreeView;
935void ResetClassTree(int iFileNum);
936
937//ProjectControl.cpp
938void ResizeProjectView_ToolWindow(void);
939LRESULT CALLBACK ProjectView_ToolWindowProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
940void ShowFileView();
941void ShowClassView();
942void ShowMaterialView();
943LRESULT CALLBACK ProjectViewProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
944void Project_File_Insert(char *path);
945void Project_File_Delete(HTREEITEM hTreeItem);
946void MakeNewProject(void);
947BOOL ProjectModifyCheck(BOOL bRun);
948void MakeWorkFile(void);
949void SaveProject(void);
950BOOL SetProjectToRun(void);
951BOOL IsNeedCompileForProject(BOOL bDebug);
952
953//WindowControl.cpp
954int GetWndInfoNum( const std::string &name );
955ActiveBasic::PM::WindowInfo *GetWndInfo( const std::string &name );
956HGLOBAL Rad_GetChildInfoClipboardData(int WndNum,int WndInfoNum);
957void Rad_PasteChildInfoClipboardData(int WndNum,HGLOBAL hGlobal);
958char *PermutationWndPgmTemplate(char *pBuf,const char *pPjName, char *pWndName, char *pHandleName, char *pProcName);
959const std::string PermutationWndPgmTemplate( const std::string &templateFilePath, const std::string &projectName, std::string &windowName, std::string &handleName, std::string &procName );
960void GetItemClassName(char *buffer,int Control);
961void SaveWindowProgram();
962void SaveWindowFile( char *path, const ActiveBasic::PM::WindowInfos &windowInfos );
963_int8 OpenWindowFile(char *path);
964void GetDefaultWindowFont(LOGFONT *LogFont);
965void Project_Window_Insert(void);
966void Project_Window_Delete(int WndInfoNum);
967
968//Resource.cpp
969void Project_CursorResInsert(void);
970void Project_Cursor_Delete(int CursorInfoNum);
971void Project_Cursor_RenameID(int CursorInfoNum);
972void Project_BitmapResInsert(void);
973void Project_Bitmap_Delete(int IconInfoNum);
974void Project_Bitmap_RenameID(int BitmapInfoNum);
975void Project_IconResInsert(void);
976void Project_Icon_Delete(int IconInfoNum);
977void Project_Icon_RenameID(int IconInfoNum);
978BOOL CALLBACK DlgProject_ResourceID_Input(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
979
980
981
982///////////////////
983/* RADウィンドウ */
984
985//RadProc.cpp
986void NewRadWindow( const ActiveBasic::PM::WindowInfo &windowInfo );
987int InsertDlgItem(int WndNum,int WndInfoNum,int ItemNum,POINT *pPos,SIZE *pSize,const char *IdName,const char *caption,DWORD style_or_WndNum,DWORD ExStyle,int Control,ActiveBasic::PM::ImageReferenceType::EnumType ImageType,const char *ImagePath,DWORD dwInsertType);
988void DeleteDlgItem(int WndNum,int WndInfoNum,int ItemNum,BOOL bNoticeChanging);
989void CursorPos_GlobalToLocal(HWND hwnd,long *x,long *y);
990void DrawSelectingRect(HWND hwnd,int WndNum,int WndInfoNum,int ButtonSelect);
991void ChangePropertyWindow(int WndNum,int WndInfoNum);
992void ResetScrollbarOfRadEditor(int WndNum,int weight,int height);
993LRESULT CALLBACK RadWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
994void ResizeToRadToolWindows(int WndNum,int weight,int height);
995LRESULT CALLBACK MDIClientWindow_Rad(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
996
997//DrawWindow.cpp
998void DrawRadWindow(int WndNum,const ActiveBasic::PM::WindowInfo *pWindowInfo);
999
1000//Rad_UndoRedo.cpp
1001void Rad_UndoCommand(int WndNum);
1002void Rad_RedoCommand(int WndNum);
1003void Rad_DeleteUndoData(int WndNum,int pos);
1004void Rad_NoticeChanging(int WndNum,int Command,int SelectItemNum,DWORD dwData);
1005
1006//RadToolsAndPropertyProc.cpp
1007LRESULT CALLBACK RadToolsWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1008BOOL CALLBACK RadProperty_WindowProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1009BOOL CALLBACK DlgRadProperty_Item_RenameCaption(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1010BOOL CALLBACK RadProperty_ButtonProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1011BOOL CALLBACK RadProperty_CheckBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1012BOOL CALLBACK RadProperty_ComboBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1013BOOL CALLBACK RadProperty_EditProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1014BOOL CALLBACK RadProperty_GroupBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1015BOOL CALLBACK RadProperty_ImageBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1016BOOL CALLBACK RadProperty_ListBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1017BOOL CALLBACK RadProperty_ListViewProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1018BOOL CALLBACK RadProperty_ProgressBarProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1019BOOL CALLBACK RadProperty_RadioButtonProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1020BOOL CALLBACK RadProperty_ScrollBarProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1021BOOL CALLBACK RadProperty_StaticProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1022BOOL CALLBACK RadProperty_TrackBarProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1023BOOL CALLBACK RadProperty_TreeViewProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1024BOOL CALLBACK RadProperty_UpDownProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1025LRESULT CALLBACK RadPropertyWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1026
1027//MessageCallOperation.cpp
1028char **GetProcedureNamesOfMessageCall(int WndInfoNum,ITEMEVENTINFO **ppItemEventInfo,int *num,BOOL *pbAlways);
1029void SelectProcedureOfMessageCall(int WndInfoNum,char *ProcedureName,char *Parameter);
1030BOOL CALLBACK DlgEventCode(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1031
1032//RadSupport.cpp
1033LRESULT CALLBACK TestWindowProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1034void SetSupportDlgData(int WndNum, const ActiveBasic::PM::WindowInfo &windowInfo );
1035BOOL CALLBACK DlgRadSupport(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1036
1037
1038
1039////////////////////
1040/* MENUウィンドウ */
1041
1042//MenuProc.cpp
1043int GetMenuInfoNum(const std::string &name);
1044void HeapMenuDataFree(MENU_INFO *pMenuInfo,int ItemNum,int *NumberOfFreedItem);
1045BOOL CALLBACK DlgProject_MenuID_Input(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1046void Project_Menu_Insert(void);
1047void Project_Menu_Delete(int MenuInfoNum);
1048void NewMenuWindow(MENU_INFO *pMenuInfo);
1049BOOL CALLBACK MenuEditDlg(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1050LRESULT CALLBACK MenuEditWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1051LRESULT CALLBACK MDIClientWindow_Menu(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1052
1053
1054
1055//////////////////////////////////
1056/* アイコン エディタ ウィンドウ */
1057
1058//IconEditor.cpp
1059void AddIconType(int WndNum,int IconType);
1060void DeleteIconType(int WndNum);
1061void NewIconEditWindow(const char *filepath);
1062void SaveIconFile(char *filepath,HWND hwnd);
1063LRESULT CALLBACK MDIClientWindow_IconEdit(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1064
1065//IconEditor_Main.cpp
1066HGLOBAL IconEdit_GetChildInfoClipboardData(int WndNum);
1067void IconEdit_PasteChildInfoClipboardData(int WndNum,HBITMAP hBmp);
1068void IconEdit_PasteImage(int WndNum);
1069void DrawIconToMemBmp(int WndNum,RECT *pRect);
1070void IconEdit_EraseRect(int WndNum,RECT *pRect);
1071LRESULT CALLBACK IconEditWindowProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1072
1073//IconEditor_Tool.cpp
1074BOOL CALLBACK DlgIconButtons(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1075BOOL CALLBACK DlgIconToolProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1076
1077//IconEditor_Color.cpp
1078BOOL CALLBACK DlgIconColorProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1079
1080//IconEditor_UndoRedo.cpp
1081void IconEdit_UndoCommand(int WndNum);
1082void IconEdit_RedoCommand(int WndNum);
1083void IconEdit_NoticeChanging(int WndNum);
1084
1085
1086
1087
1088
1089#include "NonVolatile.h"
1090
1091
1092
1093
1094#ifdef _DEBUG
1095/*Debug*/
1096
1097#define HeapAlloc CheckHeapAlloc
1098#define HeapReAlloc CheckHeapReAlloc
1099LPVOID CheckHeapAlloc(HANDLE hHeap,DWORD dwFlags,DWORD dwBytes);
1100LPVOID CheckHeapReAlloc(HANDLE hHeap,DWORD dwFlags,LPVOID lpMem,DWORD dwBytes);
1101
1102#define DeleteObject CheckDeleteObject
1103BOOL CheckDeleteObject(HGDIOBJ hObject);
1104
1105#endif
Note: See TracBrowser for help on using the repository browser.