source: dev/trunk/ab5.0/abdev/abdev/NonVolatile.cpp@ 481

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

構成管理を大幅に改良。

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