source: dev/trunk/abdev/ProjectEditor/DocumentAdvice.cpp@ 391

Last change on this file since 391 was 367, checked in by dai_9181, 17 years ago

表記ユレを修正

File size: 11.5 KB
Line 
1#include "Common.h"
2
3void MenuAdvice(WPARAM msg){
4 /////////////////////////////////////////////////////
5 // コマンド解説(ステータスバーに表示されるテキスト)
6 /////////////////////////////////////////////////////
7 extern char CmdMsg[255];
8
9#if defined(JPN)
10 //日本語
11 if(LOWORD(msg)==IDM_NEW) SetStatusText("新規にプロジェクトまたはドキュメントを作成します");
12 else if(LOWORD(msg)==IDM_OPEN) SetStatusText("既存のドキュメントを開きます");
13 else if(LOWORD(msg)==IDM_CLOSE) SetStatusText("作業中のファイルを閉じます");
14 else if(LOWORD(msg)==IDM_SAVE) SetStatusText("作業中のファイルを保存します");
15 else if(LOWORD(msg)==IDM_NEWSAVE) SetStatusText("作業中のファイルを新しい名前を付けて保存します");
16 else if(LOWORD(msg)==IDM_ALLSAVE) SetStatusText("開いているファイルをすべて保存します");
17 else if(LOWORD(msg)==IDM_PROJECT_OPEN) SetStatusText("既存のプロジェクトを開きます");
18 else if(LOWORD(msg)==IDM_PROJECT_SAVE) SetStatusText("作業中のプロジェクトを保存します");
19 else if(LOWORD(msg)==IDM_PROJECT_CLOSE) SetStatusText("作業中のプロジェクトを閉じます");
20 else if(LOWORD(msg)==IDM_EXIT) SetStatusText("アプリケーションの終了と内容の保存確認をします");
21 else if(LOWORD(msg)==IDM_UNDO) SetStatusText("直前の操作を元にもどします");
22 else if(LOWORD(msg)==IDM_REDO) SetStatusText("前の未完了操作を繰り返します");
23 else if(LOWORD(msg)==IDM_CUT) SetStatusText("選択範囲を切り取り、クリップボードへコピーします");
24 else if(LOWORD(msg)==IDM_COPY) SetStatusText("選択範囲をクリップボードへコピーします");
25 else if(LOWORD(msg)==IDM_PASTE) SetStatusText("挿入位置にクリップボードの内容を挿入します");
26 else if(LOWORD(msg)==IDM_DELETE) SetStatusText("選択範囲を削除します");
27 else if(LOWORD(msg)==IDM_ALLSELECT) SetStatusText("ファイル全体を選択します");
28 else if(LOWORD(msg)==IDM_FIND) SetStatusText("作業中のドキュメント内を検索します");
29 else if(LOWORD(msg)==IDM_PERMUTATION) SetStatusText("指定した文字列を他の文字列で置換します");
30
31#ifdef THETEXT
32 else if(LOWORD(msg)==IDM_STRING_COUNT) SetStatusText("作業中ドキュメントの文字数をカウントします");
33#endif
34
35 else if(LOWORD(msg)==IDM_PROJECTVIEW) SetStatusText("プロジェクトビューの表示/非表示を切り替えます");
36 else if(LOWORD(msg)==IDM_PROJECT_OPTION) SetStatusText("プロジェクトオプションの設定を行います");
37 else if(LOWORD(msg)==IDM_TOPMOST) SetStatusText("エディタの最前面表示ON/OFFを切り替えます");
38 else if(LOWORD(msg)==IDM_SET) SetStatusText("エディタオプションの設定を行います");
39 else if(LOWORD(msg)==IDM_DEBUG) SetStatusText("プログラムをデバッグ用にコンパイルし、デバッグ実行します");
40 else if(LOWORD(msg)==IDM_DEBUGCOMPILE) SetStatusText("プログラムをデバッグ用にコンパイルします");
41 else if(LOWORD(msg)==IDM_RELEASECOMPILE) SetStatusText("プログラムをリリース用にコンパイルします");
42 else if(LOWORD(msg)==IDM_TOPIC) SetStatusText("ヘルプファイルを開きます");
43 else if(LOWORD(msg)==IDM_ABOUT) SetStatusText("ActiveBasicのバージョン情報を表示します");
44 else SetStatusText(CmdMsg);
45#else
46 //英語
47 if(LOWORD(msg)==IDM_NEW) SetStatusText("Create a new document");
48 else if(LOWORD(msg)==IDM_OPEN) SetStatusText("Open an existing document");
49 else if(LOWORD(msg)==IDM_CLOSE) SetStatusText("Close the active document");
50 else if(LOWORD(msg)==IDM_SAVE) SetStatusText("Save the active document");
51 else if(LOWORD(msg)==IDM_NEWSAVE) SetStatusText("Save the active document with a new name");
52 else if(LOWORD(msg)==IDM_ALLSAVE) SetStatusText("Save all the modified documents");
53 else if(LOWORD(msg)==IDM_PROJECT_OPEN) SetStatusText("Open an existing project");
54 else if(LOWORD(msg)==IDM_PROJECT_SAVE) SetStatusText("Save the active project");
55 else if(LOWORD(msg)==IDM_PROJECT_CLOSE) SetStatusText("Close the active project");
56 else if(LOWORD(msg)==IDM_EXIT) SetStatusText("Quit the application, prompts you to save modified documents");
57 else if(LOWORD(msg)==IDM_UNDO) SetStatusText("Undo the last action");
58 else if(LOWORD(msg)==IDM_REDO) SetStatusText("Redo the previously undone action");
59 else if(LOWORD(msg)==IDM_CUT) SetStatusText("Cut the selection and puts it on the Clipboard");
60 else if(LOWORD(msg)==IDM_COPY) SetStatusText("Copy the selection and puts it on the Clipboard");
61 else if(LOWORD(msg)==IDM_PASTE) SetStatusText("Insert Clipboard contents");
62 else if(LOWORD(msg)==IDM_DELETE) SetStatusText("Erase the selection");
63 else if(LOWORD(msg)==IDM_ALLSELECT) SetStatusText("Select the entire document");
64 else if(LOWORD(msg)==IDM_FIND) SetStatusText("Search for text in the active document");
65 else if(LOWORD(msg)==IDM_PERMUTATION) SetStatusText("Replace occurrences of search string");
66 else if(LOWORD(msg)==IDM_PROJECTVIEW) SetStatusText("Show or hide ProjectView");
67 else if(LOWORD(msg)==IDM_PROJECT_OPTION) SetStatusText("Set project options");
68 else if(LOWORD(msg)==IDM_TOPMOST) SetStatusText("Mark ProjectEditor stay on top of the other applications");
69 else if(LOWORD(msg)==IDM_SET) SetStatusText("Set editor options");
70 else if(LOWORD(msg)==IDM_DEBUG) SetStatusText("Debug the program");
71 else if(LOWORD(msg)==IDM_DEBUGCOMPILE) SetStatusText("Compile the program for debugging");
72 else if(LOWORD(msg)==IDM_RELEASECOMPILE) SetStatusText("Compile the program for release");
73 else if(LOWORD(msg)==IDM_TOPIC) SetStatusText("Open the Help topics");
74 else if(LOWORD(msg)==IDM_ABOUT) SetStatusText("Display information about ActiveBasic");
75 else SetStatusText(CmdMsg);
76#endif
77}
78
79void ShowToolTipText(LPTOOLTIPTEXT TipText){
80 ////////////////////////////////////////////////////////////////////////////
81 // ツールチップ(ツールバーにポイントしたときにポップアップされるテキスト)
82 ////////////////////////////////////////////////////////////////////////////
83
84#if defined(JPN)
85 //日本語
86 if(TipText->hdr.idFrom==IDM_NEW) TipText->lpszText="新規作成 (Ctrl+N)";
87 else if(TipText->hdr.idFrom==IDM_OPEN) TipText->lpszText="開く (Ctrl+O)";
88 else if(TipText->hdr.idFrom==IDM_SAVE) TipText->lpszText="保存 (Ctrl+S)";
89 else if(TipText->hdr.idFrom==IDM_ALLSAVE) TipText->lpszText="すべて保存";
90 else if(TipText->hdr.idFrom==IDM_CUT) TipText->lpszText="切り取り (Ctrl+X)";
91 else if(TipText->hdr.idFrom==IDM_COPY) TipText->lpszText="コピー (Ctrl+C)";
92 else if(TipText->hdr.idFrom==IDM_PASTE) TipText->lpszText="貼り付け (Ctrl+V)";
93 else if(TipText->hdr.idFrom==IDM_UNDO) TipText->lpszText="元に戻す (Ctrl+Z)";
94 else if(TipText->hdr.idFrom==IDM_REDO) TipText->lpszText="やり直し (Ctrl+Y)";
95 else if(TipText->hdr.idFrom==IDM_FIND) TipText->lpszText="検索 (Ctrl+F)";
96 else if(TipText->hdr.idFrom==IDM_DEBUG) TipText->lpszText="デバッグ実行 (F5)";
97 else if(TipText->hdr.idFrom==IDM_DEBUGCOMPILE) TipText->lpszText="デバッグ ビルド (F7)";
98 else if(TipText->hdr.idFrom==IDM_RELEASECOMPILE) TipText->lpszText="リリース ビルド (F6)";
99#else
100 //英語
101 if(TipText->hdr.idFrom==IDM_NEW) TipText->lpszText="New Document (Ctrl+N)";
102 else if(TipText->hdr.idFrom==IDM_OPEN) TipText->lpszText="Open Document (Ctrl+O)";
103 else if(TipText->hdr.idFrom==IDM_SAVE) TipText->lpszText="Save Document (Ctrl+S)";
104 else if(TipText->hdr.idFrom==IDM_ALLSAVE) TipText->lpszText="Save All Document";
105 else if(TipText->hdr.idFrom==IDM_CUT) TipText->lpszText="Cut (Ctrl+X)";
106 else if(TipText->hdr.idFrom==IDM_COPY) TipText->lpszText="Copy (Ctrl+C)";
107 else if(TipText->hdr.idFrom==IDM_PASTE) TipText->lpszText="Paste (Ctrl+V)";
108 else if(TipText->hdr.idFrom==IDM_UNDO) TipText->lpszText="Undo (Ctrl+Z)";
109 else if(TipText->hdr.idFrom==IDM_REDO) TipText->lpszText="Redo (Ctrl+Y)";
110 else if(TipText->hdr.idFrom==IDM_FIND) TipText->lpszText="Find (Ctrl+F)";
111 else if(TipText->hdr.idFrom==IDM_DEBUG) TipText->lpszText="Run for Debugging (F2)";
112 else if(TipText->hdr.idFrom==IDM_DEBUGCOMPILE) TipText->lpszText="Compile for Debugging (F4)";
113 else if(TipText->hdr.idFrom==IDM_RELEASECOMPILE) TipText->lpszText="Compile for Release (F7)";
114#endif
115 MenuAdvice(TipText->hdr.idFrom);
116}
117
118char *reflexive_Include(char *buffer,char ***pppFilePath,int *pFileNum,char *pDefaultDir){
119 extern HANDLE hHeap;
120 int i,i2,i3,i4,sw1,sw2,FileSize;
121 char temporary[MAX_PATH],temp2[MAX_PATH+255],*temp3;
122 DWORD AccBytes;
123
124 //重複チェック用
125 char **ppFilePath;
126 int FileNum;
127 ppFilePath=*pppFilePath;
128 FileNum=*pFileNum;
129
130 for(i=0;;i++){
131 if( ( memcmp(buffer+i,"#include",8)==0 || memcmp(buffer+i,"#require",8)==0 )&&(!IsVariableChar(buffer[i+8]))){
132 i2=i+8;
133 while(buffer[i2]==' '||buffer[i2]=='\t') i2++;
134 sw1=0;
135 if(buffer[i2]=='\"') i2++;
136 else if(buffer[i2]=='<'){
137 i2++;
138 sw1=1;
139 }
140 for(i3=0;;i2++,i3++){
141 if((buffer[i2]=='\"'&&sw1==0)||(buffer[i2]=='>'&&sw1==1)||(buffer[i2]=='\r'&&buffer[i2+1]=='\n')||buffer[i2]=='\0'){
142 temporary[i3]=0;
143 break;
144 }
145 temporary[i3]=buffer[i2];
146 }
147 while((!(buffer[i2]=='\r'&&buffer[i2+1]=='\n'))&&buffer[i2]!='\0') i2++;
148
149 if(sw1){
150 sprintf(temp2,"%sInclude\\%s",pj_editor_Dir,temporary);
151 lstrcpy(temporary,temp2);
152 }
153 else{
154 GetFullPath(temporary,pDefaultDir);
155 }
156
157
158 //////////////////
159 // 重複チェック
160 //////////////////
161 for(i3=0,sw2=0;i3<FileNum;i3++){
162 if(lstrcmpi(ppFilePath[i3],temporary)==0){
163 //重複したとき
164 sw2=1;
165 break;
166 }
167 }
168 if(sw2){
169 //重複したときは無視する
170 i=i2;
171 continue;
172 }
173 ppFilePath=(char **)HeapReAlloc(hHeap,0,ppFilePath,(FileNum+1)*sizeof(char *));
174 ppFilePath[FileNum]=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
175 lstrcpy(ppFilePath[FileNum],temporary);
176 FileNum++;
177
178#define MEM_SPACE 1024 //強制終了を防ぐためのゆとりスペース
179 extern MDIINFO MdiInfo[MAX_WNDNUM];
180 for(i3=0;i3<MAX_WNDNUM;i3++){
181 if(MdiInfo[i3].hwnd){
182 if(lstrcmpi(temporary,MdiInfo[i3].path)==0) break;
183 }
184 }
185 if(i3==MAX_WNDNUM){
186 //ファイルから開く
187 HANDLE fh;
188 fh=CreateFile(temporary,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
189 if(fh==INVALID_HANDLE_VALUE){
190 goto finish;
191 }
192
193 FileSize=GetFileSize(fh,NULL);
194
195 temp3=(char *)HeapAlloc(hHeap,0,FileSize+MEM_SPACE);
196 ReadFile(fh,temp3,FileSize,&AccBytes,NULL);
197 temp3[FileSize]=0;
198
199 CloseHandle(fh);
200 }
201 else{
202 //エディタから読み取る
203 FileSize=lstrlen(MdiInfo[i3].pMdiTextEdit->buffer);
204
205 temp3=(char *)HeapAlloc(hHeap,0,FileSize+MEM_SPACE);
206 memcpy(temp3,MdiInfo[i3].pMdiTextEdit->buffer,FileSize);
207 temp3[FileSize]=0;
208 }
209
210 //新しい参照ディレクトリを取得
211 char DefaultDir[MAX_PATH+1024];
212 _splitpath(temporary,DefaultDir,temp2,0,0);
213 lstrcat(DefaultDir,temp2);
214
215 //インクルードの再帰呼び出し
216 temp3=reflexive_Include(temp3,&ppFilePath,&FileNum,DefaultDir);
217 FileSize=lstrlen(temp3);
218
219 i4=lstrlen(buffer)+FileSize-(i2-i);
220 if(FileSize>(i2-i)) buffer=(char *)HeapReAlloc(hHeap,0,buffer,i4+1+MEM_SPACE);
221 SlideString(buffer+i2,FileSize-(i2-i));
222
223 memcpy(buffer+i,temp3,FileSize);
224
225 HeapDefaultFree(temp3);
226
227 i--;
228 continue;
229 }
230
231 for(;;i++){
232 if(buffer[i]=='\0') break;
233 if(buffer[i]=='\r'&&buffer[i+1]=='\n'){
234 i++;
235 break;
236 }
237 }
238 if(buffer[i]=='\0') break;
239 }
240
241finish:
242
243 //重複チェック用
244 *pppFilePath=ppFilePath;
245 *pFileNum=FileNum;
246
247 return buffer;
248}
249
250char *IncludeFiles(char *buffer){
251 extern HANDLE hHeap;
252 int i;
253
254 //参照ディレクトリ
255 char *pDefaultDir;
256 extern PROJECTINFO ProjectInfo;
257 if(ProjectInfo.name[0])
258 pDefaultDir=ProjectInfo.dir;
259 else pDefaultDir=pj_editor_Dir;
260
261 //重複チェック用
262 char **ppFilePath;
263 int FileNum;
264 ppFilePath=(char **)HeapAlloc(hHeap,0,1);
265 FileNum=0;
266
267 buffer=reflexive_Include(buffer,&ppFilePath,&FileNum,pDefaultDir);
268
269 for(i=0;i<FileNum;i++){
270 HeapDefaultFree(ppFilePath[i]);
271 }
272 HeapDefaultFree(ppFilePath);
273 return buffer;
274}
Note: See TracBrowser for help on using the repository browser.