source: dev/ProjectEditor/NonVolatile.cpp@ 24

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

保存されていないドキュメントのタブに(*)をつける機能に対応。
MDITEXTEDITINFOをCMdiTextEditに変更。今後、オブジェクト指向化を進める。

File size: 23.9 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 bSaveTabToHead=0;
335 }
336
337 //フォント
338 if(!GetLogFont("EditorFont",&lf)){
339 //読み込めなかったときは、デフォルトのエディタフォントをセット
340 GetDefaultEditFont(&lf);
341 }
342
343 //タブサイズ
344 if(!GetWholeValue("TabSize",&TabSize)) TabSize=4;
345
346 //エディタの行番号を表示するかどうか
347 if(!GetWholeValue("IsShowLineNumber",&bEditor_LineNumber)) bEditor_LineNumber=1;
348
349 //エディタのルーラーを表示するかどうか
350 if(!GetWholeValue("IsShowRuler",&bEditor_Ruler)) bEditor_Ruler=1;
351
352 //カーソル行を強調表示するかどうか
353 if(!GetWholeValue("IsCaretLine_BackGround",&bEditor_CaretLine_BackGround)) bEditor_CaretLine_BackGround=1;
354
355 //自動折り返し時の一行あたりの文字数
356 if(!GetWholeValue("MaxOneLineTextLength",&iMaxOneLineTextLength)) iMaxOneLineTextLength=75;
357
358 //コード補完機能を有効にするかどうか
359 if(!GetWholeValue("IsShowComplementWnd",&bShowComplementWnd)) bShowComplementWnd=1;
360
361 //ペアステートメント補完を有効にするかどうか
362 if(!GetWholeValue("BackNum_PairStatementComplement",&BackNum_PairStatementComplement)) BackNum_PairStatementComplement=100;
363
364 //パラメータヒント
365 if(!GetWholeValue("ParameterHint",(int *)&dwParameterHint)) dwParameterHint=1;
366
367 //パラメータ ヒント フォント
368 extern METHODCHECKINFO MethodCheckInfo;
369 if(!GetLogFont("HintFont",&MethodCheckInfo.LogFont)){
370 //読み込めなかったときは、デフォルトのヒントフォントをセット
371 GetDefaultHintFont(&MethodCheckInfo.LogFont);
372 }
373
374 //自動インデント
375 if(!GetWholeValue("IsAutoIndent",&bAutoIndent)) bAutoIndent=1;
376
377 //貼り付け時のインデント調整
378 if(!GetWholeValue("IsPasteIndent",&bPasteIndent)) bPasteIndent=0;
379
380 //検索・置換文字列を保存するかどうか
381 if(!GetWholeValue("IsSaveFindStr",&bSaveFindStr)) bSaveFindStr=1;
382
383 //自動折り返しをするかどうか
384 if(!GetWholeValue("IsRightTurn",&bRightTurn)) bRightTurn=0;
385
386 //Ctrlキーによるハイパーリンク
387 if(!GetWholeValue("IsCtrlKeyHyperLink",&bCtrlKeyHyperLink)) bCtrlKeyHyperLink=1;
388
389 //Web検索文字列を保存するかどうか
390 if(!GetWholeValue("IsSaveWebFindStr",&bSaveWebFindStr)) bSaveWebFindStr=1;
391
392 //初回のMDIウィンドウを最大化表示するか
393 if(!GetWholeValue("IsMDIZoomed",&bMDIZoomed)) bMDIZoomed=0;
394
395 //標準保存先ディレクトリ
396 if(!GetStringValue("DefSaveDir",DefSaveDir)) lstrcpy(DefSaveDir,pj_editor_Dir);
397
398 //プロジェクト保存ディレクトリ
399 if(!GetStringValue("ProjectSaveDir",ProjectSaveDir)) sprintf(ProjectSaveDir,"%sMyProjects",pj_editor_Dir);
400
401 //検索時に、大文字小文字を区別するか
402 if(!GetWholeValue("IsFindStrBigSmall",&bFindStrBigSmall)) bFindStrBigSmall=0;
403
404 //検索時に、正規表現を利用するかどうか
405 if(!GetWholeValue("IsRegExp",&bRegExp)) bRegExp=0;
406
407 //アクティブ デザイン テーマ
408 if(!GetStringValue("ActiveTheme",szActiveTheme)) lstrcpy(szActiveTheme,THEMENAME_CLASSIC);
409
410 //印刷用フォント
411 if(!GetLogFont("PrintFont",&lfPrint)){
412 //読み込めなかったときは、デフォルトのエディタフォントをセット
413 GetDefaultPrintFont(&lfPrint);
414 }
415
416 //印刷用フォントのポイントサイズ
417 if(!GetWholeValue("PrintFontPointSize",&iPrintFontPointSize)){
418 //読み込めなかったときは、デフォルトのポイントサイズをセット
419 iPrintFontPointSize=72;
420 }
421
422 //ページ番号を表示するかどうか
423 if(!GetWholeValue("IsShowPageNum",&bShowPageNum)) bShowPageNum=1;
424
425 //ページ番号文字列
426 if(!GetStringValue("PageStr",szPageStr)) lstrcpy(szPageStr,"ページ &n");
427
428 //インクルードディレクトリ
429 if(!GetStringValue("IncludeDir",szIncludeDir)) lstrcpy(szIncludeDir,".\\Include\\");
430
431 HeapDefaultFree(buffer);
432
433
434 /////////////////
435 // 検索文字列
436 /////////////////
437 int i2,i3;
438
439 sprintf(temporary,"%sUserSetting\\findstr.ini",pj_editor_Dir);
440 buffer=ReadBuffer_NonErrMsg(temporary);
441 if(buffer){
442 i2=0;
443 for(i=0;i<MAX_FINDLIST;i++){
444 for(i3=0;i3<MAX_PATH;i2++,i3++){
445 if(buffer[i2]=='\r'&&buffer[i2+1]=='\n'||buffer[i2]=='\0'){
446 FindStr[i][i3]=0;
447 break;
448 }
449 FindStr[i][i3]=buffer[i2];
450 }
451 if(buffer[i2]=='\r'&&buffer[i2+1]=='\n') i2+=2;
452 }
453
454 HeapDefaultFree(buffer);
455 }
456
457
458 /////////////////
459 // 置換文字列
460 /////////////////
461 sprintf(temporary,"%sUserSetting\\permustr.ini",pj_editor_Dir);
462 buffer=ReadBuffer_NonErrMsg(temporary);
463 if(buffer){
464 i2=0;
465 for(i=0;i<MAX_FINDLIST;i++){
466 for(i3=0;i3<MAX_PATH;i2++,i3++){
467 if(buffer[i2]=='\r'&&buffer[i2+1]=='\n'||buffer[i2]=='\0'){
468 PermutationStr[i][i3]=0;
469 break;
470 }
471 PermutationStr[i][i3]=buffer[i2];
472 }
473 if(buffer[i2]=='\r'&&buffer[i2+1]=='\n') i2+=2;
474 }
475
476 HeapDefaultFree(buffer);
477 }
478
479
480 /////////////////
481 // Web検索文字列
482 /////////////////
483 sprintf(temporary,"%sUserSetting\\webstr.ini",pj_editor_Dir);
484 buffer=ReadBuffer_NonErrMsg(temporary);
485 if(buffer){
486 i2=0;
487 for(i=0;i<MAX_FINDLIST;i++){
488 for(i3=0;i3<MAX_PATH;i2++,i3++){
489 if(buffer[i2]=='\r'&&buffer[i2+1]=='\n'||buffer[i2]=='\0'){
490 WebStr[i][i3]=0;
491 break;
492 }
493 WebStr[i][i3]=buffer[i2];
494 }
495 if(buffer[i2]=='\r'&&buffer[i2+1]=='\n') i2+=2;
496 }
497
498 HeapDefaultFree(buffer);
499 }
500}
501
502void CNonVolatile::InitToDefaultData(){
503 ///////////////////////////////////
504 // デフォルトの初期設定
505 ///////////////////////////////////
506
507 //検索・置換文字列を保存するかどうか
508 bSaveFindStr=1;
509
510 //自動折り返しをするかどうか
511 bRightTurn=0;
512
513 //Ctrlキーによるハイパーリンク
514 bCtrlKeyHyperLink=1;
515
516 //Web検索文字列を保存するかどうか
517 bSaveWebFindStr=1;
518
519 //アクティブ デザイン テーマ
520 lstrcpy(szActiveTheme,THEMENAME_CLASSIC);
521
522 //印刷用フォント
523 GetDefaultPrintFont(&lfPrint);
524
525 //印刷用フォントのポイントサイズ
526 iPrintFontPointSize=72;
527
528 //ページ番号を表示するかどうか
529 bShowPageNum=1;
530
531 //ページ番号文字列
532 lstrcpy(szPageStr,"ページ &n");
533
534 //インクルードディレクトリ
535 lstrcpy(szIncludeDir,".\\Include\\");
536
537 //ウィンドウ位置、サイズ
538 StartupWindowRect.left=(int)((double)ScreenX*0.1);
539 StartupWindowRect.top=(int)((double)ScreenX*0.1);
540 StartupWindowRect.right=(int)((double)ScreenX*0.8);
541 StartupWindowRect.bottom=(int)((double)ScreenY*0.8);
542
543 //ウィンドウを最大化するか
544 bWindowMax=1;
545
546 //実行時の、プロジェクトの保存確認の有無
547 bSaveCheckProject=0;
548
549 //RADツールのライン アジャスタ
550 bLineAdjust=1;
551
552 //ProjectView位置情報
553 rectProjectView.left=StartupWindowRect.right-270;
554 rectProjectView.right=StartupWindowRect.right-5;
555 rectProjectView.top=StartupWindowRect.top+60;
556 rectProjectView.bottom=StartupWindowRect.top+380;
557
558 //Rebar情報を初期化
559 ResetRebarData();
560
561 //エディタ フォント
562 GetDefaultEditFont(&lf);
563
564 //パラメータ ヒント フォント
565 extern METHODCHECKINFO MethodCheckInfo;
566 GetDefaultHintFont(&MethodCheckInfo.LogFont);
567
568 //タブサイズ
569 TabSize=4;
570
571 //行番号を表示するかどうか
572 bEditor_LineNumber=1;
573
574 //ルーラーを表示するかどうか
575 bEditor_Ruler=1;
576
577 //カーソル行を強調表示するかどうか
578 bEditor_CaretLine_BackGround=1;
579
580 //自動折り返しの文字数
581 iMaxOneLineTextLength=75;
582
583 //パラメータヒント
584 dwParameterHint=1;
585
586 //自動インデント
587 bAutoIndent=1;
588
589 //貼り付け時のインデント調整
590 bPasteIndent=0;
591
592 //初回のMDIウィンドウを最大化表示するか
593 bMDIZoomed=1;
594
595 //標準保存先ディレクトリ
596 lstrcpy(DefSaveDir,pj_editor_Dir);
597
598 //プロジェクト保存ディレクトリ
599 sprintf(ProjectSaveDir,"%sMyProjects",pj_editor_Dir);
600
601 bClipProjectView=1;
602 width_ClipProjectView=200;
603 height_ClipDebuggerView=180;
604 height_ClipCompileView=130;
605 width_WebSearchView=230;
606 bSaveTabToHead=0;
607
608 BackNum_PairStatementComplement=100;
609
610 //ファイルの関連付け
611 ExtensionLink(NULL);
612}
613
614void CSettingFile::SetWholeValue(char *name,long i32data){
615 sprintf(buffer+lstrlen(buffer),"%s=%d\r\n",name,i32data);
616}
617void CSettingFile::Set3WholeValue(char *name,long d1,long d2,long d3){
618 sprintf(buffer+lstrlen(buffer),"%s=%d,%d,%d\r\n",name,d1,d2,d3);
619}
620void CSettingFile::SetRGBValue(char *name,COLORREF rgb){
621 rgb=RGB(
622 LOBYTE(LOWORD(rgb)),
623 HIBYTE(LOWORD(rgb)),
624 LOBYTE(HIWORD(rgb))
625 );
626 sprintf(buffer+lstrlen(buffer),"%s=%x\r\n",name,rgb);
627}
628void CSettingFile::SetStringValue(char *name,char *str){
629 sprintf(buffer+lstrlen(buffer),"%s=%s\r\n",name,str);
630}
631void CSettingFile::SetRectValue(char *name,RECT *prc){
632 sprintf(buffer+lstrlen(buffer),"%s=%d,%d,%d,%d\r\n",name,prc->left,prc->top,prc->right,prc->bottom);
633}
634void CSettingFile::SetLogFont(char *name,LOGFONT *plf){
635 sprintf(buffer+lstrlen(buffer),"%s=%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%s\r\n",name,
636 plf->lfHeight,
637 plf->lfWidth,
638 plf->lfEscapement,
639 plf->lfOrientation,
640 plf->lfWeight,
641 plf->lfItalic,
642 plf->lfUnderline,
643 plf->lfStrikeOut,
644 plf->lfCharSet,
645 plf->lfOutPrecision,
646 plf->lfClipPrecision,
647 plf->lfQuality,
648 plf->lfPitchAndFamily,
649 plf->lfFaceName);
650}
651void CSettingFile::SetRebarBand(SAVEREBAR *psr,int num){
652 char name[32];
653
654 sprintf(name,"RebarBand%d",num);
655 sprintf(buffer+lstrlen(buffer),"%s=%d,%d,%d\r\n",name,psr->RebarID,psr->RebarLength,psr->IsBandBreak);
656}
657
658void CNonVolatile::save(){
659 int i;
660 char temporary[MAX_PATH];
661
662 sprintf(temporary,"%sUserSetting",pj_editor_Dir);
663
664 HANDLE hFind;
665 WIN32_FIND_DATA wfd;
666 hFind=FindFirstFile(temporary,&wfd);
667 if(hFind==INVALID_HANDLE_VALUE){
668 //UserSettingディレクトリを作成
669 if(!CreateDirectory(temporary,NULL)){
670 MessageBox(hOwner,"UserSettingディレクトリの作成に失敗",APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION);
671 return;
672 }
673 }
674
675 buffer=(char *)HeapAlloc(hHeap,0,65536);
676 buffer[0]=0;
677
678
679 //ウィンドウサイズを保存するかしないか
680 SetRectValue("WindowRect",&StartupWindowRect);
681
682 //ウィンドウを最大化するか
683 SetWholeValue("IsWindowMax",bWindowMax);
684
685 //実行時のプロジェクトの保存確認の有無
686 SetWholeValue("Project_SaveCheck",bSaveCheckProject);
687
688 //ラインアジャスタ
689 SetWholeValue("Rad_LineAdjust",bLineAdjust);
690
691 //ProjectView位置情報
692 SetRectValue("ProjectViewRect",&rectProjectView);
693
694 //ProjectViewクリップ情報
695 SetWholeValue("IsClipProjectView",bClipProjectView);
696 SetWholeValue("width_ClipProjectView",width_ClipProjectView);
697
698 //デバッガビュー クリップ情報
699 SetWholeValue("height_ClipDebuggerView",height_ClipDebuggerView);
700
701 //コンパイラビュー クリップ情報
702 SetWholeValue("height_ClipCompileView",height_ClipCompileView);
703
704 //Web検索クリップ情報
705 SetWholeValue("width_WebSearchView",width_WebSearchView);
706
707
708 //Rebar情報
709 for(i=0;i<MAX_REBARBANDS;i++){
710 SetRebarBand(&SaveRebar[i],i);
711 }
712
713 //Rebarバンドを固定するか
714 SetWholeValue("IsNoGripper",bNoGripper);
715
716
717 //ドキュメントを保存したときにタブを先頭に再配置するかどうか
718 SetWholeValue("IsSaveTabToHead",bSaveTabToHead);
719
720 //フォント
721 SetLogFont("EditorFont",&lf);
722
723 //タブサイズ
724 SetWholeValue("TabSize",TabSize);
725
726 //エディタの行番号を表示するかどうか
727 SetWholeValue("IsShowLineNumber",bEditor_LineNumber);
728
729 //ルーラーを表示するかどうか
730 SetWholeValue("IsShowRuler",bEditor_Ruler);
731
732 //カーソル行を強調表示するかどうか
733 SetWholeValue("IsCaretLine_BackGround",bEditor_CaretLine_BackGround);
734
735 //自動折り返し時の一行あたりの文字数
736 SetWholeValue("MaxOneLineTextLength",iMaxOneLineTextLength);
737
738 //コード補完機能を有効にするかどうか
739 SetWholeValue("IsShowComplementWnd",bShowComplementWnd);
740
741 //ペアステートメント補完を有効にするかどうか
742 SetWholeValue("BackNum_PairStatementComplement",BackNum_PairStatementComplement);
743
744 //パラメータヒント
745 SetWholeValue("ParameterHint",dwParameterHint);
746
747 //パラメータ ヒント フォント
748 extern METHODCHECKINFO MethodCheckInfo;
749 SetLogFont("HintFont",&MethodCheckInfo.LogFont);
750
751 //検索・置換文字列を保存するかどうか
752 SetWholeValue("IsSaveFindStr",bSaveFindStr);
753
754 //自動インデント
755 SetWholeValue("IsAutoIndent",bAutoIndent);
756
757 //貼り付け時のインデント調整
758 SetWholeValue("IsPasteIndent",bPasteIndent);
759
760 //自動折り返しをするかどうか
761 SetWholeValue("IsRightTurn",bRightTurn);
762
763 //Ctrlキーによるハイパーリンク
764 SetWholeValue("IsCtrlKeyHyperLink",bCtrlKeyHyperLink);
765
766 //Web検索文字列を保存するかどうか
767 SetWholeValue("IsSaveWebFindStr",bSaveWebFindStr);
768
769 //初回のMDIウィンドウを最大化表示するか
770 SetWholeValue("IsMDIZoomed",bMDIZoomed);
771
772 //標準保存先ディレクトリ
773 SetStringValue("DefSaveDir",DefSaveDir);
774
775 //プロジェクト保存ディレクトリ
776 SetStringValue("ProjectSaveDir",ProjectSaveDir);
777
778 //検索時に、大文字小文字を区別するか
779 SetWholeValue("IsFindStrBigSmall",bFindStrBigSmall);
780
781 //検索時に、正規表現を利用するか
782 SetWholeValue("IsRegExp",bRegExp);
783
784 //次回起動時に関連付けダイアログを表示しないようにする
785 SetStringValue("LinkFile","ok");
786
787 //アクティブ デザイン テーマ
788 SetStringValue("ActiveTheme",szActiveTheme);
789
790 //印刷用フォント
791 SetLogFont("PrintFont",&lfPrint);
792
793 //印刷用フォントのポイントサイズ
794 SetWholeValue("PrintFontPointSize",iPrintFontPointSize);
795
796 //ページ番号を表示するかどうか
797 SetWholeValue("IsShowPageNum",bShowPageNum);
798
799 //ページ番号文字列
800 SetStringValue("PageStr",szPageStr);
801
802 //インクルードディレクトリ
803 SetStringValue("IncludeDir",szIncludeDir);
804
805
806 //保存
807 sprintf(temporary,"%sUserSetting\\editor.ini",pj_editor_Dir);
808 WriteBuffer(temporary,buffer,lstrlen(buffer));
809
810
811
812 /////////////////
813 // 検索文字列
814 /////////////////
815 buffer[0]=0;
816 if(pobj_nv->bSaveFindStr){
817 for(i=0;i<MAX_FINDLIST;i++){
818 lstrcat(buffer,FindStr[i]);
819 lstrcat(buffer,"\r\n");
820 }
821 }
822
823 //保存
824 sprintf(temporary,"%sUserSetting\\findstr.ini",pj_editor_Dir);
825 WriteBuffer(temporary,buffer,lstrlen(buffer));
826
827
828
829 /////////////////
830 // 置換文字列
831 /////////////////
832 buffer[0]=0;
833 if(pobj_nv->bSaveFindStr){
834 for(i=0;i<MAX_FINDLIST;i++){
835 lstrcat(buffer,PermutationStr[i]);
836 lstrcat(buffer,"\r\n");
837 }
838 }
839
840 //保存
841 sprintf(temporary,"%sUserSetting\\permustr.ini",pj_editor_Dir);
842 WriteBuffer(temporary,buffer,lstrlen(buffer));
843
844
845
846 /////////////////
847 // Web検索文字列
848 /////////////////
849 buffer[0]=0;
850 if(pobj_nv->bSaveWebFindStr){
851 for(i=0;i<MAX_FINDLIST;i++){
852 lstrcat(buffer,WebStr[i]);
853 lstrcat(buffer,"\r\n");
854 }
855 }
856
857 //保存
858 sprintf(temporary,"%sUserSetting\\webstr.ini",pj_editor_Dir);
859 WriteBuffer(temporary,buffer,lstrlen(buffer));
860
861 HeapDefaultFree(buffer);
862
863
864
865 ///////////////////////////////////
866 // 関連付け用の拡張子オブジェクト
867 ///////////////////////////////////
868 sprintf(temporary,"%sUserSetting\\extlink.ini",pj_editor_Dir);
869 pobj_ExtLink->save(temporary);
870
871
872 //////////////////////////////////////
873 // Web検索用ドメイン管理オブジェクト
874 //////////////////////////////////////
875 pobj_DBDomain->save();
876
877
878 ///////////////////////////////////////
879 // 「最近使ったファイル」オブジェクト
880 ///////////////////////////////////////
881 sprintf(temporary,"%sUserSetting\\history.ini",pj_editor_Dir);
882 pobj_History->save(temporary);
883
884
885 ///////////////////////////////////////
886 // 「最近使ったファイル」オブジェクト
887 ///////////////////////////////////////
888 sprintf(temporary,"%sUserSetting\\pj_history.ini",pj_editor_Dir);
889 pobj_ProjectHistory->save(temporary);
890}
Note: See TracBrowser for help on using the repository browser.