-
Notifications
You must be signed in to change notification settings - Fork 174
/
Copy pathCShareData_IO.cpp
2525 lines (2299 loc) · 113 KB
/
CShareData_IO.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*! @file */
//2008.XX.XX kobake CShareDataから分離
/*
Copyright (C) 2008, kobake
Copyright (C) 2018-2022, Sakura Editor Organization
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but is
not required.
2. Altered source versions must be plainly marked as such,
and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include "StdAfx.h"
#include "env/CShareData_IO.h"
#include "doc/CDocTypeSetting.h" // ColorInfo !!
#include "CShareData.h"
#include "util/string_ex2.h"
#include "util/window.h"
#include "view/CEditView.h" // SColorStrategyInfo
#include "view/colors/CColorStrategy.h"
#include "plugin/CPlugin.h"
#include "uiparts/CMenuDrawer.h"
#include "_main/CCommandLine.h"
#include "_main/CControlProcess.h"
#include "config/app_constants.h"
#include "String_define.h"
void ShareData_IO_Sub_LogFont( CDataProfile& cProfile, const WCHAR* pszSecName,
const WCHAR* pszKeyLf, const WCHAR* pszKeyPointSize, const WCHAR* pszKeyFaceName, LOGFONT& lf, INT& nPointSize );
template <typename T>
void SetValueLimit(T& target, int minval, int maxval)
{
target = t_max<T>(minval, t_min<T>(maxval, target));
}
template <typename T>
void SetValueLimit(T& target, int maxval)
{
SetValueLimit( target, 0, maxval );
}
/*!
入出力に使うINIファイルのパスを取得する
出力時はマルチユーザー設定を考慮したパスを返す。
マルチユーザー用のiniファイルが実在する場合はそれを返す。
上記以外はexeファイルの拡張子をiniに変えたパスを返す。
*/
std::filesystem::path GetIniFileNameForIO(bool bWrite)
{
const auto iniPath = GetExeFileName().replace_extension(L".ini");
if (const auto privateIniPath = GetIniFileName();
bWrite || fexist(privateIniPath.c_str()))
{
return privateIniPath;
}
return iniPath;
}
/* 共有データのロード */
bool CShareData_IO::LoadShareData()
{
return ShareData_IO_2( true );
}
/* 共有データの保存 */
void CShareData_IO::SaveShareData()
{
ShareData_IO_2( false );
}
/*!
共有データの読み込み/保存 2
@param[in] bRead true: 読み込み / false: 書き込み
@return 設定データの読み込み/保存が成功したかどうか
@date 2004-01-11 D.S.Koba CProfile変更によるコード簡略化
@date 2005-04-05 D.S.Koba 各セクションの入出力を関数として分離
*/
bool CShareData_IO::ShareData_IO_2( bool bRead )
{
//MY_RUNNINGTIMER( cRunningTimer, "CShareData_IO::ShareData_IO_2" );
CShareData* pcShare = CShareData::getInstance();
CDataProfile cProfile;
// Feb. 12, 2006 D.S.Koba
if( bRead ){
cProfile.SetReadingMode();
} else {
cProfile.SetWritingMode();
}
WCHAR szIniFileName[_MAX_PATH + 1];
const auto iniPath = GetIniFileNameForIO(!bRead);
::wcsncpy_s(szIniFileName, iniPath.c_str(), _TRUNCATE);
// MYTRACE( L"Iniファイル処理-1 所要時間(ミリ秒) = %d\n", cRunningTimer.Read() );
if( bRead ){
if( !cProfile.ReadProfile( szIniFileName ) ){
/* 設定ファイルが存在しない */
LANGID langId = GetUserDefaultUILanguage();
// Windowsの表示言語が日本語でない場合は言語設定を英語にする
if (langId != MAKELANGID( LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN )) {
DLLSHAREDATA* pShareData = &GetDllShareData();
wcscpy(pShareData->m_Common.m_sWindow.m_szLanguageDll, L"sakura_lang_en_US.dll");
cProfile.IOProfileData(L"Common", L"szLanguageDll", StringBufferW(pShareData->m_Common.m_sWindow.m_szLanguageDll));
std::vector<std::wstring> values;
pcShare->ConvertLangValues( values, true );
CSelectLang::ChangeLang( pShareData->m_Common.m_sWindow.m_szLanguageDll );
pcShare->ConvertLangValues( values, false );
pcShare->RefreshString();
}
return false;
}
// バージョンアップ時はバックアップファイルを作成する // 2011.01.28 ryoji
WCHAR iniVer[256];
DWORD mH, mL, lH, lL;
mH = mL = lH = lL = 0; // ※ 古~い ini だと "szVersion" は無い
if( cProfile.IOProfileData(LTEXT("Other"), L"szVersion", StringBufferW(iniVer)) )
_stscanf( iniVer, L"%u.%u.%u.%u", &mH, &mL, &lH, &lL );
DWORD dwMS = (DWORD)MAKELONG(mL, mH);
DWORD dwLS = (DWORD)MAKELONG(lL, lH);
DLLSHAREDATA* pShareData = &GetDllShareData();
if( pShareData->m_sVersion.m_dwProductVersionMS > dwMS
|| (pShareData->m_sVersion.m_dwProductVersionMS == dwMS && pShareData->m_sVersion.m_dwProductVersionLS > dwLS) )
{
WCHAR szBkFileName[_countof(szIniFileName) + 4];
::lstrcpy(szBkFileName, szIniFileName);
::lstrcat(szBkFileName, L".bak");
::CopyFile(szIniFileName, szBkFileName, FALSE);
}
}
// MYTRACE( L"Iniファイル処理 0 所要時間(ミリ秒) = %d\n", cRunningTimer.Read() );
CMenuDrawer* pcMenuDrawer = new CMenuDrawer; // 2010/7/4 Uchi
if( bRead ){
DLLSHAREDATA* pShareData = &GetDllShareData();
cProfile.IOProfileData(L"Common", L"szLanguageDll", StringBufferW(pShareData->m_Common.m_sWindow.m_szLanguageDll));
CSelectLang::ChangeLang( pShareData->m_Common.m_sWindow.m_szLanguageDll );
pcShare->RefreshString();
}
// Feb. 12, 2006 D.S.Koba
ShareData_IO_Mru( cProfile );
ShareData_IO_Keys( cProfile );
ShareData_IO_Grep( cProfile );
ShareData_IO_Folders( cProfile );
ShareData_IO_Cmd( cProfile );
ShareData_IO_Nickname( cProfile );
ShareData_IO_Common( cProfile );
ShareData_IO_Plugin( cProfile, pcMenuDrawer ); // Move here 2010/6/24 Uchi
ShareData_IO_Toolbar( cProfile, pcMenuDrawer );
ShareData_IO_CustMenu( cProfile );
ShareData_IO_Font( cProfile );
ShareData_IO_KeyBind( cProfile );
ShareData_IO_Print( cProfile );
ShareData_IO_Types( cProfile );
ShareData_IO_KeyWords( cProfile );
ShareData_IO_Macro( cProfile );
ShareData_IO_Statusbar( cProfile ); // 2008/6/21 Uchi
ShareData_IO_MainMenu( cProfile ); // 2010/5/15 Uchi
ShareData_IO_Other( cProfile );
delete pcMenuDrawer; // 2010/7/4 Uchi
pcMenuDrawer = NULL;
if( !bRead ){
// 2014.12.08 sakura.iniの読み取り専用
if( !GetDllShareData().m_Common.m_sOthers.m_bIniReadOnly ){
cProfile.WriteProfile( szIniFileName, LTEXT(" sakura.ini テキストエディタ設定ファイル") );
}
}
// MYTRACE( L"Iniファイル処理 8 所要時間(ミリ秒) = %d\n", cRunningTimer.Read() );
// MYTRACE( L"Iniファイル処理 所要時間(ミリ秒) = %d\n", cRunningTimerStart.Read() );
return true;
}
/*!
@brief 共有データのMruセクションの入出力
@param[in,out] cProfile INIファイル入出力クラス
@date 2005-04-07 D.S.Koba ShareData_IO_2から分離。読み込み時の初期化を修正
*/
void CShareData_IO::ShareData_IO_Mru( CDataProfile& cProfile )
{
DLLSHAREDATA* pShare = &GetDllShareData();
const WCHAR* pszSecName = LTEXT("MRU");
int i;
int nSize;
EditInfo* pfiWork;
WCHAR szKeyName[64];
cProfile.IOProfileData( pszSecName, LTEXT("_MRU_Counts"), pShare->m_sHistory.m_nMRUArrNum );
SetValueLimit( pShare->m_sHistory.m_nMRUArrNum, MAX_MRU );
nSize = pShare->m_sHistory.m_nMRUArrNum;
for( i = 0; i < nSize; ++i ){
pfiWork = &pShare->m_sHistory.m_fiMRUArr[i];
if( cProfile.IsReadingMode() ){
pfiWork->m_nTypeId = -1;
}
auto_sprintf( szKeyName, LTEXT("MRU[%02d].nViewTopLine"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pfiWork->m_nViewTopLine );
auto_sprintf( szKeyName, LTEXT("MRU[%02d].nViewLeftCol"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pfiWork->m_nViewLeftCol );
auto_sprintf( szKeyName, LTEXT("MRU[%02d].nX"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pfiWork->m_ptCursor.x );
auto_sprintf( szKeyName, LTEXT("MRU[%02d].nY"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pfiWork->m_ptCursor.y );
auto_sprintf( szKeyName, LTEXT("MRU[%02d].nCharCode"), i );
cProfile.IOProfileData(pszSecName, szKeyName, pfiWork->m_nCharCode);
auto_sprintf( szKeyName, LTEXT("MRU[%02d].szPath"), i );
cProfile.IOProfileData(pszSecName, szKeyName, StringBufferW(pfiWork->m_szPath));
auto_sprintf( szKeyName, LTEXT("MRU[%02d].szMark2"), i );
if( !cProfile.IOProfileData(pszSecName, szKeyName, StringBufferW(pfiWork->m_szMarkLines)) ){
if( cProfile.IsReadingMode() ){
auto_sprintf( szKeyName, LTEXT("MRU[%02d].szMark"), i ); // 旧ver互換
cProfile.IOProfileData(pszSecName, szKeyName, StringBufferW(pfiWork->m_szMarkLines));
}
}
auto_sprintf( szKeyName, LTEXT("MRU[%02d].nType"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pfiWork->m_nTypeId );
//お気に入り //@@@ 2003.04.08 MIK
auto_sprintf( szKeyName, LTEXT("MRU[%02d].bFavorite"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sHistory.m_bMRUArrFavorite[i] );
}
//@@@ 2001.12.26 YAZAKI 残りのm_fiMRUArrを初期化。
if ( cProfile.IsReadingMode() ){
EditInfo fiInit;
// 残りをfiInitで初期化しておく。
fiInit.m_nCharCode = CODE_DEFAULT;
fiInit.m_nViewLeftCol = CLayoutInt(0);
fiInit.m_nViewTopLine = CLayoutInt(0);
fiInit.m_ptCursor.Set(CLogicInt(0), CLogicInt(0));
fiInit.m_szPath[0] = L'\0';
fiInit.m_szMarkLines[0] = L'\0'; // 2002.01.16 hor
for( ; i < MAX_MRU; ++i){
pShare->m_sHistory.m_fiMRUArr[i] = fiInit;
pShare->m_sHistory.m_bMRUArrFavorite[i] = false; //お気に入り //@@@ 2003.04.08 MIK
}
}
cProfile.IOProfileData( pszSecName, LTEXT("_MRUFOLDER_Counts"), pShare->m_sHistory.m_nOPENFOLDERArrNum );
SetValueLimit( pShare->m_sHistory.m_nOPENFOLDERArrNum, MAX_OPENFOLDER );
nSize = pShare->m_sHistory.m_nOPENFOLDERArrNum;
for( i = 0; i < nSize; ++i ){
auto_sprintf( szKeyName, LTEXT("MRUFOLDER[%02d]"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sHistory.m_szOPENFOLDERArr[i] );
//お気に入り //@@@ 2003.04.08 MIK
wcscat( szKeyName, LTEXT(".bFavorite") );
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sHistory.m_bOPENFOLDERArrFavorite[i] );
}
//読み込み時は残りを初期化
if ( cProfile.IsReadingMode() ){
for (; i< MAX_OPENFOLDER; ++i){
// 2005.04.05 D.S.Koba
pShare->m_sHistory.m_szOPENFOLDERArr[i][0] = L'\0';
pShare->m_sHistory.m_bOPENFOLDERArrFavorite[i] = false; //お気に入り //@@@ 2003.04.08 MIK
}
}
cProfile.IOProfileData( pszSecName, LTEXT("_ExceptMRU_Counts"), pShare->m_sHistory.m_aExceptMRU._GetSizeRef() );
pShare->m_sHistory.m_aExceptMRU.SetSizeLimit();
nSize = pShare->m_sHistory.m_aExceptMRU.size();
for( i = 0; i < nSize; ++i ){
auto_sprintf( szKeyName, LTEXT("ExceptMRU[%02d]"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sHistory.m_aExceptMRU[i] );
}
}
/*!
@brief 共有データのKeysセクションの入出力
@param[in,out] cProfile INIファイル入出力クラス
@date 2005-04-07 D.S.Koba ShareData_IO_2から分離。読み込み時の初期化を修正
*/
void CShareData_IO::ShareData_IO_Keys( CDataProfile& cProfile )
{
DLLSHAREDATA* pShare = &GetDllShareData();
const WCHAR* pszSecName = LTEXT("Keys");
int i;
int nSize;
WCHAR szKeyName[64];
cProfile.IOProfileData( pszSecName, LTEXT("_SEARCHKEY_Counts"), pShare->m_sSearchKeywords.m_aSearchKeys._GetSizeRef() );
pShare->m_sSearchKeywords.m_aSearchKeys.SetSizeLimit();
nSize = pShare->m_sSearchKeywords.m_aSearchKeys.size();
for( i = 0; i < nSize; ++i ){
auto_sprintf( szKeyName, LTEXT("SEARCHKEY[%02d]"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aSearchKeys[i] );
if( cProfile.IsReadingMode() || pShare->m_sSearchKeywords.m_aSearchKeysFav[i] ){
auto_sprintf( szKeyName, LTEXT("SEARCHKEY[%02d].Fav"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aSearchKeysFav[i] );
}
}
cProfile.IOProfileData( pszSecName, LTEXT("_REPLACEKEY_Counts"), pShare->m_sSearchKeywords.m_aReplaceKeys._GetSizeRef() );
pShare->m_sSearchKeywords.m_aReplaceKeys.SetSizeLimit();
nSize = pShare->m_sSearchKeywords.m_aReplaceKeys.size();
for( i = 0; i < nSize; ++i ){
auto_sprintf( szKeyName, LTEXT("REPLACEKEY[%02d]"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aReplaceKeys[i] );
if( cProfile.IsReadingMode() || pShare->m_sSearchKeywords.m_aReplaceKeysFav[i] ){
auto_sprintf( szKeyName, LTEXT("REPLACEKEY[%02d].Fav"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aReplaceKeysFav[i] );
}
}
}
/*!
@brief 共有データのGrepセクションの入出力
@param[in,out] cProfile INIファイル入出力クラス
@date 2005-04-07 D.S.Koba ShareData_IO_2から分離。読み込み時の初期化を修正
*/
void CShareData_IO::ShareData_IO_Grep( CDataProfile& cProfile )
{
DLLSHAREDATA* pShare = &GetDllShareData();
const WCHAR* pszSecName = LTEXT("Grep");
int i;
int nSize;
WCHAR szKeyName[64];
cProfile.IOProfileData( pszSecName, LTEXT("_GREPFILE_Counts"), pShare->m_sSearchKeywords.m_aGrepFiles._GetSizeRef() );
pShare->m_sSearchKeywords.m_aGrepFiles.SetSizeLimit();
nSize = pShare->m_sSearchKeywords.m_aGrepFiles.size();
for( i = 0; i < nSize; ++i ){
auto_sprintf( szKeyName, LTEXT("GREPFILE[%02d]"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aGrepFiles[i] );
if( cProfile.IsReadingMode() || pShare->m_sSearchKeywords.m_aGrepFilesFav[i] ){
auto_sprintf( szKeyName, LTEXT("GREPFILE[%02d].Fav"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aGrepFilesFav[i] );
}
}
cProfile.IOProfileData( pszSecName, LTEXT("_GREPFOLDER_Counts"), pShare->m_sSearchKeywords.m_aGrepFolders._GetSizeRef() );
pShare->m_sSearchKeywords.m_aGrepFolders.SetSizeLimit();
nSize = pShare->m_sSearchKeywords.m_aGrepFolders.size();
for( i = 0; i < nSize; ++i ){
auto_sprintf( szKeyName, LTEXT("GREPFOLDER[%02d]"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aGrepFolders[i] );
if( cProfile.IsReadingMode() || pShare->m_sSearchKeywords.m_aGrepFoldersFav[i] ){
auto_sprintf( szKeyName, LTEXT("GREPFOLDER[%02d].Fav"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aGrepFoldersFav[i] );
}
}
/* 除外ファイルパターン */
cProfile.IOProfileData(pszSecName, LTEXT("_GREPEXCLUDEFILE_Counts"), pShare->m_sSearchKeywords.m_aExcludeFiles._GetSizeRef());
pShare->m_sSearchKeywords.m_aExcludeFiles.SetSizeLimit();
nSize = pShare->m_sSearchKeywords.m_aExcludeFiles.size();
for (i = 0; i < nSize; ++i) {
auto_sprintf(szKeyName, LTEXT("GREPEXCLUDEFILE[%02d]"), i);
cProfile.IOProfileData(pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aExcludeFiles[i]);
}
/* 除外フォルダーパターン */
cProfile.IOProfileData(pszSecName, LTEXT("_GREPEXCLUDEFOLDER_Counts"), pShare->m_sSearchKeywords.m_aExcludeFolders._GetSizeRef());
pShare->m_sSearchKeywords.m_aExcludeFolders.SetSizeLimit();
nSize = pShare->m_sSearchKeywords.m_aExcludeFolders.size();
for (i = 0; i < nSize; ++i) {
auto_sprintf(szKeyName, LTEXT("GREPEXCLUDEFOLDER[%02d]"), i);
cProfile.IOProfileData(pszSecName, szKeyName, pShare->m_sSearchKeywords.m_aExcludeFolders[i]);
}
}
/*!
@brief 共有データのFoldersセクションの入出力
@param[in,out] cProfile INIファイル入出力クラス
@date 2005-04-07 D.S.Koba ShareData_IO_2から分離。
*/
void CShareData_IO::ShareData_IO_Folders( CDataProfile& cProfile )
{
DLLSHAREDATA* pShare = &GetDllShareData();
const WCHAR* pszSecName = LTEXT("Folders");
/* マクロ用フォルダー */
cProfile.IOProfileData( pszSecName, LTEXT("szMACROFOLDER"), pShare->m_Common.m_sMacro.m_szMACROFOLDER );
/* 設定インポート用フォルダー */
cProfile.IOProfileData( pszSecName, LTEXT("szIMPORTFOLDER"), pShare->m_sHistory.m_szIMPORTFOLDER );
}
/*!
@brief 共有データのCmdセクションの入出力
@param[in,out] cProfile INIファイル入出力クラス
@date 2005-04-07 D.S.Koba ShareData_IO_2から分離。読み込み時の初期化を修正
*/
void CShareData_IO::ShareData_IO_Cmd( CDataProfile& cProfile )
{
DLLSHAREDATA* pShare = &GetDllShareData();
const WCHAR* pszSecName = LTEXT("Cmd");
int i;
WCHAR szKeyName[64];
cProfile.IOProfileData( pszSecName, LTEXT("nCmdArrNum"), pShare->m_sHistory.m_aCommands._GetSizeRef() );
pShare->m_sHistory.m_aCommands.SetSizeLimit();
int nSize = pShare->m_sHistory.m_aCommands.size();
for( i = 0; i < nSize; ++i ){
auto_sprintf( szKeyName, LTEXT("szCmdArr[%02d]"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sHistory.m_aCommands[i] );
if( cProfile.IsReadingMode() || pShare->m_sHistory.m_aCommandsFav[i] ){
auto_sprintf( szKeyName, LTEXT("szCmdArr[%02d].Fav"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sHistory.m_aCommandsFav[i] );
}
}
cProfile.IOProfileData( pszSecName, LTEXT("nCurDirArrNum"), pShare->m_sHistory.m_aCurDirs._GetSizeRef() );
pShare->m_sHistory.m_aCurDirs.SetSizeLimit();
nSize = pShare->m_sHistory.m_aCurDirs.size();
for( i = 0; i < nSize; ++i ){
auto_sprintf( szKeyName, LTEXT("szCurDirArr[%02d]"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sHistory.m_aCurDirs[i] );
if( cProfile.IsReadingMode() || pShare->m_sHistory.m_aCurDirsFav[i] ){
auto_sprintf( szKeyName, LTEXT("szCurDirArr[%02d].Fav"), i );
cProfile.IOProfileData( pszSecName, szKeyName, pShare->m_sHistory.m_aCurDirsFav[i] );
}
}
}
/*!
@brief 共有データのNicknameセクションの入出力
@param[in,out] cProfile INIファイル入出力クラス
@date 2005-04-07 D.S.Koba ShareData_IO_2から分離。読み込み時の初期化を修正
*/
void CShareData_IO::ShareData_IO_Nickname( CDataProfile& cProfile )
{
DLLSHAREDATA* pShare = &GetDllShareData();
const WCHAR* pszSecName = LTEXT("Nickname");
int i;
WCHAR szKeyName[64];
cProfile.IOProfileData( pszSecName, LTEXT("bShortPath"), pShare->m_Common.m_sFileName.m_bTransformShortPath );
cProfile.IOProfileData( pszSecName, LTEXT("nShortPathMaxWidth"), pShare->m_Common.m_sFileName.m_nTransformShortMaxWidth );
cProfile.IOProfileData( pszSecName, LTEXT("ArrNum"), pShare->m_Common.m_sFileName.m_nTransformFileNameArrNum );
SetValueLimit( pShare->m_Common.m_sFileName.m_nTransformFileNameArrNum, MAX_TRANSFORM_FILENAME );
int nSize = pShare->m_Common.m_sFileName.m_nTransformFileNameArrNum;
for( i = 0; i < nSize; ++i ){
auto_sprintf( szKeyName, LTEXT("From%02d"), i );
cProfile.IOProfileData(pszSecName, szKeyName, StringBufferW(pShare->m_Common.m_sFileName.m_szTransformFileNameFrom[i]));
auto_sprintf( szKeyName, LTEXT("To%02d"), i );
cProfile.IOProfileData(pszSecName, szKeyName, StringBufferW(pShare->m_Common.m_sFileName.m_szTransformFileNameTo[i]));
}
// 読み込み時,残りをNULLで再初期化
if( cProfile.IsReadingMode() ){
for( ; i < MAX_TRANSFORM_FILENAME; i++ ){
pShare->m_Common.m_sFileName.m_szTransformFileNameFrom[i][0] = L'\0';
pShare->m_Common.m_sFileName.m_szTransformFileNameTo[i][0] = L'\0';
}
}
}
static bool ShareData_IO_RECT( CDataProfile& cProfile, const WCHAR* pszSecName, const WCHAR* pszKeyName, RECT& rcValue )
{
const WCHAR* pszForm = LTEXT("%d,%d,%d,%d");
WCHAR szKeyData[100];
bool ret = false;
if( cProfile.IsReadingMode() ){
ret = cProfile.IOProfileData(pszSecName, pszKeyName, StringBufferW(szKeyData));
if( ret ){
int buf[4];
scan_ints( szKeyData, pszForm, buf );
rcValue.left = buf[0];
rcValue.top = buf[1];
rcValue.right = buf[2];
rcValue.bottom = buf[3];
}
}else{
auto_sprintf(
szKeyData,
pszForm,
rcValue.left,
rcValue.top,
rcValue.right,
rcValue.bottom
);
ret = cProfile.IOProfileData(pszSecName, pszKeyName, StringBufferW(szKeyData));
}
return ret;
}
/*!
@brief 共有データのCommonセクションの入出力
@param[in,out] cProfile INIファイル入出力クラス
@date 2005-04-07 D.S.Koba ShareData_IO_2から分離。
*/
void CShareData_IO::ShareData_IO_Common( CDataProfile& cProfile )
{
DLLSHAREDATA* pShare = &GetDllShareData();
const WCHAR* pszSecName = LTEXT("Common");
// 2005.04.07 D.S.Koba
CommonSetting& common = pShare->m_Common;
cProfile.IOProfileData( pszSecName, LTEXT("nCaretType") , common.m_sGeneral.m_nCaretType );
// Oct. 2, 2005 genta
// 初期値を挿入モードに固定するため,設定の読み書きをやめる
//cProfile.IOProfileData( pszSecName, LTEXT("bIsINSMode") , common.m_bIsINSMode );
cProfile.IOProfileData( pszSecName, LTEXT("bIsFreeCursorMode") , common.m_sGeneral.m_bIsFreeCursorMode );
cProfile.IOProfileData( pszSecName, LTEXT("bStopsBothEndsWhenSearchWord") , common.m_sGeneral.m_bStopsBothEndsWhenSearchWord );
cProfile.IOProfileData( pszSecName, LTEXT("bStopsBothEndsWhenSearchParagraph") , common.m_sGeneral.m_bStopsBothEndsWhenSearchParagraph );
// Oct. 27, 2000 genta
cProfile.IOProfileData( pszSecName, LTEXT("m_bRestoreCurPosition") , common.m_sFile.m_bRestoreCurPosition );
// 2002.01.16 hor
cProfile.IOProfileData( pszSecName, LTEXT("m_bRestoreBookmarks") , common.m_sFile.m_bRestoreBookmarks );
cProfile.IOProfileData( pszSecName, LTEXT("bAddCRLFWhenCopy") , common.m_sEdit.m_bAddCRLFWhenCopy );
cProfile.IOProfileData(pszSecName, L"eOpenDialogDir", common.m_sEdit.m_eOpenDialogDir );
cProfile.IOProfileData(pszSecName, L"szOpenDialogSelDir", common.m_sEdit.m_OpenDialogSelDir);
cProfile.IOProfileData( pszSecName, LTEXT("bBoxSelectLock") , common.m_sEdit.m_bBoxSelectLock );
cProfile.IOProfileData( pszSecName, LTEXT("bVistaStyleFileDialog") , common.m_sEdit.m_bVistaStyleFileDialog );
cProfile.IOProfileData( pszSecName, LTEXT("nRepeatedScrollLineNum") , common.m_sGeneral.m_nRepeatedScrollLineNum );
cProfile.IOProfileData( pszSecName, LTEXT("nRepeatedMoveCaretNum") , common.m_sGeneral.m_nRepeatedMoveCaretNum );
cProfile.IOProfileData( pszSecName, LTEXT("nRepeatedScroll_Smooth") , common.m_sGeneral.m_nRepeatedScroll_Smooth );
cProfile.IOProfileData( pszSecName, LTEXT("nPageScrollByWheel") , common.m_sGeneral.m_nPageScrollByWheel ); // 2009.01.17 nasukoji
cProfile.IOProfileData( pszSecName, LTEXT("nHorizontalScrollByWheel") , common.m_sGeneral.m_nHorizontalScrollByWheel ); // 2009.01.17 nasukoji
cProfile.IOProfileData( pszSecName, LTEXT("bCloseAllConfirm") , common.m_sGeneral.m_bCloseAllConfirm ); /* [すべて閉じる]で他に編集用のウィンドウがあれば確認する */ // 2006.12.25 ryoji
cProfile.IOProfileData( pszSecName, LTEXT("bExitConfirm") , common.m_sGeneral.m_bExitConfirm );
cProfile.IOProfileData( pszSecName, LTEXT("bSearchRegularExp") , common.m_sSearch.m_sSearchOption.bRegularExp );
cProfile.IOProfileData( pszSecName, LTEXT("bSearchLoHiCase") , common.m_sSearch.m_sSearchOption.bLoHiCase );
cProfile.IOProfileData( pszSecName, LTEXT("bSearchWordOnly") , common.m_sSearch.m_sSearchOption.bWordOnly );
cProfile.IOProfileData( pszSecName, LTEXT("bSearchConsecutiveAll") , common.m_sSearch.m_bConsecutiveAll ); // 2007.01.16 ryoji
cProfile.IOProfileData( pszSecName, LTEXT("bSearchNOTIFYNOTFOUND") , common.m_sSearch.m_bNOTIFYNOTFOUND );
// 2002.01.26 hor
cProfile.IOProfileData( pszSecName, LTEXT("bSearchAll") , common.m_sSearch.m_bSearchAll );
cProfile.IOProfileData( pszSecName, LTEXT("bSearchSelectedArea") , common.m_sSearch.m_bSelectedArea );
cProfile.IOProfileData( pszSecName, LTEXT("bGrepSubFolder") , common.m_sSearch.m_bGrepSubFolder );
cProfile.IOProfileData( pszSecName, LTEXT("bGrepOutputLine") , common.m_sSearch.m_nGrepOutputLineType );
cProfile.IOProfileData( pszSecName, LTEXT("nGrepOutputStyle") , common.m_sSearch.m_nGrepOutputStyle );
cProfile.IOProfileData( pszSecName, LTEXT("bGrepOutputFileOnly") , common.m_sSearch.m_bGrepOutputFileOnly );
cProfile.IOProfileData( pszSecName, LTEXT("bGrepOutputBaseFolder") , common.m_sSearch.m_bGrepOutputBaseFolder );
cProfile.IOProfileData( pszSecName, LTEXT("bGrepSeparateFolder") , common.m_sSearch.m_bGrepSeparateFolder );
cProfile.IOProfileData( pszSecName, LTEXT("bGrepDefaultFolder") , common.m_sSearch.m_bGrepDefaultFolder );
cProfile.IOProfileData( pszSecName, LTEXT("bGrepBackup") , common.m_sSearch.m_bGrepBackup );
// 2002/09/21 Moca 追加
cProfile.IOProfileData(pszSecName, L"nGrepCharSet", common.m_sSearch.m_nGrepCharSet );
cProfile.IOProfileData( pszSecName, LTEXT("bGrepRealTime") , common.m_sSearch.m_bGrepRealTimeView ); // 2003.06.16 Moca
cProfile.IOProfileData( pszSecName, LTEXT("bCaretTextForSearch") , common.m_sSearch.m_bCaretTextForSearch ); // 2006.08.23 ryoji カーソル位置の文字列をデフォルトの検索文字列にする
cProfile.IOProfileData( pszSecName, LTEXT("m_bInheritKeyOtherView") , common.m_sSearch.m_bInheritKeyOtherView );
cProfile.IOProfileData( pszSecName, LTEXT("nTagJumpMode") , common.m_sSearch.m_nTagJumpMode );
cProfile.IOProfileData( pszSecName, LTEXT("nTagJumpModeKeyword") , common.m_sSearch.m_nTagJumpModeKeyword );
/* 正規表現DLL 2007.08.12 genta */
cProfile.IOProfileData(pszSecName, L"szRegexpLib", StringBufferW(common.m_sSearch.m_szRegexpLib));
cProfile.IOProfileData( pszSecName, LTEXT("bGTJW_RETURN") , common.m_sSearch.m_bGTJW_RETURN );
cProfile.IOProfileData( pszSecName, LTEXT("bGTJW_LDBLCLK") , common.m_sSearch.m_bGTJW_LDBLCLK );
cProfile.IOProfileData( pszSecName, LTEXT("bBackUp") , common.m_sBackup.m_bBackUp );
cProfile.IOProfileData( pszSecName, LTEXT("bBackUpDialog") , common.m_sBackup.m_bBackUpDialog );
cProfile.IOProfileData( pszSecName, LTEXT("bBackUpFolder") , common.m_sBackup.m_bBackUpFolder );
cProfile.IOProfileData( pszSecName, LTEXT("bBackUpFolderRM") , common.m_sBackup.m_bBackUpFolderRM ); // 2010/5/27 Uchi
if( !cProfile.IsReadingMode() ){
int nDummy;
int nCharChars;
nDummy = wcslen( common.m_sBackup.m_szBackUpFolder );
/* フォルダーの最後が「半角かつ'\\'」でない場合は、付加する */
nCharChars = &common.m_sBackup.m_szBackUpFolder[nDummy]
- CNativeW::GetCharPrev( common.m_sBackup.m_szBackUpFolder, nDummy, &common.m_sBackup.m_szBackUpFolder[nDummy] );
if( 1 == nCharChars && common.m_sBackup.m_szBackUpFolder[nDummy - 1] == '\\' ){
}else{
wcscat( common.m_sBackup.m_szBackUpFolder, L"\\" );
}
}
cProfile.IOProfileData( pszSecName, LTEXT("szBackUpFolder"), common.m_sBackup.m_szBackUpFolder );
if( cProfile.IsReadingMode() ){
int nDummy;
int nCharChars;
nDummy = wcslen( common.m_sBackup.m_szBackUpFolder );
/* フォルダーの最後が「半角かつ'\\'」でない場合は、付加する */
nCharChars = &common.m_sBackup.m_szBackUpFolder[nDummy]
- CNativeW::GetCharPrev( common.m_sBackup.m_szBackUpFolder, nDummy, &common.m_sBackup.m_szBackUpFolder[nDummy] );
if( 1 == nCharChars && common.m_sBackup.m_szBackUpFolder[nDummy - 1] == '\\' ){
}else{
wcscat( common.m_sBackup.m_szBackUpFolder, L"\\" );
}
}
cProfile.IOProfileData( pszSecName, LTEXT("nBackUpType") , common.m_sBackup.m_nBackUpType );
cProfile.IOProfileData( pszSecName, LTEXT("bBackUpType2_Opt1") , common.m_sBackup.m_nBackUpType_Opt1 );
cProfile.IOProfileData( pszSecName, LTEXT("bBackUpType2_Opt2") , common.m_sBackup.m_nBackUpType_Opt2 );
cProfile.IOProfileData( pszSecName, LTEXT("bBackUpType2_Opt3") , common.m_sBackup.m_nBackUpType_Opt3 );
cProfile.IOProfileData( pszSecName, LTEXT("bBackUpType2_Opt4") , common.m_sBackup.m_nBackUpType_Opt4 );
cProfile.IOProfileData( pszSecName, LTEXT("bBackUpDustBox") , common.m_sBackup.m_bBackUpDustBox ); //@@@ 2001.12.11 add MIK
cProfile.IOProfileData( pszSecName, LTEXT("bBackUpPathAdvanced") , common.m_sBackup.m_bBackUpPathAdvanced ); /* 20051107 aroka */
cProfile.IOProfileData( pszSecName, LTEXT("szBackUpPathAdvanced") , common.m_sBackup.m_szBackUpPathAdvanced ); /* 20051107 aroka */
cProfile.IOProfileData(pszSecName, L"nFileShareMode", common.m_sFile.m_nFileShareMode );
cProfile.IOProfileData(pszSecName, L"szExtHelp", StringBufferW(common.m_sHelper.m_szExtHelp));
cProfile.IOProfileData(pszSecName, L"szExtHtmlHelp", StringBufferW(common.m_sHelper.m_szExtHtmlHelp));
cProfile.IOProfileData(pszSecName, L"szMigemoDll", StringBufferW(common.m_sHelper.m_szMigemoDll));
cProfile.IOProfileData(pszSecName, L"szMigemoDict", StringBufferW(common.m_sHelper.m_szMigemoDict));
// ai 02/05/23 Add S
{// Keword Help Font
ShareData_IO_Sub_LogFont( cProfile, pszSecName, L"khlf", L"khps", L"khlfFaceName",
common.m_sHelper.m_lf, common.m_sHelper.m_nPointSize );
}// Keword Help Font
cProfile.IOProfileData( pszSecName, LTEXT("nMRUArrNum_MAX") , common.m_sGeneral.m_nMRUArrNum_MAX );
SetValueLimit( common.m_sGeneral.m_nMRUArrNum_MAX, MAX_MRU );
cProfile.IOProfileData( pszSecName, LTEXT("nOPENFOLDERArrNum_MAX") , common.m_sGeneral.m_nOPENFOLDERArrNum_MAX );
SetValueLimit( common.m_sGeneral.m_nOPENFOLDERArrNum_MAX, MAX_OPENFOLDER );
cProfile.IOProfileData( pszSecName, LTEXT("bDispTOOLBAR") , common.m_sWindow.m_bDispTOOLBAR );
cProfile.IOProfileData( pszSecName, LTEXT("bDispSTATUSBAR") , common.m_sWindow.m_bDispSTATUSBAR );
cProfile.IOProfileData( pszSecName, LTEXT("bDispFUNCKEYWND") , common.m_sWindow.m_bDispFUNCKEYWND );
cProfile.IOProfileData( pszSecName, LTEXT("bDispMiniMap") , common.m_sWindow.m_bDispMiniMap );
cProfile.IOProfileData( pszSecName, LTEXT("nFUNCKEYWND_Place") , common.m_sWindow.m_nFUNCKEYWND_Place );
cProfile.IOProfileData( pszSecName, LTEXT("nFUNCKEYWND_GroupNum") , common.m_sWindow.m_nFUNCKEYWND_GroupNum ); // 2002/11/04 Moca ファンクションキーのグループボタン数
cProfile.IOProfileData(pszSecName, L"szLanguageDll", StringBufferW(common.m_sWindow.m_szLanguageDll));
cProfile.IOProfileData( pszSecName, LTEXT("nMiniMapFontSize") , common.m_sWindow.m_nMiniMapFontSize );
cProfile.IOProfileData( pszSecName, LTEXT("nMiniMapQuality") , common.m_sWindow.m_nMiniMapQuality );
cProfile.IOProfileData( pszSecName, LTEXT("nMiniMapWidth") , common.m_sWindow.m_nMiniMapWidth );
cProfile.IOProfileData( pszSecName, LTEXT("bDispTabWnd") , common.m_sTabBar.m_bDispTabWnd ); //タブウインドウ //@@@ 2003.05.31 MIK
cProfile.IOProfileData( pszSecName, LTEXT("bDispTabWndMultiWin") , common.m_sTabBar.m_bDispTabWndMultiWin ); //タブウインドウ //@@@ 2003.05.31 MIK
cProfile.IOProfileData(pszSecName, L"szTabWndCaption", StringBufferW(common.m_sTabBar.m_szTabWndCaption)); //@@@ 2003.06.13 MIK
cProfile.IOProfileData( pszSecName, LTEXT("bSameTabWidth") , common.m_sTabBar.m_bSameTabWidth ); // 2006.01.28 ryoji タブを等幅にする
cProfile.IOProfileData( pszSecName, LTEXT("bDispTabIcon") , common.m_sTabBar.m_bDispTabIcon ); // 2006.01.28 ryoji タブにアイコンを表示する
cProfile.IOProfileData(pszSecName, L"bDispTabClose", common.m_sTabBar.m_bDispTabClose ); // 2012.04.14 syat
cProfile.IOProfileData( pszSecName, LTEXT("bSortTabList") , common.m_sTabBar.m_bSortTabList ); // 2006.05.10 ryoji タブ一覧をソートする
cProfile.IOProfileData( pszSecName, LTEXT("bTab_RetainEmptyWin") , common.m_sTabBar.m_bTab_RetainEmptyWin ); // 最後のファイルが閉じられたとき(無題)を残す // 2007.02.11 genta
cProfile.IOProfileData( pszSecName, LTEXT("bTab_CloseOneWin") , common.m_sTabBar.m_bTab_CloseOneWin ); // タブモードでもウィンドウの閉じるボタンで現在のファイルのみ閉じる // 2007.02.11 genta
cProfile.IOProfileData( pszSecName, LTEXT("bTab_ListFull") , common.m_sTabBar.m_bTab_ListFull ); // タブ一覧をフルパス表示する // 2007.02.28 ryoji
cProfile.IOProfileData( pszSecName, LTEXT("bChgWndByWheel") , common.m_sTabBar.m_bChgWndByWheel ); // 2006.03.26 ryoji マウスホイールでウィンドウ切り替え
cProfile.IOProfileData( pszSecName, LTEXT("bNewWindow") , common.m_sTabBar.m_bNewWindow ); // 外部から起動するときは新しいウインドウで開く
cProfile.IOProfileData( pszSecName, L"bTabMultiLine" , common.m_sTabBar.m_bTabMultiLine ); // タブ多段
cProfile.IOProfileData(pszSecName, L"eTabPosition", common.m_sTabBar.m_eTabPosition ); // タブ位置
ShareData_IO_Sub_LogFont( cProfile, pszSecName, L"lfTabFont", L"lfTabFontPs", L"lfTabFaceName",
common.m_sTabBar.m_lf, common.m_sTabBar.m_nPointSize );
cProfile.IOProfileData( pszSecName, LTEXT("nTabMaxWidth") , common.m_sTabBar.m_nTabMaxWidth );
cProfile.IOProfileData( pszSecName, LTEXT("nTabMinWidth") , common.m_sTabBar.m_nTabMinWidth );
cProfile.IOProfileData( pszSecName, LTEXT("nTabMinWidthOnMulti") , common.m_sTabBar.m_nTabMinWidthOnMulti );
// 2001/06/20 asa-o 分割ウィンドウのスクロールの同期をとる
cProfile.IOProfileData( pszSecName, LTEXT("bSplitterWndHScroll") , common.m_sWindow.m_bSplitterWndHScroll );
cProfile.IOProfileData( pszSecName, LTEXT("bSplitterWndVScroll") , common.m_sWindow.m_bSplitterWndVScroll );
cProfile.IOProfileData(pszSecName, L"szMidashiKigou", StringBufferW(common.m_sFormat.m_szMidashiKigou));
cProfile.IOProfileData(pszSecName, L"szInyouKigou", StringBufferW(common.m_sFormat.m_szInyouKigou));
// 2001/06/14 asa-o 補完とキーワードヘルプはタイプ別に移動したので削除:3行
// 2002/09/21 Moca bGrepKanjiCode_AutoDetect は bGrepCharSetに統合したので削除
// 2001/06/19 asa-o タイプ別に移動したので削除:1行
cProfile.IOProfileData(pszSecName, L"bSaveWindowSize", common.m_sWindow.m_eSaveWindowSize ); //#####フラグ名が激しくきもい
cProfile.IOProfileData( pszSecName, LTEXT("nWinSizeType") , common.m_sWindow.m_nWinSizeType );
cProfile.IOProfileData( pszSecName, LTEXT("nWinSizeCX") , common.m_sWindow.m_nWinSizeCX );
cProfile.IOProfileData( pszSecName, LTEXT("nWinSizeCY") , common.m_sWindow.m_nWinSizeCY );
// 2004.03.30 Moca *nWinPos*を追加
cProfile.IOProfileData(pszSecName, L"nSaveWindowPos", common.m_sWindow.m_eSaveWindowPos ); //#####フラグ名がきもい
cProfile.IOProfileData( pszSecName, LTEXT("nWinPosX") , common.m_sWindow.m_nWinPosX );
cProfile.IOProfileData( pszSecName, LTEXT("nWinPosY") , common.m_sWindow.m_nWinPosY );
cProfile.IOProfileData( pszSecName, LTEXT("bTaskTrayUse") , common.m_sGeneral.m_bUseTaskTray );
cProfile.IOProfileData( pszSecName, LTEXT("bTaskTrayStay") , common.m_sGeneral.m_bStayTaskTray );
cProfile.IOProfileData( pszSecName, LTEXT("wTrayMenuHotKeyCode") , common.m_sGeneral.m_wTrayMenuHotKeyCode );
cProfile.IOProfileData( pszSecName, LTEXT("wTrayMenuHotKeyMods") , common.m_sGeneral.m_wTrayMenuHotKeyMods );
cProfile.IOProfileData( pszSecName, LTEXT("bUseOLE_DragDrop") , common.m_sEdit.m_bUseOLE_DragDrop );
cProfile.IOProfileData( pszSecName, LTEXT("bUseOLE_DropSource") , common.m_sEdit.m_bUseOLE_DropSource );
cProfile.IOProfileData( pszSecName, LTEXT("bDispExitingDialog") , common.m_sGeneral.m_bDispExitingDialog );
cProfile.IOProfileData( pszSecName, LTEXT("bEnableUnmodifiedOverwrite") , common.m_sFile.m_bEnableUnmodifiedOverwrite );
cProfile.IOProfileData( pszSecName, LTEXT("bSelectClickedURL") , common.m_sEdit.m_bSelectClickedURL );
cProfile.IOProfileData( pszSecName, LTEXT("bGrepExitConfirm") , common.m_sSearch.m_bGrepExitConfirm );/* Grepモードで保存確認するか */
// cProfile.IOProfileData( pszSecName, LTEXT("bRulerDisp") , common.m_bRulerDisp );/* ルーラー表示 */
cProfile.IOProfileData( pszSecName, LTEXT("nRulerHeight") , common.m_sWindow.m_nRulerHeight );/* ルーラー高さ */
cProfile.IOProfileData( pszSecName, LTEXT("nRulerBottomSpace") , common.m_sWindow.m_nRulerBottomSpace );/* ルーラーとテキストの隙間 */
cProfile.IOProfileData( pszSecName, LTEXT("nRulerType") , common.m_sWindow.m_nRulerType );/* ルーラーのタイプ */
// Sep. 18, 2002 genta 追加
cProfile.IOProfileData( pszSecName, LTEXT("nLineNumberRightSpace") , common.m_sWindow.m_nLineNumRightSpace );/* 行番号の右側の隙間 */
cProfile.IOProfileData( pszSecName, LTEXT("nVertLineOffset") , common.m_sWindow.m_nVertLineOffset ); // 2005.11.10 Moca
cProfile.IOProfileData( pszSecName, LTEXT("bUseCompotibleBMP") , common.m_sWindow.m_bUseCompatibleBMP ); // 2007.09.09 Moca
cProfile.IOProfileData( pszSecName, LTEXT("bCopyAndDisablSelection") , common.m_sEdit.m_bCopyAndDisablSelection );/* コピーしたら選択解除 */
cProfile.IOProfileData( pszSecName, LTEXT("bEnableNoSelectCopy") , common.m_sEdit.m_bEnableNoSelectCopy );/* 選択なしでコピーを可能にする */ // 2007.11.18 ryoji
cProfile.IOProfileData( pszSecName, LTEXT("bEnableLineModePaste") , common.m_sEdit.m_bEnableLineModePaste );/* ラインモード貼り付けを可能にする */ // 2007.10.08 ryoji
cProfile.IOProfileData( pszSecName, LTEXT("bConvertEOLPaste") , common.m_sEdit.m_bConvertEOLPaste ); /* 改行コードを変換して貼り付ける */ // 2009.02.28 salarm
cProfile.IOProfileData( pszSecName, LTEXT("bEnableExtEol") , common.m_sEdit.m_bEnableExtEol );
cProfile.IOProfileData( pszSecName, LTEXT("bHtmlHelpIsSingle") , common.m_sHelper.m_bHtmlHelpIsSingle );/* HtmlHelpビューアはひとつ */
cProfile.IOProfileData( pszSecName, LTEXT("bCompareAndTileHorz") , common.m_sCompare.m_bCompareAndTileHorz );/* 文書比較後、左右に並べて表示 */ //Oct. 10, 2000 JEPRO チェックボックスをボタン化すればこの行は不要のはず
cProfile.IOProfileData( pszSecName, LTEXT("bDropFileAndClose") , common.m_sFile.m_bDropFileAndClose );/* ファイルをドロップしたときは閉じて開く */
cProfile.IOProfileData( pszSecName, LTEXT("nDropFileNumMax") , common.m_sFile.m_nDropFileNumMax );/* 一度にドロップ可能なファイル数 */
cProfile.IOProfileData( pszSecName, LTEXT("bCheckFileTimeStamp") , common.m_sFile.m_bCheckFileTimeStamp );/* 更新の監視 */
cProfile.IOProfileData( pszSecName, LTEXT("nAutoloadDelay") , common.m_sFile.m_nAutoloadDelay );/* 自動読込時遅延 */
cProfile.IOProfileData( pszSecName, LTEXT("bUneditableIfUnwritable") , common.m_sFile.m_bUneditableIfUnwritable );/* 上書き禁止検出時は編集禁止にする */
cProfile.IOProfileData( pszSecName, LTEXT("bNotOverWriteCRLF") , common.m_sEdit.m_bNotOverWriteCRLF );/* 改行は上書きしない */
cProfile.IOProfileData( pszSecName, LTEXT("bOverWriteFixMode") , common.m_sEdit.m_bOverWriteFixMode );// 文字幅に合わせてスペースを詰める
cProfile.IOProfileData( pszSecName, LTEXT("bOverWriteBoxDelete") , common.m_sEdit.m_bOverWriteBoxDelete );
cProfile.IOProfileData( pszSecName, LTEXT("bAutoCloseDlgFind") , common.m_sSearch.m_bAutoCloseDlgFind );/* 検索ダイアログを自動的に閉じる */
cProfile.IOProfileData( pszSecName, LTEXT("bAutoCloseDlgFuncList") , common.m_sOutline.m_bAutoCloseDlgFuncList );/* アウトライン ダイアログを自動的に閉じる */
cProfile.IOProfileData( pszSecName, LTEXT("bAutoCloseDlgReplace") , common.m_sSearch.m_bAutoCloseDlgReplace );/* 置換 ダイアログを自動的に閉じる */
cProfile.IOProfileData( pszSecName, LTEXT("bAutoColmnPaste") , common.m_sEdit.m_bAutoColumnPaste );/* 矩形コピーのテキストは常に矩形貼り付け */ // 2013.5.23 aroka iniファイルのtypo未修正
cProfile.IOProfileData( pszSecName, LTEXT("NoCaretMoveByActivation") , common.m_sGeneral.m_bNoCaretMoveByActivation );/* マウスクリックにてアクティベートされた時はカーソル位置を移動しない 2007.10.02 nasukoji (add by genta) */
cProfile.IOProfileData( pszSecName, LTEXT("bScrollBarHorz") , common.m_sWindow.m_bScrollBarHorz );/* 水平スクロールバーを使う */
cProfile.IOProfileData( pszSecName, LTEXT("bHokanKey_RETURN") , common.m_sHelper.m_bHokanKey_RETURN );/* VK_RETURN 補完決定キーが有効/無効 */
cProfile.IOProfileData( pszSecName, LTEXT("bHokanKey_TAB") , common.m_sHelper.m_bHokanKey_TAB );/* VK_TAB 補完決定キーが有効/無効 */
cProfile.IOProfileData( pszSecName, LTEXT("bHokanKey_RIGHT") , common.m_sHelper.m_bHokanKey_RIGHT );/* VK_RIGHT 補完決定キーが有効/無効 */
cProfile.IOProfileData( pszSecName, LTEXT("bHokanKey_SPACE") , common.m_sHelper.m_bHokanKey_SPACE );/* VK_SPACE 補完決定キーが有効/無効 */
cProfile.IOProfileData( pszSecName, LTEXT("nDateFormatType") , common.m_sFormat.m_nDateFormatType );/* 日付書式のタイプ */
cProfile.IOProfileData(pszSecName, L"szDateFormat", StringBufferW(common.m_sFormat.m_szDateFormat));//日付書式
cProfile.IOProfileData( pszSecName, LTEXT("nTimeFormatType") , common.m_sFormat.m_nTimeFormatType );/* 時刻書式のタイプ */
cProfile.IOProfileData(pszSecName, L"szTimeFormat", StringBufferW(common.m_sFormat.m_szTimeFormat));//時刻書式
cProfile.IOProfileData( pszSecName, LTEXT("bMenuIcon") , common.m_sWindow.m_bMenuIcon );//メニューにアイコンを表示する
cProfile.IOProfileData( pszSecName, LTEXT("bAutoMIMEdecode") , common.m_sFile.m_bAutoMIMEdecode );//ファイル読み込み時にMIMEのdecodeを行うか
cProfile.IOProfileData( pszSecName, LTEXT("bQueryIfCodeChange") , common.m_sFile.m_bQueryIfCodeChange );// Oct. 03, 2004 genta 前回と異なる文字コードのときに問い合わせを行うか
cProfile.IOProfileData( pszSecName, LTEXT("bAlertIfFileNotExist") , common.m_sFile.m_bAlertIfFileNotExist );// Oct. 09, 2004 genta 開こうとしたファイルが存在しないとき警告する
cProfile.IOProfileData( pszSecName, LTEXT("bNoFilterSaveNew") , common.m_sFile.m_bNoFilterSaveNew ); // 新規から保存時は全ファイル表示 // 2006.11.16 ryoji
cProfile.IOProfileData( pszSecName, LTEXT("bNoFilterSaveFile") , common.m_sFile.m_bNoFilterSaveFile ); // 新規以外から保存時は全ファイル表示 // 2006.11.16 ryoji
cProfile.IOProfileData( pszSecName, LTEXT("bAlertIfLargeFile") , common.m_sFile.m_bAlertIfLargeFile ); // 開こうとしたファイルが大きい場合に警告する
cProfile.IOProfileData( pszSecName, LTEXT("nAlertFileSize") , common.m_sFile.m_nAlertFileSize ); // 警告を開始するファイルサイズ(MB単位)
/* 「開く」ダイアログのサイズと位置 */
ShareData_IO_RECT( cProfile, pszSecName, LTEXT("rcOpenDialog"), common.m_sOthers.m_rcOpenDialog );
ShareData_IO_RECT( cProfile, pszSecName, LTEXT("rcCompareDialog"), common.m_sOthers.m_rcCompareDialog );
ShareData_IO_RECT( cProfile, pszSecName, LTEXT("rcDiffDialog"), common.m_sOthers.m_rcDiffDialog );
ShareData_IO_RECT( cProfile, pszSecName, LTEXT("rcFavoriteDialog"), common.m_sOthers.m_rcFavoriteDialog );
ShareData_IO_RECT( cProfile, pszSecName, LTEXT("rcTagJumpDialog"), common.m_sOthers.m_rcTagJumpDialog );
ShareData_IO_RECT( cProfile, pszSecName, LTEXT("rcWindowListDialog"), common.m_sOthers.m_rcWindowListDialog );
//2002.02.08 aroka,hor
cProfile.IOProfileData( pszSecName, LTEXT("bMarkUpBlankLineEnable") , common.m_sOutline.m_bMarkUpBlankLineEnable );
cProfile.IOProfileData( pszSecName, LTEXT("bFunclistSetFocusOnJump") , common.m_sOutline.m_bFunclistSetFocusOnJump );
// Apr. 05, 2003 genta ウィンドウキャプションのカスタマイズ
cProfile.IOProfileData(pszSecName, L"szWinCaptionActive", StringBufferW(common.m_sWindow.m_szWindowCaptionActive));
cProfile.IOProfileData(pszSecName, L"szWinCaptionInactive", StringBufferW(common.m_sWindow.m_szWindowCaptionInactive));
// アウトライン/トピックリスト の位置とサイズを記憶 20060201 aroka
cProfile.IOProfileData( pszSecName, LTEXT("bRememberOutlineWindowPos"), common.m_sOutline.m_bRememberOutlineWindowPos);
if( common.m_sOutline.m_bRememberOutlineWindowPos ){
cProfile.IOProfileData( pszSecName, LTEXT("widthOutlineWindow") , common.m_sOutline.m_widthOutlineWindow);
cProfile.IOProfileData( pszSecName, LTEXT("heightOutlineWindow"), common.m_sOutline.m_heightOutlineWindow);
cProfile.IOProfileData( pszSecName, LTEXT("xOutlineWindowPos") , common.m_sOutline.m_xOutlineWindowPos);
cProfile.IOProfileData( pszSecName, LTEXT("yOutlineWindowPos") , common.m_sOutline.m_yOutlineWindowPos);
}
cProfile.IOProfileData( pszSecName, LTEXT("nOutlineDockSet"), common.m_sOutline.m_nOutlineDockSet );
cProfile.IOProfileData( pszSecName, LTEXT("bOutlineDockSync"), common.m_sOutline.m_bOutlineDockSync );
cProfile.IOProfileData( pszSecName, LTEXT("bOutlineDockDisp"), common.m_sOutline.m_bOutlineDockDisp );
cProfile.IOProfileData(pszSecName, L"eOutlineDockSide", common.m_sOutline.m_eOutlineDockSide );
{
const WCHAR* pszKeyName = LTEXT("xyOutlineDock");
const WCHAR* pszForm = LTEXT("%d,%d,%d,%d");
WCHAR szKeyData[1024];
if( cProfile.IsReadingMode() ){
if( cProfile.IOProfileData(pszSecName, pszKeyName, StringBufferW(szKeyData)) ){
int buf[4];
scan_ints( szKeyData, pszForm, buf );
common.m_sOutline.m_cxOutlineDockLeft = buf[0];
common.m_sOutline.m_cyOutlineDockTop = buf[1];
common.m_sOutline.m_cxOutlineDockRight = buf[2];
common.m_sOutline.m_cyOutlineDockBottom = buf[3];
}
}else{
auto_sprintf(
szKeyData,
pszForm,
common.m_sOutline.m_cxOutlineDockLeft,
common.m_sOutline.m_cyOutlineDockTop,
common.m_sOutline.m_cxOutlineDockRight,
common.m_sOutline.m_cyOutlineDockBottom
);
cProfile.IOProfileData(pszSecName, pszKeyName, StringBufferW(szKeyData));
}
}
cProfile.IOProfileData( pszSecName, LTEXT("nDockOutline"), common.m_sOutline.m_nDockOutline );
ShareData_IO_FileTree( cProfile, common.m_sOutline.m_sFileTree, pszSecName );
cProfile.IOProfileData( pszSecName, LTEXT("szFileTreeDefIniName"), common.m_sOutline.m_sFileTreeDefIniName );
}
// プラグインコマンドを名前から機能番号へ変換
EFunctionCode GetPlugCmdInfoByName(
const WCHAR* pszFuncName //!< [in] プラグインコマンド名
)
{
CommonSetting_Plugin& plugin = GetDllShareData().m_Common.m_sPlugin;
WCHAR sPluginName[MAX_PLUGIN_ID+1];
const WCHAR* psCmdName;
size_t nLen;
int i;
int nId;
int nNo;
if (pszFuncName == NULL) {
return F_INVALID;
}
if ((psCmdName = wcschr(pszFuncName, L'/')) == NULL) {
return F_INVALID;
}
nLen = MAX_PLUGIN_ID < (psCmdName - pszFuncName) ? MAX_PLUGIN_ID : (psCmdName - pszFuncName);
wcsncpy( sPluginName, pszFuncName, nLen);
sPluginName[nLen] = L'\0';
psCmdName++;
nId = -1;
for (i = 0; i < MAX_PLUGIN; i++) {
PluginRec& pluginrec = plugin.m_PluginTable[i];
if (wcscmp( pluginrec.m_szId, sPluginName ) == 0) {
nId = i;
break;
}
}
nNo = _wtoi( psCmdName );
if (nId < 0 || nNo <= 0 || nNo >= MAX_PLUG_CMD) {
// プラグインがない/番号がおかしい
return F_INVALID;
}
return CPlug::GetPluginFunctionCode( nId, nNo );
}
// プラグインコマンドを機能番号から名前へ変換
bool GetPlugCmdInfoByFuncCode(
EFunctionCode eFuncCode, //!< [in] 機能コード
WCHAR* pszFuncName //!< [out] 機能名.この先にはMAX_PLUGIN_ID + 20文字のメモリが必要.
)
{
CommonSetting_Plugin& plugin = GetDllShareData().m_Common.m_sPlugin;
if (eFuncCode < F_PLUGCOMMAND_FIRST || eFuncCode > F_PLUGCOMMAND_LAST) {
return false;
}
PluginId nID = CPlug::GetPluginId( eFuncCode );
PlugId nNo = CPlug::GetPlugId( eFuncCode );
if (nID < 0 || nNo < 0) {
return false;
}
auto_sprintf(pszFuncName, L"%ls/%02d", plugin.m_PluginTable[nID].m_szId, nNo);
return true;
}
/*! プラグイン名or機能番号文字列をEFunctionCodeにする
@param[in] pszFuncName プラグイン名or機能番号文字列
@return 機能コード
*/
static EFunctionCode GetFunctionStrToFunctionCode(const WCHAR* pszFuncName)
{
EFunctionCode n;
if (pszFuncName == NULL) {
n = F_DEFAULT;
}else if (wcschr(pszFuncName, L'/') != NULL) {
// Plugin名
n = GetPlugCmdInfoByName(pszFuncName);
}else if (WCODE::Is09(pszFuncName[0])
&& (pszFuncName[1] == L'\0' || WCODE::Is09(pszFuncName[1]))) {
n = (EFunctionCode)_wtol(pszFuncName);
}else {
n = CSMacroMgr::GetFuncInfoByName(0, pszFuncName, NULL);
}
if (n == F_INVALID) {
n = F_DEFAULT;
}
return n;
}
/*!
@brief 共有データのToolbarセクションの入出力
@param[in] bRead true: 読み込み / false: 書き込み
@param[in,out] cProfile INIファイル入出力クラス
@date 2005-04-07 D.S.Koba ShareData_IO_2から分離。読み込み時の初期化を修正
*/
void CShareData_IO::ShareData_IO_Toolbar( CDataProfile& cProfile, CMenuDrawer* pcMenuDrawer )
{
DLLSHAREDATA* pShare = &GetDllShareData();
const WCHAR* pszSecName = LTEXT("Toolbar");
int i;
WCHAR szKeyName[64];
CommonSetting_ToolBar& toolbar = pShare->m_Common.m_sToolBar;
EFunctionCode eFunc;
WCHAR szText[MAX_PLUGIN_ID+20];
int nInvalid = -1;
cProfile.IOProfileData( pszSecName, LTEXT("bToolBarIsFlat"), toolbar.m_bToolBarIsFlat );
cProfile.IOProfileData( pszSecName, LTEXT("nToolBarButtonNum"), toolbar.m_nToolBarButtonNum );
SetValueLimit( toolbar.m_nToolBarButtonNum, MAX_TOOLBAR_BUTTON_ITEMS );
int nSize = toolbar.m_nToolBarButtonNum;
for( i = 0; i < nSize; ++i ){
auto_sprintf( szKeyName, LTEXT("nTBB[%03d]"), i );
// Plugin String Parametor
if( cProfile.IsReadingMode() ){
//読み込み
cProfile.IOProfileData(pszSecName, szKeyName, StringBufferW(szText));
if (wcschr(szText, L'/') == NULL) {
// 番号
toolbar.m_nToolBarButtonIdxArr[i] = _wtoi( szText );
}
else {
// Plugin
eFunc = GetPlugCmdInfoByName( szText );
if ( eFunc == F_INVALID ) {
toolbar.m_nToolBarButtonIdxArr[i] = -1; // 未解決
}
else {
toolbar.m_nToolBarButtonIdxArr[i] = pcMenuDrawer->FindToolbarNoFromCommandId( eFunc, false );
}
}
}
else {
//書き込み
if (toolbar.m_nToolBarButtonIdxArr[i] <= MAX_TOOLBAR_ICON_COUNT + 1) { // +1はセパレータ分
cProfile.IOProfileData( pszSecName, szKeyName, toolbar.m_nToolBarButtonIdxArr[i] );
}
else {
// Plugin
eFunc = (EFunctionCode)toolbar.m_nToolBarButtonIdxArr[i];
if (eFunc == F_DEFAULT) {
cProfile.IOProfileData( pszSecName, szKeyName, nInvalid );
}
else if (GetPlugCmdInfoByFuncCode( eFunc, szText )) {
cProfile.IOProfileData(pszSecName, szKeyName, StringBufferW(szText));
}
else {
cProfile.IOProfileData( pszSecName, szKeyName, toolbar.m_nToolBarButtonIdxArr[i] );
}
}
}
}
//読み込み時は残りを初期化
if( cProfile.IsReadingMode() ){
for(; i< MAX_TOOLBAR_BUTTON_ITEMS; ++i){
toolbar.m_nToolBarButtonIdxArr[i] = 0;
}
}
}
/*!
@brief 共有データのCustMenuセクションの入出力
@param[in,out] cProfile INIファイル入出力クラス
@date 2010.08.21 Moca 旧ShareData_IO_CustMenuをIO_CustMenuに変更
*/
void CShareData_IO::ShareData_IO_CustMenu( CDataProfile& cProfile )
{
IO_CustMenu( cProfile, GetDllShareData().m_Common.m_sCustomMenu, false );
}
/*!
@brief CustMenuの入出力
@param[in,out] cProfile INIファイル入出力クラス
@param[in,out] menu 入出力対象
@param bOutCmdName 出力時にマクロ名で出力
@date 2005-04-07 D.S.Koba ShareData_IO_2から分離。
*/
void CShareData_IO::IO_CustMenu( CDataProfile& cProfile, CommonSetting_CustomMenu& menu, bool bOutCmdName)
{
const WCHAR* pszSecName = LTEXT("CustMenu");
int i, j;
WCHAR szKeyName[64];
wchar_t szFuncName[1024];
EFunctionCode n;
for( i = 0; i < MAX_CUSTOM_MENU; ++i ){
auto_sprintf( szKeyName, LTEXT("szCMN[%02d]"), i );
cProfile.IOProfileData(pszSecName, szKeyName, StringBufferW(menu.m_szCustMenuNameArr[i])); // Oct. 15, 2001 genta 最大長指定
auto_sprintf( szKeyName, LTEXT("bCMPOP[%02d]"), i );
cProfile.IOProfileData( pszSecName, szKeyName, menu.m_bCustMenuPopupArr[i] );
auto_sprintf( szKeyName, LTEXT("nCMIN[%02d]"), i );
cProfile.IOProfileData( pszSecName, szKeyName, menu.m_nCustMenuItemNumArr[i] );
SetValueLimit( menu.m_nCustMenuItemNumArr[i], _countof(menu.m_nCustMenuItemFuncArr[0]) );