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

Last change on this file since 717 was 717, checked in by dai, 16 years ago

#188への対応。UserSettingディレクトリを廃止し、正規のユーザ空間ディレクトリを取り入れた。

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.0.0.5"
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 FILEIDENTITY{
348 DWORD VolumeSerialNumber;
349 DWORD FileIndexHigh;
350 DWORD FileIndexLow;
351};
352
353inline bool IsFileIdentityValid(FILEIDENTITY const& fi){
354 return fi.VolumeSerialNumber != 0
355 && fi.FileIndexHigh != 0
356 && fi.FileIndexLow != 0;
357}
358
359inline bool operator ==(FILEIDENTITY const& lhs, FILEIDENTITY const& rhs)
360{
361 return lhs.VolumeSerialNumber == rhs.VolumeSerialNumber
362 && lhs.FileIndexHigh == rhs.FileIndexHigh
363 && lhs.FileIndexLow == rhs.FileIndexLow;
364}
365
366struct MDIINFO{
367 HWND hwnd;
368 int DocType;
369 std::string title;
370 std::string path;
371 FILEIDENTITY FileIdentity;
372
373 union{
374 MDIRADINFO *MdiRadInfo;
375 MDIMENUINFO *MdiMenuInfo;
376 MDIICONEDITINFO *MdiIconEditInfo;
377 CMdiTextEdit *pMdiTextEdit;
378 };
379
380 char *IndentStr;
381};
382extern std::vector<MDIINFO *> MdiInfo;
383
384//RADツールのマウスドラッグ
385#define FRAME_CHANGEPOS_START 1 //----- ここから -----
386#define FRAME_UPPER_LEFT 1
387#define FRAME_UPPER_RIGHT 2
388#define FRAME_LOWER_LEFT 3
389#define FRAME_LOWER_RIGHT 4
390#define FRAME_LEFT 5
391#define FRAME_RIGHT 6
392#define FRAME_UPPER 7
393#define FRAME_LOWER 8
394#define FRAME_INSIDE 9
395#define FRAME_CHANGEPOS_END 9 //----- ここまで -----
396#define ITEM_MAKING 10
397#define SELECTING_FRAME 11
398
399//アイテムの大きさの限界値
400#define MIN_ITEM_X 12
401#define MIN_ITEM_Y 9
402
403//選択アイテム
404#define SELECT_WINDOW -1
405#define NON_TOOL -1
406
407struct RADINFO{
408 int NowDragging;
409 POINT DragStartPos;
410 RECT DragStartRect[MAX_RAD_SELITEM];
411 RECT DraggingRect[MAX_RAD_SELITEM];
412 RECT OldDraggingRect[MAX_RAD_SELITEM];
413};
414
415
416//////////////////
417//リソース情報
418extern HTREEITEM hCursorTreeItemForProjectView;
419extern HTREEITEM hBitmapTreeItemForProjectView;
420extern HTREEITEM hIconTreeItemForProjectView;
421
422
423////////////////////
424//プロジェクト情報
425
426#define PROJECT_VERSION 10
427
428struct PROCINFO{
429 char *name;
430 HTREEITEM hTreeItem;
431
432 HTREEITEM hFileTreeItem;
433
434 int code_pos;
435};
436struct INCPROCINFO{
437 char *name;
438 char *Parms;
439 char *type;
440};
441
442//ダイアログアイテムの種類
443#define CT_BUTTON 1
444#define CT_CHECKBOX 2
445#define CT_COMBOBOX 3
446#define CT_EDIT 4
447#define CT_GROUPBOX 5
448#define CT_HSCROLLBAR 6
449#define CT_IMAGEBOX 7
450#define CT_LISTBOX 8
451#define CT_LISTVIEW 9
452#define CT_RADIOBUTTON 10
453#define CT_STATIC 11
454#define CT_TREEVIEW 12
455#define CT_VSCROLLBAR 13
456#define CT_UPDOWN 14
457#define CT_PROGRESSBAR 15
458#define CT_TRACKBAR 16
459#define CT_MENU 99
460
461//イベント タイプ
462#define EVENTTYPE_DEFAULT 0
463#define EVENTTYPE_MENU 1
464#define EVENTTYPE_MMSYS 2
465
466
467struct NEWPROJECTINFO{
468 char name[MAX_PATH];
469 DWORD dwTypeID;
470 _int8 ShowHelloWorld;
471 DWORD dwOption;
472};
473struct MENU_INFO{
474 char *IdName;
475 char *caption;
476 UINT type;
477 UINT state;
478
479 int NumberOfMenu;
480 MENU_INFO *pMenuInfo;
481
482 HTREEITEM hTreeItem;
483};
484#define MT_EXE 0 //EXEモジュールタイプ
485#define MT_DLL 1 //DLLモジュールタイプ
486#define MT_SLL 2 //SLLモジュールタイプ
487#define PJ_OP_SOURCE_MASK 0x00FFFFFF
488#define PJ_OP_MMSYSTEM 0x00000001
489#define PJ_OP_COMMCTRL 0x00000002
490#define PJ_OP_RICHEDIT 0x00000004
491#define PJ_OP_WINSOCK 0x00000008
492#define PJ_OP_STRICT 0x00010000 // #strictディレクティブは今は使われていない
493#define PJ_OP_RC_MANIFEST 0x00020000
494#define PJ_OP_UNICODE 0x00040000
495
496
497
498struct SAVEREBAR{
499 int RebarID;
500 int RebarLength;
501 int IsBandBreak;
502};
503
504struct ITEMEVENTINFO{
505 char *IdName;
506 char **pEventNames;
507 int ClassID;
508 int EventNum;
509};
510
511#define PARAMETER_HINT_MAX_SIZE 8192
512struct METHODCHECKINFO{
513 HWND hWnd;
514 LOGFONT LogFont;
515 HFONT hFont;
516 HFONT hBoldFont;
517 char BeforeMethodName[VN_SIZE];
518 char msg[PARAMETER_HINT_MAX_SIZE];
519 int ParmNum;
520 int HeadPos;
521};
522
523
524/////////////////////
525// コード補完機能
526/////////////////////
527
528#define ACCESS_NON 0
529#define ACCESS_PRIVATE 1
530#define ACCESS_PUBLIC 2
531#define ACCESS_PROTECTED 3
532#define ACCESS_PAIRCOMMAND 4
533#define ACCESS_HTML_GENERAL_PARAM 5
534#define ACCESS_HTML_PARAM 6
535struct MEMBERINFO{
536 //クラス名
537 char *pName;
538 DWORD dwProc;
539 DWORD dwAccess;
540
541 int code_pos;
542};
543struct COMPLEMENT_WINDOW_INFO{
544 HWND hWnd;
545 HWND hList;
546
547 int iPos;
548 int iLength;
549
550 MEMBERINFO *pMemberInfo;
551 int MemberNum;
552
553 //ペアステートメントのインデント格納用
554 char szIndent[255];
555};
556
557
558
559class CSettingFile{
560 BOOL GetDataLine(const char *name,char *parms);
561protected:
562 char *buffer;
563
564 BOOL GetWholeValue(const char *name,int *pi32data);
565 bool GetBoolean( const char *name,bool &b );
566 BOOL Get3WholeValue(char *name,int *pd1,int *pd2,int *pd3);
567 BOOL GetRGBValue(char *name,COLORREF *prgb);
568 BOOL GetStringValue(char *name,char *str);
569 BOOL GetRectValue(char *name,RECT *prc);
570 BOOL GetLogFont(char *name,LOGFONT *plf);
571 BOOL GetRebarBand(SAVEREBAR *psr,int num);
572
573 void SetWholeValue( const char *name,long i32data);
574 void SetBoolean( const char *name,bool b);
575 void Set3WholeValue(char *name,long d1,long d2,long d3);
576 void SetRGBValue(char *name,COLORREF rgb);
577 void SetStringValue(char *name,char *str);
578 void SetRectValue(char *name,RECT *prc);
579 void SetLogFont(char *name,LOGFONT *plf);
580 void SetRebarBand(SAVEREBAR *psr,int num);
581};
582#include "DesignTheme.h"
583
584
585
586//ProjectEditor.cpp
587void HeapDefaultFree(LPVOID lpMem);
588void ToBigChar(char str[]);
589int GetWndNum(HWND hChild);
590int GetNowWndNum(void);
591void SendTextEditResizeEvent(HWND hwnd);
592void RedrawAllWindow(void);
593int DocumentModifyCheck(HWND hChild);
594void SetStatusText(char *MenuText);
595void ResetState_UndoMenu(void);
596void ResetState_EditMenu(void);
597void ResetState_DocMenu(void);
598void DuplicateTitleCheck(char *lpszTitle);
599HWND NewTextEditWindow(char const *filepath,_int8 DocumentType,COLORREF TabColor=TABCOLOR_GRAY);
600void CloseDocWindow(int WndNum);
601void ResizeTextEditWnd(HWND hwnd,int cx,int cy);
602#define FLAG_DBLCLK 1
603#define FLAG_BEAMCURSOR 2
604int RegWndClass(WNDPROC WndProc,char *lpClassName,HBRUSH hBackBrush,DWORD dwFlag);
605
606//Backup.cpp
607void CreateBackupDir(void);
608void backup(void *dummy);
609BOOL restore(void);
610
611//DialogBoxes.cpp
612void SetPosCenter(HWND hParent,HWND hwnd);
613void SetPosCenter(HWND hwnd);
614BOOL SetFontDialog(HWND hwnd,LOGFONT *lf,BOOL bFixedPitchOnly,int *lpiPointSize=0);
615void DlgNewProjectWizard(HWND hwnd);
616BOOL CALLBACK DlgNewFile(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
617void DlgProjectOptionSetting(HWND hwnd);
618void DlgOptionSetting(HWND hwnd);
619BOOL CALLBACK DialogAbout(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
620
621//FileOperation.cpp
622char *ReadBuffer( const std::string &path );
623char *ReadBuffer_NonErrMsg( const std::string &path );
624_int8 WriteBuffer(const std::string &path,const char *buffer,int length, bool isEnableError = true);
625_int8 WriteBuffer_NonErrMsg(const std::string &path,char *buffer,int length);
626void GetRelationalPath(char *path,char *dir);
627void GetFullPath(char *path,const char *dir);
628void RemoveDirectoryStrong(const char *dirPath);
629BOOL GetFilePathDialog(HWND hwnd,char *filename,LPSTR Filter,LPSTR Title,_int8 IsOpen);
630BOOL GetFolder(HWND hWnd,char *folder,char *OpenFolderTitle);
631int GetFileExtension( const char *path );
632HWND OpenFileWithExtension( const std::string &filePath );
633BOOL SaveDocument(HWND hChild,char *SaveFileName);
634BOOL ShortPathToLongPath(char ShortPath[MAX_PATH],char *LongPath);
635bool IsExistFile( const char *FilePath );
636bool IsExistDirectory( const char *DirPath );
637
638//rebar.cpp
639#define MAX_BAND 255
640typedef HWND (*AddBandProc)(HWND hRebar,int num,char *lpszText);
641class CDBRebarBand{
642 int BandId[MAX_BAND];
643 AddBandProc pAddProc[MAX_BAND];
644 int iMaxBandNum;
645public:
646 HWND hRebar;
647 CDBRebarBand();
648 ~CDBRebarBand();
649 void add(int band_id,AddBandProc add_proc);
650 HWND call_add(int band_id,int num,char *lpszText);
651};
652class CMainRebar{
653 CDBRebarBand *pobj_DBRebarBand;
654
655 void SetupRebar(HWND hwnd);
656public:
657 HWND hParent;
658 HWND hRebar;
659
660 CMainRebar(HWND hwnd_parent);
661 ~CMainRebar();
662
663 void ResetInitRebar();
664 void ResetRebar();
665 void SaveRebarState(void);
666 void ChangeRebarBand(int BandID);
667 void menu_popup(HWND hwnd,int PosX,int PosY);
668};
669extern CMainRebar *pobj_Rebar;
670void ResetRebarData(void);
671LRESULT CALLBACK DefaultToolbarProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
672LRESULT CALLBACK DocComboProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
673LRESULT CALLBACK DebuggerToolbarProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
674
675//SubOperation.cpp
676void ScreenToClient(HWND hwnd,RECT *pRect);
677void ClientToScreen(HWND hwnd,RECT *pRect);
678BOOL IsWow64(void);
679void URLEncode(LPSTR pszSrc);
680void Digit(int num,char *buffer);
681void RectNaturalFormat(RECT *ReadRect,RECT *CopyRect);
682void RectNaturalFormat(int *x1,int *y1,int *x2,int *y2);
683void KillSpaces(char *str1,char *str2);
684void RemoveStringQuotes(char *str);
685void SlideString(char *str,int slide);
686void SlideBuffer(char *buffer,int length,int slide);
687BOOL IsVariableTopChar(char c);
688BOOL IsVariableChar(char c);
689BOOL IsCommandBackDelimitation(char *buffer,int pos);
690BOOL IsCommandDelimitation(char *buffer,int p);
691char *ComparisonString( char *str1, char *str2, bool isBigSmall, bool isWordUnit );
692int GetOneParameter(char *Parameter,int pos,char *retAns);
693int GetStringInPare(char *buffer,char *ReadBuffer);
694int GetStringInBracket(char *buffer,char *ReadBuffer);
695void JumpBlank(char *pBuf,int *piPos);
696BOOL CheckParenthesis(char *buffer);
697DWORD GetValue(char *value);
698HBITMAP CreateGradationBitmap(SIZE *pSize,COLORREF color1,COLORREF color2);
699HBITMAP CreateVertGradationBitmap(SIZE *pSize,COLORREF color1,COLORREF color2);
700HBITMAP CreateHorzGradationBitmap(SIZE *pSize,COLORREF color1,COLORREF color2);
701HICON CreateGrayIcon(HICON hBaseIcon);
702void GetSize(SIZE *pSize,RECT *pRect);
703BOOL HitTest(RECT *pRect,POINT *pPos);
704BOOL Rectangle(HDC hdc,RECT *pRect);
705void ComboBox_SetSelText(HWND hCombo,char *lpszText);
706void SetCursorByState(int state);
707void SetTextEditColorDesign(TEXTEDIT_COLOR_INFO *pColorInfo,CTheme *pobj_Theme,BOOL bRedraw);
708BOOL SetupProjectEditor(void);
709void EndProjectEditor(void);
710BOOL SetRunning(HWND hChild);
711BOOL IsNeedCompile( const std::string &filepath, BOOL bDebug );
712std::string GetLastErrorString();
713
714//DocumentAdvice.cpp
715void MenuAdvice(WPARAM msg);
716void ShowToolTipText(LPTOOLTIPTEXT TipText);
717char *IncludeFiles(char *buffer);
718void AddParameterHints_ToProject(char *path);
719
720
721
722/////////////////////
723// テキスト エディタ
724/////////////////////
725
726#define CONTROL_TAB_SPACE_DEFAULT 10 //エディタ画面左端のコントロールタブ(通常)
727
728//DrawBuffer.cpp
729void TextEdit_DrawBuffer(HDC hdc,int WndNum);
730
731//TextEditor.cpp
732int GetControlTabSpace(int WndNum,int *piCount=0);
733void ResetTextEditFont(HWND hwnd);
734void SetTextEditWordColor(int WndNum);
735BOOL IsHiragana(char *pBuf);
736BOOL IsAlphabet(char c);
737BOOL IsReturnCode(char *pBuf);
738void ResetScrollbar(int WndNum,int max_x,int max_y);
739#define WORDCARET_BEFORE 1
740#define WORDCARET_AFTER 2
741void TextEdit_GetWordCaret(HWND hwnd,int WndNum,POINT *pPos,int *piStart,int *piEnd,BOOL bBeforeAfterFlag);
742void CancelBeforeAutoIndent(int WndNum);
743LRESULT CALLBACK TextEditProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
744
745//Caret.cpp
746BOOL IsRightTurn(char *pBuf,int i,int now_x);
747int GetBufferIndexFromCaretPos(char *pBuf,int now_x,int now_y);
748void GetCaretPosFromBufferIndex(char *pBuf,int index,POINT *pCaretPos);
749void TextEdit_GetSel(int WndNum,CHARRANGE *pCharRange);
750void TextEdit_GetSelText(int WndNum,CHARRANGE *pCharRange,char *buffer);
751void GetScrollBaseCaretPos(MDIINFO *pMdiInfo,int *pNaturalBaseX,int *pNaturalBaseY);
752void GetNaturalBaseCaretPos(int WndNum,int *pScrollBaseX,int *pScrollBaseY);
753void TextEdit_SetSel(int WndNum,int StartIndex,int EndIndex,BOOL bShowCenter=0);
754void TextEdit_SelectOneLine(int WndNum,int code_pos,BOOL bShowCenter=0);
755void ResetCaretPos(int WndNum,BOOL bInputAndReset=0);
756BOOL TextEdit_ScrollCaret(int WndNum,BOOL bScrollOneStep_x,BOOL bShowCenter=0);
757void CaretPos_LooseToNatural(int WndNum,int loose_x,int loose_y,POINT *pCaretPos);
758void GetNaturalCaretPos_Click(int WndNum,int mouse_x,int mouse_y,POINT *pCaretPos);
759void GetNaturalCaretPos_Left(int WndNum);
760void GetNaturalCaretPos_Right(int WndNum,POINT *pCaretPos);
761void GetNaturalCaretPos_Up(int WndNum,POINT *pCaretPos);
762void GetNaturalCaretPos_Down(int WndNum,POINT *pCaretPos);
763void GetNaturalCaretPos_PageUp(int WndNum,POINT *pCaretPos);
764void GetNaturalCaretPos_PageDown(int WndNum,POINT *pCaretPos);
765
766//Replace.cpp
767void TextEdit_Replace(int WndNum,char *str,BOOL bRedraw);
768void TextEdit_ReplaceUpdateUndoData(int WndNum,char *str,BOOL bPaste,BOOL bRedraw);
769void TextEdit_Convert(int id);
770
771//TextEditor_UndoRedo.cpp
772void TextEdit_UndoCommand(int WndNum);
773void TextEdit_RedoCommand(int WndNum);
774void TextEdit_NoticeChanging(int WndNum,int Command,char *KeyStr,char *DelStr,CHARRANGE *Range,CHARRANGE *DelRange);
775void TextEdit_DeleteUndoData(TEXTEDIT_UNDOSTATE *pUndoState,int pos);
776
777//Search.cpp
778void AddFindData(HWND hwnd,char ppData[MAX_FINDLIST][MAX_PATH],char *str);
779BOOL CALLBACK DlgFind(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
780BOOL CALLBACK DlgPermutation(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
781
782//analysis.cpp
783BOOL GetVarFormatString(char *buffer,char *array,char *array2,char *NestMember,int *pRefType);
784BOOL CheckReferType(char *ClassName,BOOL bArray,char *VarArray,int VarRefType);
785void GetOriginalClassName(char *ClassName);
786int GetClassPos(char *pBuf,char *ClassName,DWORD *pdwClassType);
787BOOL GetClassNameFromClassMember(char *pBuf,int iPos,char *VarName,char *ClassName,BOOL *pbArray);
788void GetCodeAreaType(char *pBuf,int iPos,int *piProcPos,char *NowClass);
789BOOL GetVariableClassName(char *pEditBuf,int iPos,char *VarName,char *ClassName,BOOL *pbArray);
790
791//EndPairCommandComplement.cpp
792BOOL GetEndPairCommandInfo(char *buffer,int p);
793BOOL IsNeedNewIndentCommand(char *name);
794void GetWithObjectVariable(char *buffer,int p,char *pObjectVar);
795
796//Complement.cpp
797void DeleteComplementInfo(void);
798BOOL GetComplementInfo(char *variable,char *pEditBuf,int iPos);
799void CodeComplement(int WndNum,int iPos);
800LRESULT CALLBACK ComplementWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
801
802//ParameterHint.cpp
803char *GetUserSourceCode(void);
804void ChangeReturnCode(char *buffer);
805void DeleteComment(char *buffer);
806LRESULT CALLBACK MethodCheckWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
807void ShowParameterHint(int WndNum);
808
809//CodeFormatter.cpp
810char *CodeFormatter(char *lpszReadBuffer);
811
812#ifdef THETEXT
813//StringCount.cpp
814BOOL CALLBACK DlgStringCount(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
815#endif
816
817//Print.cpp
818class CPage{
819public:
820 PAGESETUPDLG psd;
821 CPage();
822 ~CPage();
823
824 BOOL SetupDlg(void);
825};
826extern CPage obj_Page;
827LRESULT CALLBACK PreviewWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
828void Preview(void);
829void Printout(void);
830
831//History.cpp
832#define IS_FILEHISTORY_COMMAND(a) (100<=a&&a<=199)
833class CHistory{
834 int iNum;
835 int iMaxHistoryNum;
836
837 int m_BaseID;
838public:
839 char *lpszPath[255];
840
841 CHistory(int BaseID);
842 ~CHistory();
843
844 void load( const std::string &path );
845 void save( const std::string &path );
846
847 void add(char *path);
848 void insert(const char *path);
849
850 void ResetFileMenu(CSubMenuEx *pobj_SubMenu,BOOL bOwnerDraw);
851};
852
853
854
855
856//////////////////////
857/* プロジェクト解析 */
858
859//CClassInfo.cpp
860class CClassInfo{
861public:
862 char ClassName[VN_SIZE];
863 MEMBERINFO *pMemberInfo;
864 int MemberNum;
865 CClassInfo();
866 ~CClassInfo();
867 int Analyze(char *pBuf,int *p);
868};
869
870//ClassTree.cpp
871struct TREEHASH{
872 HTREEITEM hItem;
873 HTREEITEM hFileTreeItem;
874 TREEHASH *pNextData;
875};
876#define CTV_ROOT 1 //ルート
877#define CTV_FOLDER 2 //フォルダ
878#define CTV_GLOBAL_PROC 3 //プロシージャ
879#define CTV_CLASS 4 //クラス
880#define CTV_PUBLIC_MEMBER 5 //公開cメンバ変数
881#define CTV_PUBLIC_METHOD 6 //公開メソッド
882#define CTV_PRIVATE_MEMBER 7 //非公開メンバ変数
883#define CTV_PRIVATE_METHOD 8 //非公開メソッド
884class CClassTreeView{
885 HWND hTreeWnd;
886 HTREEITEM hNowFileTreeItem;
887 TREEHASH tree_data[MAX_HASH];
888
889 HTREEITEM hGlobalProcedureFolder;
890 HTREEITEM hNowClassFolder;
891
892 int hash_default(LONG_PTR lpdata);
893
894 void AddValidItem(HTREEITEM hItem,HTREEITEM hFileTreeItem);
895 BOOL delete_check(HTREEITEM hItem);
896 void DeleteInvalidItems(HTREEITEM hItem);
897 void DeleteTreeHash(TREEHASH *pth);
898
899 HTREEITEM insert(HTREEITEM hParentItem,int flag,char *lpszName,HTREEITEM hFileTreeItem);
900
901public:
902 HTREEITEM hRootFolder;
903
904 int NumberOfProcedures;
905 PROCINFO *pProcInfo;
906
907 BOOL bCloseSwitch;
908 BOOL bShowSwitch;
909
910 CClassTreeView();
911 ~CClassTreeView();
912 void init(HWND hwnd,HTREEITEM hFileTreeItem);
913
914 void InsertRootFolder(void);
915 void InsertGlobalProcedureFolder(void);
916 HTREEITEM InsertGlobalProcedure(int flag,char *lpszName,HTREEITEM hFileTreeItem);
917 HTREEITEM insert_code_item(HTREEITEM hParentItem,int flag,char *lpszName,HTREEITEM hFileTreeItem,char *pBuf,int p);
918 void InsertClassFolder(char *lpszName,HTREEITEM hFileTreeItem,char *pBuf,int p);
919 void InsertClassMember(int flag,char *lpszName,HTREEITEM hFileTreeItem,char *pBuf,int p);
920 void finish();
921};
922extern CClassTreeView *pobj_ClassTreeView;
923void ResetClassTree(HTREEITEM hFileTreeItem);
924
925//ProjectControl.cpp
926void ResizeProjectView_ToolWindow(void);
927LRESULT CALLBACK ProjectView_ToolWindowProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
928void ShowFileView();
929void ShowClassView();
930void ShowMaterialView();
931LRESULT CALLBACK ProjectViewProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
932void Project_File_Insert(char *path);
933void Project_File_Delete(HTREEITEM hTreeItem);
934void MakeNewProject(void);
935BOOL ProjectModifyCheck(BOOL bRun);
936void MakeWorkFile(void);
937void SaveProject(void);
938BOOL SetProjectToRun(void);
939BOOL IsNeedCompileForProject(BOOL bDebug);
940
941//WindowControl.cpp
942int GetWndInfoNum( const std::string &name );
943ActiveBasic::PM::WindowInfo *GetWndInfo( const std::string &name );
944HGLOBAL Rad_GetChildInfoClipboardData(int WndNum,int WndInfoNum);
945void Rad_PasteChildInfoClipboardData(int WndNum,HGLOBAL hGlobal);
946char *PermutationWndPgmTemplate(char *pBuf,const char *pPjName, char *pWndName, char *pHandleName, char *pProcName);
947const std::string PermutationWndPgmTemplate( const std::string &templateFilePath, const std::string &projectName, std::string &windowName, std::string &handleName, std::string &procName );
948void GetItemClassName(char *buffer,int Control);
949void SaveWindowProgram();
950void SaveWindowFile(char const *path, const ActiveBasic::PM::WindowInfos &windowInfos);
951_int8 OpenWindowFile(char *path);
952void GetDefaultWindowFont(LOGFONT *LogFont);
953void Project_Window_Insert(void);
954void Project_Window_Delete(int WndInfoNum);
955
956//Resource.cpp
957void Project_CursorResInsert(void);
958void Project_Cursor_Delete(int CursorInfoNum);
959void Project_Cursor_RenameID(int CursorInfoNum);
960void Project_BitmapResInsert(void);
961void Project_Bitmap_Delete(int IconInfoNum);
962void Project_Bitmap_RenameID(int BitmapInfoNum);
963void Project_IconResInsert(void);
964void Project_Icon_Delete(int IconInfoNum);
965void Project_Icon_RenameID(int IconInfoNum);
966BOOL CALLBACK DlgProject_ResourceID_Input(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
967
968
969
970///////////////////
971/* RADウィンドウ */
972
973//RadProc.cpp
974void NewRadWindow( const ActiveBasic::PM::WindowInfo &windowInfo );
975int 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);
976void DeleteDlgItem(int WndNum,int WndInfoNum,int ItemNum,BOOL bNoticeChanging);
977void CursorPos_GlobalToLocal(HWND hwnd,long *x,long *y);
978void DrawSelectingRect(HWND hwnd,int WndNum,int WndInfoNum,int ButtonSelect);
979void ChangePropertyWindow(int WndNum,int WndInfoNum);
980void ResetScrollbarOfRadEditor(int WndNum,int weight,int height);
981LRESULT CALLBACK RadWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
982void ResizeToRadToolWindows(int WndNum,int weight,int height);
983LRESULT CALLBACK MDIClientWindow_Rad(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
984
985//DrawWindow.cpp
986void DrawRadWindow(int WndNum,const ActiveBasic::PM::WindowInfo *pWindowInfo);
987
988//Rad_UndoRedo.cpp
989void Rad_UndoCommand(int WndNum);
990void Rad_RedoCommand(int WndNum);
991void Rad_DeleteUndoData(int WndNum,int pos);
992void Rad_NoticeChanging(int WndNum,int Command,int SelectItemNum,DWORD dwData);
993
994//RadToolsAndPropertyProc.cpp
995LRESULT CALLBACK RadToolsWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
996BOOL CALLBACK RadProperty_WindowProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
997BOOL CALLBACK DlgRadProperty_Item_RenameCaption(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
998BOOL CALLBACK RadProperty_ButtonProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
999BOOL CALLBACK RadProperty_CheckBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1000BOOL CALLBACK RadProperty_ComboBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1001BOOL CALLBACK RadProperty_EditProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1002BOOL CALLBACK RadProperty_GroupBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1003BOOL CALLBACK RadProperty_ImageBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1004BOOL CALLBACK RadProperty_ListBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1005BOOL CALLBACK RadProperty_ListViewProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1006BOOL CALLBACK RadProperty_ProgressBarProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1007BOOL CALLBACK RadProperty_RadioButtonProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1008BOOL CALLBACK RadProperty_ScrollBarProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1009BOOL CALLBACK RadProperty_StaticProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1010BOOL CALLBACK RadProperty_TrackBarProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1011BOOL CALLBACK RadProperty_TreeViewProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1012BOOL CALLBACK RadProperty_UpDownProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1013LRESULT CALLBACK RadPropertyWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1014
1015//MessageCallOperation.cpp
1016char **GetProcedureNamesOfMessageCall(int WndInfoNum,ITEMEVENTINFO **ppItemEventInfo,int *num,BOOL *pbAlways);
1017void SelectProcedureOfMessageCall(int WndInfoNum,char *ProcedureName,char *Parameter);
1018BOOL CALLBACK DlgEventCode(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1019
1020//RadSupport.cpp
1021LRESULT CALLBACK TestWindowProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1022void SetSupportDlgData(int WndNum, const ActiveBasic::PM::WindowInfo &windowInfo );
1023BOOL CALLBACK DlgRadSupport(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1024
1025
1026
1027////////////////////
1028/* MENUウィンドウ */
1029
1030//MenuProc.cpp
1031int GetMenuInfoNum(const std::string &name);
1032void HeapMenuDataFree(MENU_INFO *pMenuInfo,int ItemNum,int *NumberOfFreedItem);
1033BOOL CALLBACK DlgProject_MenuID_Input(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1034void Project_Menu_Insert(void);
1035void Project_Menu_Delete(int MenuInfoNum);
1036void NewMenuWindow(MENU_INFO *pMenuInfo);
1037BOOL CALLBACK MenuEditDlg(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1038LRESULT CALLBACK MenuEditWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1039LRESULT CALLBACK MDIClientWindow_Menu(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1040
1041
1042
1043//////////////////////////////////
1044/* アイコン エディタ ウィンドウ */
1045
1046//IconEditor.cpp
1047void AddIconType(int WndNum,int IconType);
1048void DeleteIconType(int WndNum);
1049void NewIconEditWindow(const char *filepath);
1050void SaveIconFile(char *filepath,HWND hwnd);
1051LRESULT CALLBACK MDIClientWindow_IconEdit(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1052
1053//IconEditor_Main.cpp
1054HGLOBAL IconEdit_GetChildInfoClipboardData(int WndNum);
1055void IconEdit_PasteChildInfoClipboardData(int WndNum,HBITMAP hBmp);
1056void IconEdit_PasteImage(int WndNum);
1057void DrawIconToMemBmp(int WndNum,RECT *pRect);
1058void IconEdit_EraseRect(int WndNum,RECT *pRect);
1059LRESULT CALLBACK IconEditWindowProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1060
1061//IconEditor_Tool.cpp
1062BOOL CALLBACK DlgIconButtons(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1063BOOL CALLBACK DlgIconToolProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1064
1065//IconEditor_Color.cpp
1066BOOL CALLBACK DlgIconColorProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
1067
1068//IconEditor_UndoRedo.cpp
1069void IconEdit_UndoCommand(int WndNum);
1070void IconEdit_RedoCommand(int WndNum);
1071void IconEdit_NoticeChanging(int WndNum);
1072
1073
1074
1075
1076
1077#include "NonVolatile.h"
1078
1079
1080
1081
1082#ifdef _DEBUG
1083/*Debug*/
1084
1085#define HeapAlloc CheckHeapAlloc
1086#define HeapReAlloc CheckHeapReAlloc
1087LPVOID CheckHeapAlloc(HANDLE hHeap,DWORD dwFlags,DWORD dwBytes);
1088LPVOID CheckHeapReAlloc(HANDLE hHeap,DWORD dwFlags,LPVOID lpMem,DWORD dwBytes);
1089
1090#define DeleteObject CheckDeleteObject
1091BOOL CheckDeleteObject(HGDIOBJ hObject);
1092
1093#endif
Note: See TracBrowser for help on using the repository browser.