source: dev/ProjectEditor/NonVolatile.cpp@ 3

Last change on this file since 3 was 3, checked in by dai_9181, 17 years ago
File size: 24.0 KB
Line 
1#include "common.h"
2
3
4void GetDefaultEditFont(LOGFONT *pLogFont){
5#if defined(JPN)
6 //日本語
7 pLogFont->lfHeight=-13;
8 pLogFont->lfWidth=0;
9 pLogFont->lfEscapement=0;
10 pLogFont->lfOrientation=0;
11 pLogFont->lfWeight=400;
12 pLogFont->lfItalic=NULL;
13 pLogFont->lfUnderline=NULL;
14 pLogFont->lfStrikeOut=NULL;
15 pLogFont->lfCharSet=SHIFTJIS_CHARSET;
16 pLogFont->lfOutPrecision=OUT_STRING_PRECIS;
17 pLogFont->lfClipPrecision=CLIP_STROKE_PRECIS;
18 pLogFont->lfQuality=DRAFT_QUALITY;
19 pLogFont->lfPitchAndFamily=FIXED_PITCH;
20 sprintf(pLogFont->lfFaceName,"MS ゴシック");
21#else
22 //英語
23 pLogFont->lfHeight=-15;
24 pLogFont->lfWidth=0;
25 pLogFont->lfEscapement=0;
26 pLogFont->lfOrientation=0;
27 pLogFont->lfWeight=400;
28 pLogFont->lfItalic=NULL;
29 pLogFont->lfUnderline=NULL;
30 pLogFont->lfStrikeOut=NULL;
31 pLogFont->lfCharSet=ANSI_CHARSET;
32 pLogFont->lfOutPrecision=OUT_STRING_PRECIS;
33 pLogFont->lfClipPrecision=CLIP_STROKE_PRECIS;
34 pLogFont->lfQuality=DRAFT_QUALITY;
35 pLogFont->lfPitchAndFamily=FIXED_PITCH;
36 sprintf(pLogFont->lfFaceName,"Courier New");
37#endif
38}
39void GetDefaultHintFont(LOGFONT *pLogFont){
40#if defined(JPN)
41 //日本語
42 pLogFont->lfHeight=-12;
43 pLogFont->lfWidth=0;
44 pLogFont->lfEscapement=0;
45 pLogFont->lfOrientation=0;
46 pLogFont->lfWeight=FW_THIN;
47 pLogFont->lfItalic=NULL;
48 pLogFont->lfUnderline=NULL;
49 pLogFont->lfStrikeOut=NULL;
50 pLogFont->lfCharSet=ANSI_CHARSET;
51 pLogFont->lfOutPrecision=OUT_STRING_PRECIS;
52 pLogFont->lfClipPrecision=CLIP_STROKE_PRECIS;
53 pLogFont->lfQuality=DRAFT_QUALITY;
54 pLogFont->lfPitchAndFamily=VARIABLE_PITCH;
55 sprintf(pLogFont->lfFaceName,"MS Pゴシック");
56#else
57 //英語
58 pLogFont->lfHeight=-12;
59 pLogFont->lfWidth=0;
60 pLogFont->lfEscapement=0;
61 pLogFont->lfOrientation=0;
62 pLogFont->lfWeight=FW_THIN;
63 pLogFont->lfItalic=NULL;
64 pLogFont->lfUnderline=NULL;
65 pLogFont->lfStrikeOut=NULL;
66 pLogFont->lfCharSet=ANSI_CHARSET;
67 pLogFont->lfOutPrecision=OUT_STRING_PRECIS;
68 pLogFont->lfClipPrecision=CLIP_STROKE_PRECIS;
69 pLogFont->lfQuality=DRAFT_QUALITY;
70 pLogFont->lfPitchAndFamily=VARIABLE_PITCH;
71 sprintf(pLogFont->lfFaceName,"Arial");
72#endif
73}
74void GetDefaultPrintFont(LOGFONT *pLogFont){
75 pLogFont->lfHeight=0; //iPrintFontPointSizeとデバイス情報により決まる
76 pLogFont->lfWidth=0;
77 pLogFont->lfEscapement=0;
78 pLogFont->lfOrientation=0;
79 pLogFont->lfWeight=FW_NORMAL;
80 pLogFont->lfItalic=NULL;
81 pLogFont->lfUnderline=NULL;
82 pLogFont->lfStrikeOut=NULL;
83 pLogFont->lfCharSet=SHIFTJIS_CHARSET;
84 pLogFont->lfOutPrecision=OUT_STRING_PRECIS;
85 pLogFont->lfClipPrecision=CLIP_STROKE_PRECIS;
86 pLogFont->lfQuality=DRAFT_QUALITY;
87 pLogFont->lfPitchAndFamily=FIXED_PITCH;
88 lstrcpy(pLogFont->lfFaceName,"MS ゴシック");
89}
90
91
92///////////////////////////
93// 不揮発性のデータ管理
94///////////////////////////
95
96CNonVolatile::CNonVolatile(){
97 memset(this,0,sizeof(CNonVolatile));
98
99 //拡張子管理オブジェクトを生成
100 pobj_ExtLink=new CExtLink();
101
102 //Web検索用ドメイン管理オブジェクトを生成
103 pobj_DBDomain=new CDBDomain();
104
105 //「最近使ったファイル」オブジェクトを生成
106 pobj_History=new CHistory(100);
107
108 //「最近使ったプロジェクト」オブジェクトを生成
109 pobj_ProjectHistory=new CHistory(200);
110}
111CNonVolatile::~CNonVolatile(){
112 //拡張子管理オブジェクトを破棄
113 delete pobj_ExtLink;
114 pobj_ExtLink=0;
115
116 //Web検索用ドメイン管理オブジェクトを破棄
117 delete pobj_DBDomain;
118 pobj_DBDomain=0;
119
120 //「最近使ったファイル」オブジェクトを破棄
121 delete pobj_History;
122 pobj_History=0;
123
124 //「最近使ったプロジェクト」オブジェクトを破棄
125 delete pobj_ProjectHistory;
126 pobj_ProjectHistory=0;
127}
128
129BOOL CSettingFile::GetDataLine(char *name,char *parms){
130 int i,i2,length;
131 length=lstrlen(name);
132 for(i=0;;i++){
133 if(buffer[i]=='\0') break;
134 if(i==0||buffer[i]=='\r'&&buffer[i+1]=='\n'){
135 if(buffer[i]=='\r'&&buffer[i+1]=='\n') i+=2;
136 if(memcmp(buffer+i,name,length)==0&&buffer[i+length]=='='){
137 i+=length+1;
138 for(i2=0;;i++,i2++){
139 if(buffer[i]=='\r'&&buffer[i+1]=='\n'||buffer[i]=='\0'){
140 parms[i2]=0;
141 break;
142 }
143 parms[i2]=buffer[i];
144 }
145 return 1;
146 }
147 }
148 }
149 return 0;
150}
151
152BOOL CSettingFile::GetWholeValue(char *name,int *pi32data){
153 char temporary[8192];
154 if(!GetDataLine(name,temporary)) return 0;
155 *pi32data=atoi(temporary);
156 return 1;
157}
158BOOL CSettingFile::Get3WholeValue(char *name,int *pd1,int *pd2,int *pd3){
159 char temporary[8192];
160 if(!GetDataLine(name,temporary)) return 0;
161 sscanf(temporary,"%d,%d,%d",pd1,pd2,pd3);
162 return 1;
163}
164BOOL CSettingFile::GetRGBValue(char *name,COLORREF *prgb){
165 char temporary[8192];
166 if(!GetDataLine(name,temporary)) return 0;
167 sscanf(temporary,"%x",prgb);
168 return 1;
169}
170BOOL CSettingFile::GetStringValue(char *name,char *str){
171 if(!GetDataLine(name,str)) return 0;
172 return 1;
173}
174BOOL CSettingFile::GetRectValue(char *name,RECT *prc){
175 char temporary[8192];
176 if(!GetDataLine(name,temporary)) return 0;
177 sscanf(temporary,"%d,%d,%d,%d",&prc->left,&prc->top,&prc->right,&prc->bottom);
178 return 1;
179}
180BOOL CSettingFile::GetLogFont(char *name,LOGFONT *plf){
181 char temporary[8192];
182 if(!GetDataLine(name,temporary)) return 0;
183 sscanf(temporary,"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
184 &plf->lfHeight,
185 &plf->lfWidth,
186 &plf->lfEscapement,
187 &plf->lfOrientation,
188 &plf->lfWeight,
189 &plf->lfItalic,
190 &plf->lfUnderline,
191 &plf->lfStrikeOut,
192 &plf->lfCharSet,
193 &plf->lfOutPrecision,
194 &plf->lfClipPrecision,
195 &plf->lfQuality,
196 &plf->lfPitchAndFamily);
197
198 int i;
199 for(i=lstrlen(temporary)-1;i>=0;i--){
200 if(temporary[i]==','){
201 i++;
202 break;
203 }
204 }
205 lstrcpy(plf->lfFaceName,temporary+i);
206 return 1;
207}
208BOOL CSettingFile::GetRebarBand(SAVEREBAR *psr,int num){
209 char name[32];
210 char temporary[8192];
211
212 sprintf(name,"RebarBand%d",num);
213 if(!GetDataLine(name,temporary)) return 0;
214
215 sscanf(temporary,"%d,%d,%d",&psr->RebarID,&psr->RebarLength,&psr->IsBandBreak);
216 return 1;
217}
218
219void CNonVolatile::load(){
220 extern METHODCHECKINFO MethodCheckInfo;
221
222 int i;
223 char temporary[MAX_PATH];
224
225
226 ///////////////////////////////////
227 // 関連付け用の拡張子オブジェクト
228 ///////////////////////////////////
229 sprintf(temporary,"%sUserSetting\\extlink.ini",pj_editor_Dir);
230 pobj_ExtLink->load(temporary);
231
232
233 //////////////////////////////////////
234 // Web検索用ドメイン管理オブジェクト
235 //////////////////////////////////////
236 pobj_DBDomain->load();
237
238
239 ///////////////////////////////////////
240 // 「最近使ったファイル」オブジェクト
241 ///////////////////////////////////////
242 sprintf(temporary,"%sUserSetting\\history.ini",pj_editor_Dir);
243 pobj_History->load(temporary);
244
245
246 ////////////////////////////////////////////
247 // 「最近使ったプロジェクト」オブジェクト
248 ////////////////////////////////////////////
249 sprintf(temporary,"%sUserSetting\\pj_history.ini",pj_editor_Dir);
250 pobj_ProjectHistory->load(temporary);
251
252
253
254 //開く
255 sprintf(temporary,"%sUserSetting\\editor.ini",pj_editor_Dir);
256 buffer=ReadBuffer_NonErrMsg(temporary);
257 if(!buffer){
258
259 //デフォルトの初期設定
260 InitToDefaultData();
261 return;
262 }
263
264 //関連付けを行うかどうか(この関数の最後に呼び出す)
265 if(!GetStringValue("LinkFile",temporary)){
266 ExtensionLink(NULL);
267 }
268
269 //ウィンドウサイズを保存するかしないか
270 if(!GetRectValue("WindowRect",&StartupWindowRect)){
271 StartupWindowRect.left=(int)((double)ScreenX*0.1);
272 StartupWindowRect.top=(int)((double)ScreenX*0.1);
273 StartupWindowRect.right=(int)((double)ScreenX*0.8);
274 StartupWindowRect.bottom=(int)((double)ScreenY*0.8);
275 }
276
277 //ウィンドウを最大化するか
278 if(!GetWholeValue("IsWindowMax",&bWindowMax)) bWindowMax=0;
279
280 //実行時のプロジェクトの保存確認の有無
281 if(!GetWholeValue("Project_SaveCheck",&bSaveCheckProject)) bSaveCheckProject=0;
282
283 //ラインアジャスタ
284 if(!GetWholeValue("Rad_LineAdjust",&bLineAdjust)) bLineAdjust=1;
285
286 //ProjectView位置情報
287 if(!GetRectValue("ProjectViewRect",&rectProjectView)){
288 rectProjectView.left=StartupWindowRect.right-270;
289 rectProjectView.right=StartupWindowRect.right-5;
290 rectProjectView.top=StartupWindowRect.top+60;
291 rectProjectView.bottom=StartupWindowRect.top+380;
292 }
293 if(rectProjectView.right<=0||
294 rectProjectView.left>=ScreenX||
295 rectProjectView.bottom<=0||
296 rectProjectView.top>=ScreenY||
297 rectProjectView.right-rectProjectView.left<10||
298 rectProjectView.bottom-rectProjectView.top<10){
299 //不正なデータは復元
300 rectProjectView.left=StartupWindowRect.right-270;
301 rectProjectView.right=StartupWindowRect.right-5;
302 rectProjectView.top=StartupWindowRect.top+60;
303 rectProjectView.bottom=StartupWindowRect.top+380;
304 }
305
306 //ProjectViewクリップ情報
307 if(!GetWholeValue("IsClipProjectView",&bClipProjectView)) bClipProjectView=1;
308 if(!GetWholeValue("width_ClipProjectView",&width_ClipProjectView)) width_ClipProjectView=200;
309
310 //デバッガビュー クリップ情報
311 if(!GetWholeValue("height_ClipDebuggerView",&height_ClipDebuggerView)) height_ClipDebuggerView=180;
312
313 //コンパイラビュー クリップ情報
314 if(!GetWholeValue("height_ClipCompileView",&height_ClipCompileView)) height_ClipCompileView=130;
315
316 //Web検索クリップ情報
317 if(!GetWholeValue("width_WebSearchView",&width_WebSearchView)) width_WebSearchView=230;
318
319
320 //Rebarバンド情報
321 for(i=0;i<MAX_REBARBANDS;i++){
322 if(!GetRebarBand(&SaveRebar[i],i)){
323 ResetRebarData();
324 break;
325 }
326 }
327
328 //Rebarバンドを固定するか
329 if(!GetWholeValue("IsNoGripper",&bNoGripper)) bNoGripper=0;
330
331
332 //ドキュメントを保存したときにタブを先頭に再配置するかどうか
333 if(!GetWholeValue("IsSaveTabToHead",&bSaveTabToHead)){
334#ifdef THETEXT
335 bSaveTabToHead=0;
336#else
337 bSaveTabToHead=1;
338#endif
339 }
340
341 //フォント
342 if(!GetLogFont("EditorFont",&lf)){
343 //読み込めなかったときは、デフォルトのエディタフォントをセット
344 GetDefaultEditFont(&lf);
345 }
346
347 //タブサイズ
348 if(!GetWholeValue("TabSize",&TabSize)) TabSize=4;
349
350 //エディタの行番号を表示するかどうか
351 if(!GetWholeValue("IsShowLineNumber",&bEditor_LineNumber)) bEditor_LineNumber=1;
352
353 //エディタのルーラーを表示するかどうか
354 if(!GetWholeValue("IsShowRuler",&bEditor_Ruler)) bEditor_Ruler=1;
355
356 //カーソル行を強調表示するかどうか
357 if(!GetWholeValue("IsCaretLine_BackGround",&bEditor_CaretLine_BackGround)) bEditor_CaretLine_BackGround=1;
358
359 //自動折り返し時の一行あたりの文字数
360 if(!GetWholeValue("MaxOneLineTextLength",&iMaxOneLineTextLength)) iMaxOneLineTextLength=75;
361
362 //コード補完機能を有効にするかどうか
363 if(!GetWholeValue("IsShowComplementWnd",&bShowComplementWnd)) bShowComplementWnd=1;
364
365 //ペアステートメント補完を有効にするかどうか
366 if(!GetWholeValue("BackNum_PairStatementComplement",&BackNum_PairStatementComplement)) BackNum_PairStatementComplement=100;
367
368 //パラメータヒント
369 if(!GetWholeValue("ParameterHint",(int *)&dwParameterHint)) dwParameterHint=1;
370
371 //パラメータ ヒント フォント
372 extern METHODCHECKINFO MethodCheckInfo;
373 if(!GetLogFont("HintFont",&MethodCheckInfo.LogFont)){
374 //読み込めなかったときは、デフォルトのヒントフォントをセット
375 GetDefaultHintFont(&MethodCheckInfo.LogFont);
376 }
377
378 //自動インデント
379 if(!GetWholeValue("IsAutoIndent",&bAutoIndent)) bAutoIndent=1;
380
381 //貼り付け時のインデント調整
382 if(!GetWholeValue("IsPasteIndent",&bPasteIndent)) bPasteIndent=0;
383
384 //検索・置換文字列を保存するかどうか
385 if(!GetWholeValue("IsSaveFindStr",&bSaveFindStr)) bSaveFindStr=1;
386
387 //自動折り返しをするかどうか
388 if(!GetWholeValue("IsRightTurn",&bRightTurn)) bRightTurn=0;
389
390 //Ctrlキーによるハイパーリンク
391 if(!GetWholeValue("IsCtrlKeyHyperLink",&bCtrlKeyHyperLink)) bCtrlKeyHyperLink=1;
392
393 //Web検索文字列を保存するかどうか
394 if(!GetWholeValue("IsSaveWebFindStr",&bSaveWebFindStr)) bSaveWebFindStr=1;
395
396 //初回のMDIウィンドウを最大化表示するか
397 if(!GetWholeValue("IsMDIZoomed",&bMDIZoomed)) bMDIZoomed=0;
398
399 //標準保存先ディレクトリ
400 if(!GetStringValue("DefSaveDir",DefSaveDir)) lstrcpy(DefSaveDir,pj_editor_Dir);
401
402 //プロジェクト保存ディレクトリ
403 if(!GetStringValue("ProjectSaveDir",ProjectSaveDir)) sprintf(ProjectSaveDir,"%sMyProjects",pj_editor_Dir);
404
405 //検索時に、大文字小文字を区別するか
406 if(!GetWholeValue("IsFindStrBigSmall",&bFindStrBigSmall)) bFindStrBigSmall=0;
407
408 //検索時に、正規表現を利用するかどうか
409 if(!GetWholeValue("IsRegExp",&bRegExp)) bRegExp=0;
410
411 //アクティブ デザイン テーマ
412 if(!GetStringValue("ActiveTheme",szActiveTheme)) lstrcpy(szActiveTheme,THEMENAME_CLASSIC);
413
414 //印刷用フォント
415 if(!GetLogFont("PrintFont",&lfPrint)){
416 //読み込めなかったときは、デフォルトのエディタフォントをセット
417 GetDefaultPrintFont(&lfPrint);
418 }
419
420 //印刷用フォントのポイントサイズ
421 if(!GetWholeValue("PrintFontPointSize",&iPrintFontPointSize)){
422 //読み込めなかったときは、デフォルトのポイントサイズをセット
423 iPrintFontPointSize=72;
424 }
425
426 //ページ番号を表示するかどうか
427 if(!GetWholeValue("IsShowPageNum",&bShowPageNum)) bShowPageNum=1;
428
429 //ページ番号文字列
430 if(!GetStringValue("PageStr",szPageStr)) lstrcpy(szPageStr,"ページ &n");
431
432 //インクルードディレクトリ
433 if(!GetStringValue("IncludeDir",szIncludeDir)) lstrcpy(szIncludeDir,".\\Include\\");
434
435 HeapDefaultFree(buffer);
436
437
438 /////////////////
439 // 検索文字列
440 /////////////////
441 int i2,i3;
442
443 sprintf(temporary,"%sUserSetting\\findstr.ini",pj_editor_Dir);
444 buffer=ReadBuffer_NonErrMsg(temporary);
445 if(buffer){
446 i2=0;
447 for(i=0;i<MAX_FINDLIST;i++){
448 for(i3=0;i3<MAX_PATH;i2++,i3++){
449 if(buffer[i2]=='\r'&&buffer[i2+1]=='\n'||buffer[i2]=='\0'){
450 FindStr[i][i3]=0;
451 break;
452 }
453 FindStr[i][i3]=buffer[i2];
454 }
455 if(buffer[i2]=='\r'&&buffer[i2+1]=='\n') i2+=2;
456 }
457
458 HeapDefaultFree(buffer);
459 }
460
461
462 /////////////////
463 // 置換文字列
464 /////////////////
465 sprintf(temporary,"%sUserSetting\\permustr.ini",pj_editor_Dir);
466 buffer=ReadBuffer_NonErrMsg(temporary);
467 if(buffer){
468 i2=0;
469 for(i=0;i<MAX_FINDLIST;i++){
470 for(i3=0;i3<MAX_PATH;i2++,i3++){
471 if(buffer[i2]=='\r'&&buffer[i2+1]=='\n'||buffer[i2]=='\0'){
472 PermutationStr[i][i3]=0;
473 break;
474 }
475 PermutationStr[i][i3]=buffer[i2];
476 }
477 if(buffer[i2]=='\r'&&buffer[i2+1]=='\n') i2+=2;
478 }
479
480 HeapDefaultFree(buffer);
481 }
482
483
484 /////////////////
485 // Web検索文字列
486 /////////////////
487 sprintf(temporary,"%sUserSetting\\webstr.ini",pj_editor_Dir);
488 buffer=ReadBuffer_NonErrMsg(temporary);
489 if(buffer){
490 i2=0;
491 for(i=0;i<MAX_FINDLIST;i++){
492 for(i3=0;i3<MAX_PATH;i2++,i3++){
493 if(buffer[i2]=='\r'&&buffer[i2+1]=='\n'||buffer[i2]=='\0'){
494 WebStr[i][i3]=0;
495 break;
496 }
497 WebStr[i][i3]=buffer[i2];
498 }
499 if(buffer[i2]=='\r'&&buffer[i2+1]=='\n') i2+=2;
500 }
501
502 HeapDefaultFree(buffer);
503 }
504}
505
506void CNonVolatile::InitToDefaultData(){
507 ///////////////////////////////////
508 // デフォルトの初期設定
509 ///////////////////////////////////
510
511 //検索・置換文字列を保存するかどうか
512 bSaveFindStr=1;
513
514 //自動折り返しをするかどうか
515 bRightTurn=0;
516
517 //Ctrlキーによるハイパーリンク
518 bCtrlKeyHyperLink=1;
519
520 //Web検索文字列を保存するかどうか
521 bSaveWebFindStr=1;
522
523 //アクティブ デザイン テーマ
524 lstrcpy(szActiveTheme,THEMENAME_CLASSIC);
525
526 //印刷用フォント
527 GetDefaultPrintFont(&lfPrint);
528
529 //印刷用フォントのポイントサイズ
530 iPrintFontPointSize=72;
531
532 //ページ番号を表示するかどうか
533 bShowPageNum=1;
534
535 //ページ番号文字列
536 lstrcpy(szPageStr,"ページ &n");
537
538 //インクルードディレクトリ
539 lstrcpy(szIncludeDir,".\\Include\\");
540
541 //ウィンドウ位置、サイズ
542 StartupWindowRect.left=(int)((double)ScreenX*0.1);
543 StartupWindowRect.top=(int)((double)ScreenX*0.1);
544 StartupWindowRect.right=(int)((double)ScreenX*0.8);
545 StartupWindowRect.bottom=(int)((double)ScreenY*0.8);
546
547 //ウィンドウを最大化するか
548 bWindowMax=1;
549
550 //実行時の、プロジェクトの保存確認の有無
551 bSaveCheckProject=0;
552
553 //RADツールのライン アジャスタ
554 bLineAdjust=1;
555
556 //ProjectView位置情報
557 rectProjectView.left=StartupWindowRect.right-270;
558 rectProjectView.right=StartupWindowRect.right-5;
559 rectProjectView.top=StartupWindowRect.top+60;
560 rectProjectView.bottom=StartupWindowRect.top+380;
561
562 //Rebar情報を初期化
563 ResetRebarData();
564
565 //エディタ フォント
566 GetDefaultEditFont(&lf);
567
568 //パラメータ ヒント フォント
569 extern METHODCHECKINFO MethodCheckInfo;
570 GetDefaultHintFont(&MethodCheckInfo.LogFont);
571
572 //タブサイズ
573 TabSize=4;
574
575 //行番号を表示するかどうか
576 bEditor_LineNumber=1;
577
578 //ルーラーを表示するかどうか
579 bEditor_Ruler=1;
580
581 //カーソル行を強調表示するかどうか
582 bEditor_CaretLine_BackGround=1;
583
584 //自動折り返しの文字数
585 iMaxOneLineTextLength=75;
586
587 //パラメータヒント
588 dwParameterHint=1;
589
590 //自動インデント
591 bAutoIndent=1;
592
593 //貼り付け時のインデント調整
594 bPasteIndent=0;
595
596 //初回のMDIウィンドウを最大化表示するか
597 bMDIZoomed=1;
598
599 //標準保存先ディレクトリ
600 lstrcpy(DefSaveDir,pj_editor_Dir);
601
602 //プロジェクト保存ディレクトリ
603 sprintf(ProjectSaveDir,"%sMyProjects",pj_editor_Dir);
604
605 bClipProjectView=1;
606 width_ClipProjectView=200;
607 height_ClipDebuggerView=180;
608 height_ClipCompileView=130;
609 width_WebSearchView=230;
610#ifdef THETEXT
611 bSaveTabToHead=0;
612#else
613 bSaveTabToHead=1;
614#endif
615
616 BackNum_PairStatementComplement=100;
617
618 //ファイルの関連付け
619 ExtensionLink(NULL);
620}
621
622void CSettingFile::SetWholeValue(char *name,long i32data){
623 sprintf(buffer+lstrlen(buffer),"%s=%d\r\n",name,i32data);
624}
625void CSettingFile::Set3WholeValue(char *name,long d1,long d2,long d3){
626 sprintf(buffer+lstrlen(buffer),"%s=%d,%d,%d\r\n",name,d1,d2,d3);
627}
628void CSettingFile::SetRGBValue(char *name,COLORREF rgb){
629 rgb=RGB(
630 LOBYTE(LOWORD(rgb)),
631 HIBYTE(LOWORD(rgb)),
632 LOBYTE(HIWORD(rgb))
633 );
634 sprintf(buffer+lstrlen(buffer),"%s=%x\r\n",name,rgb);
635}
636void CSettingFile::SetStringValue(char *name,char *str){
637 sprintf(buffer+lstrlen(buffer),"%s=%s\r\n",name,str);
638}
639void CSettingFile::SetRectValue(char *name,RECT *prc){
640 sprintf(buffer+lstrlen(buffer),"%s=%d,%d,%d,%d\r\n",name,prc->left,prc->top,prc->right,prc->bottom);
641}
642void CSettingFile::SetLogFont(char *name,LOGFONT *plf){
643 sprintf(buffer+lstrlen(buffer),"%s=%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%s\r\n",name,
644 plf->lfHeight,
645 plf->lfWidth,
646 plf->lfEscapement,
647 plf->lfOrientation,
648 plf->lfWeight,
649 plf->lfItalic,
650 plf->lfUnderline,
651 plf->lfStrikeOut,
652 plf->lfCharSet,
653 plf->lfOutPrecision,
654 plf->lfClipPrecision,
655 plf->lfQuality,
656 plf->lfPitchAndFamily,
657 plf->lfFaceName);
658}
659void CSettingFile::SetRebarBand(SAVEREBAR *psr,int num){
660 char name[32];
661
662 sprintf(name,"RebarBand%d",num);
663 sprintf(buffer+lstrlen(buffer),"%s=%d,%d,%d\r\n",name,psr->RebarID,psr->RebarLength,psr->IsBandBreak);
664}
665
666void CNonVolatile::save(){
667 int i;
668 char temporary[MAX_PATH];
669
670 sprintf(temporary,"%sUserSetting",pj_editor_Dir);
671
672 HANDLE hFind;
673 WIN32_FIND_DATA wfd;
674 hFind=FindFirstFile(temporary,&wfd);
675 if(hFind==INVALID_HANDLE_VALUE){
676 //UserSettingディレクトリを作成
677 if(!CreateDirectory(temporary,NULL)){
678 MessageBox(hOwner,"UserSettingディレクトリの作成に失敗",APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION);
679 return;
680 }
681 }
682
683 buffer=(char *)HeapAlloc(hHeap,0,65536);
684 buffer[0]=0;
685
686
687 //ウィンドウサイズを保存するかしないか
688 SetRectValue("WindowRect",&StartupWindowRect);
689
690 //ウィンドウを最大化するか
691 SetWholeValue("IsWindowMax",bWindowMax);
692
693 //実行時のプロジェクトの保存確認の有無
694 SetWholeValue("Project_SaveCheck",bSaveCheckProject);
695
696 //ラインアジャスタ
697 SetWholeValue("Rad_LineAdjust",bLineAdjust);
698
699 //ProjectView位置情報
700 SetRectValue("ProjectViewRect",&rectProjectView);
701
702 //ProjectViewクリップ情報
703 SetWholeValue("IsClipProjectView",bClipProjectView);
704 SetWholeValue("width_ClipProjectView",width_ClipProjectView);
705
706 //デバッガビュー クリップ情報
707 SetWholeValue("height_ClipDebuggerView",height_ClipDebuggerView);
708
709 //コンパイラビュー クリップ情報
710 SetWholeValue("height_ClipCompileView",height_ClipCompileView);
711
712 //Web検索クリップ情報
713 SetWholeValue("width_WebSearchView",width_WebSearchView);
714
715
716 //Rebar情報
717 for(i=0;i<MAX_REBARBANDS;i++){
718 SetRebarBand(&SaveRebar[i],i);
719 }
720
721 //Rebarバンドを固定するか
722 SetWholeValue("IsNoGripper",bNoGripper);
723
724
725 //ドキュメントを保存したときにタブを先頭に再配置するかどうか
726 SetWholeValue("IsSaveTabToHead",bSaveTabToHead);
727
728 //フォント
729 SetLogFont("EditorFont",&lf);
730
731 //タブサイズ
732 SetWholeValue("TabSize",TabSize);
733
734 //エディタの行番号を表示するかどうか
735 SetWholeValue("IsShowLineNumber",bEditor_LineNumber);
736
737 //ルーラーを表示するかどうか
738 SetWholeValue("IsShowRuler",bEditor_Ruler);
739
740 //カーソル行を強調表示するかどうか
741 SetWholeValue("IsCaretLine_BackGround",bEditor_CaretLine_BackGround);
742
743 //自動折り返し時の一行あたりの文字数
744 SetWholeValue("MaxOneLineTextLength",iMaxOneLineTextLength);
745
746 //コード補完機能を有効にするかどうか
747 SetWholeValue("IsShowComplementWnd",bShowComplementWnd);
748
749 //ペアステートメント補完を有効にするかどうか
750 SetWholeValue("BackNum_PairStatementComplement",BackNum_PairStatementComplement);
751
752 //パラメータヒント
753 SetWholeValue("ParameterHint",dwParameterHint);
754
755 //パラメータ ヒント フォント
756 extern METHODCHECKINFO MethodCheckInfo;
757 SetLogFont("HintFont",&MethodCheckInfo.LogFont);
758
759 //検索・置換文字列を保存するかどうか
760 SetWholeValue("IsSaveFindStr",bSaveFindStr);
761
762 //自動インデント
763 SetWholeValue("IsAutoIndent",bAutoIndent);
764
765 //貼り付け時のインデント調整
766 SetWholeValue("IsPasteIndent",bPasteIndent);
767
768 //自動折り返しをするかどうか
769 SetWholeValue("IsRightTurn",bRightTurn);
770
771 //Ctrlキーによるハイパーリンク
772 SetWholeValue("IsCtrlKeyHyperLink",bCtrlKeyHyperLink);
773
774 //Web検索文字列を保存するかどうか
775 SetWholeValue("IsSaveWebFindStr",bSaveWebFindStr);
776
777 //初回のMDIウィンドウを最大化表示するか
778 SetWholeValue("IsMDIZoomed",bMDIZoomed);
779
780 //標準保存先ディレクトリ
781 SetStringValue("DefSaveDir",DefSaveDir);
782
783 //プロジェクト保存ディレクトリ
784 SetStringValue("ProjectSaveDir",ProjectSaveDir);
785
786 //検索時に、大文字小文字を区別するか
787 SetWholeValue("IsFindStrBigSmall",bFindStrBigSmall);
788
789 //検索時に、正規表現を利用するか
790 SetWholeValue("IsRegExp",bRegExp);
791
792 //次回起動時に関連付けダイアログを表示しないようにする
793 SetStringValue("LinkFile","ok");
794
795 //アクティブ デザイン テーマ
796 SetStringValue("ActiveTheme",szActiveTheme);
797
798 //印刷用フォント
799 SetLogFont("PrintFont",&lfPrint);
800
801 //印刷用フォントのポイントサイズ
802 SetWholeValue("PrintFontPointSize",iPrintFontPointSize);
803
804 //ページ番号を表示するかどうか
805 SetWholeValue("IsShowPageNum",bShowPageNum);
806
807 //ページ番号文字列
808 SetStringValue("PageStr",szPageStr);
809
810 //インクルードディレクトリ
811 SetStringValue("IncludeDir",szIncludeDir);
812
813
814 //保存
815 sprintf(temporary,"%sUserSetting\\editor.ini",pj_editor_Dir);
816 WriteBuffer(temporary,buffer,lstrlen(buffer));
817
818
819
820 /////////////////
821 // 検索文字列
822 /////////////////
823 buffer[0]=0;
824 if(pobj_nv->bSaveFindStr){
825 for(i=0;i<MAX_FINDLIST;i++){
826 lstrcat(buffer,FindStr[i]);
827 lstrcat(buffer,"\r\n");
828 }
829 }
830
831 //保存
832 sprintf(temporary,"%sUserSetting\\findstr.ini",pj_editor_Dir);
833 WriteBuffer(temporary,buffer,lstrlen(buffer));
834
835
836
837 /////////////////
838 // 置換文字列
839 /////////////////
840 buffer[0]=0;
841 if(pobj_nv->bSaveFindStr){
842 for(i=0;i<MAX_FINDLIST;i++){
843 lstrcat(buffer,PermutationStr[i]);
844 lstrcat(buffer,"\r\n");
845 }
846 }
847
848 //保存
849 sprintf(temporary,"%sUserSetting\\permustr.ini",pj_editor_Dir);
850 WriteBuffer(temporary,buffer,lstrlen(buffer));
851
852
853
854 /////////////////
855 // Web検索文字列
856 /////////////////
857 buffer[0]=0;
858 if(pobj_nv->bSaveWebFindStr){
859 for(i=0;i<MAX_FINDLIST;i++){
860 lstrcat(buffer,WebStr[i]);
861 lstrcat(buffer,"\r\n");
862 }
863 }
864
865 //保存
866 sprintf(temporary,"%sUserSetting\\webstr.ini",pj_editor_Dir);
867 WriteBuffer(temporary,buffer,lstrlen(buffer));
868
869 HeapDefaultFree(buffer);
870
871
872
873 ///////////////////////////////////
874 // 関連付け用の拡張子オブジェクト
875 ///////////////////////////////////
876 sprintf(temporary,"%sUserSetting\\extlink.ini",pj_editor_Dir);
877 pobj_ExtLink->save(temporary);
878
879
880 //////////////////////////////////////
881 // Web検索用ドメイン管理オブジェクト
882 //////////////////////////////////////
883 pobj_DBDomain->save();
884
885
886 ///////////////////////////////////////
887 // 「最近使ったファイル」オブジェクト
888 ///////////////////////////////////////
889 sprintf(temporary,"%sUserSetting\\history.ini",pj_editor_Dir);
890 pobj_History->save(temporary);
891
892
893 ///////////////////////////////////////
894 // 「最近使ったファイル」オブジェクト
895 ///////////////////////////////////////
896 sprintf(temporary,"%sUserSetting\\pj_history.ini",pj_editor_Dir);
897 pobj_ProjectHistory->save(temporary);
898}
Note: See TracBrowser for help on using the repository browser.