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

Last change on this file since 717 was 717, checked in by dai, 16 years ago

#188への対応。UserSettingディレクトリを廃止し、正規のユーザ空間ディレクトリを取り入れた。

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