source: dev/trunk/abdev/ProjectEditor/NonVolatile.cpp@ 367

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

表記ユレを修正

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