Merge pull request #2212 from unxed/ctrl_yo
[far2l.git] / incsrch / config.cpp
blobbef864d6c03b8898b382104af8f2e28894ccbb3a
1 #include "incsrch.h"
2 #include <utils.h>
3 #include <KeyFileHelper.h>
5 #define INI_LOCATION InMyConfig("plugins/incsrch/config.ini")
6 #define INI_SECTION "Settings"
8 static const char sKeyCaseSensitive[] = ("Case sensitive");
9 static const char sKeyKeepSelection[] = ("Keep selection");
10 static const char sKeyBeepOnMismatch[] = ("Beep on mismatch");
11 static const char sKeyRestartEOF[] = ("Restart EOF");
12 static const char sKeyUseSelection[] = ("Use selection");
13 static const char sKeyAutoNext[] = ("Auto next");
14 static const char sKeyBSunroll[] = ("Backspace unroll");
16 extern "C" {
17 void RestoreConfig(void)
19 KeyFileReadSection kfh(INI_LOCATION, INI_SECTION);
20 bCaseSensitive = !!kfh.GetInt(sKeyCaseSensitive, bCaseSensitive);
21 bKeepSelection = !!kfh.GetInt(sKeyKeepSelection, bKeepSelection);
22 bBeepOnMismatch = !!kfh.GetInt(sKeyBeepOnMismatch, bBeepOnMismatch);
23 bRestartEOF = !!kfh.GetInt(sKeyRestartEOF, bRestartEOF);
24 bUseSelection = !!kfh.GetInt(sKeyUseSelection, bUseSelection);
25 bAutoNext = !!kfh.GetInt(sKeyAutoNext, bAutoNext);
26 bBSunroll = !!kfh.GetInt(sKeyBSunroll, bBSunroll);
29 void SaveConfig(void)
31 KeyFileHelper kfh(INI_LOCATION);
32 kfh.SetInt(INI_SECTION, sKeyCaseSensitive, bCaseSensitive);
33 kfh.SetInt(INI_SECTION, sKeyKeepSelection, bKeepSelection);
34 kfh.SetInt(INI_SECTION, sKeyBeepOnMismatch, bBeepOnMismatch);
35 kfh.SetInt(INI_SECTION, sKeyRestartEOF, bRestartEOF);
36 kfh.SetInt(INI_SECTION, sKeyUseSelection, bUseSelection);
37 kfh.SetInt(INI_SECTION, sKeyAutoNext, bAutoNext);
38 kfh.SetInt(INI_SECTION, sKeyBSunroll, bBSunroll);