~ubuntu-branches/ubuntu/raring/sunpinyin/raring

« back to all changes in this revision

Viewing changes to wrapper/macos/SunPinyinApplicationDelegate.mm

  • Committer: Package Import Robot
  • Author(s): YunQiang Su
  • Date: 2012-03-30 15:31:55 UTC
  • mfrom: (1.1.3) (1.2.7 sid)
  • Revision ID: package-import@ubuntu.com-20120330153155-qgls77sogzgtg9zp
Tags: 2.0.3+git20120222-1
* Team upload: git snapshot 20120222.
   - fix breaks if LDFLAGS in environment contains
       multiple words (Closese #646001).
   - rm patches merged to upstream:
       append-os-environ-toenv.patch
       fix-ftbfs-on-sh.patch
       remove-10-candidate-words-limitation.patch
   - refresh disable-lm-dict-compile.patch.
* Bump stardard version to 3.9.3: no modify needed.
* add libsunpinyin3-dbg and python-sunpinyin packages.
* debian/compat to 9, multiarch it.
* rewrite debian/rules with dh 7 format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
3
 * 
 
4
 * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
 
5
 * 
 
6
 * The contents of this file are subject to the terms of either the GNU Lesser
 
7
 * General Public License Version 2.1 only ("LGPL") or the Common Development and
 
8
 * Distribution License ("CDDL")(collectively, the "License"). You may not use this
 
9
 * file except in compliance with the License. You can obtain a copy of the CDDL at
 
10
 * http://www.opensource.org/licenses/cddl1.php and a copy of the LGPLv2.1 at
 
11
 * http://www.opensource.org/licenses/lgpl-license.php. See the License for the 
 
12
 * specific language governing permissions and limitations under the License. When
 
13
 * distributing the software, include this License Header Notice in each file and
 
14
 * include the full text of the License in the License file as well as the
 
15
 * following notice:
 
16
 * 
 
17
 * NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
 
18
 * (CDDL)
 
19
 * For Covered Software in this distribution, this License shall be governed by the
 
20
 * laws of the State of California (excluding conflict-of-law provisions).
 
21
 * Any litigation relating to this License shall be subject to the jurisdiction of
 
22
 * the Federal Courts of the Northern District of California and the state courts
 
23
 * of the State of California, with venue lying in Santa Clara County, California.
 
24
 * 
 
25
 * Contributor(s):
 
26
 * 
 
27
 * If you wish your version of this file to be governed by only the CDDL or only
 
28
 * the LGPL Version 2.1, indicate your decision by adding "[Contributor]" elects to
 
29
 * include this software in this distribution under the [CDDL or LGPL Version 2.1]
 
30
 * license." If you don't indicate a single choice of license, a recipient has the
 
31
 * option to distribute your version of this file under either the CDDL or the LGPL
 
32
 * Version 2.1, or to extend the choice of license to its licensees as provided
 
33
 * above. However, if you add LGPL Version 2.1 code and therefore, elected the LGPL
 
34
 * Version 2 license, then the option applies only if the new code is made subject
 
35
 * to such option by the copyright holder. 
 
36
 */
 
37
 
 
38
#include <sys/stat.h>
 
39
#import "imi_view.h"
 
40
#import "imi_option_keys.h"
 
41
#import "imi_session_wrapper.h"
 
42
#import "imi_plugin.h"
 
43
#import "SunPinyinApplicationDelegate.h"
 
44
#import <Sparkle/Sparkle.h>
 
45
 
 
46
using namespace std;
 
47
 
 
48
void updateFactorySettings(NSUserDefaults* pref);
 
49
void updateQuanpinSettings(NSUserDefaults* pref);
 
50
void updateShuangpinSettings(NSUserDefaults* pref);
 
51
void updateSimplifiedChineseSettings(NSUserDefaults* pref);
 
52
void updateKeyProfileSettings(NSUserDefaults* pref);
 
53
 
 
54
@implementation SunPinyinApplicationDelegate
 
55
 
 
56
//this method is added so that our controllers can access the shared NSMenu.
 
57
-(NSMenu*)menu
 
58
{
 
59
    return _menu;
 
60
}
 
61
 
 
62
-(CandidateWindow*)candiWin
 
63
{
 
64
    return _candiWin;
 
65
}
 
66
 
 
67
-(void)updateUISettings
 
68
{
 
69
    NSUserDefaults* pref = [NSUserDefaults standardUserDefaults];
 
70
    
 
71
    //setting background color
 
72
    NSData *data = [pref dataForKey:@"bgColor"];
 
73
    NSColor *color = data? (NSColor*) [NSUnarchiver unarchiveObjectWithData:data]:
 
74
    [NSColor orangeColor];
 
75
    
 
76
    float alpha = [pref floatForKey:@"alpha"]/100.0;
 
77
    NSColor *bgColor = [color colorWithAlphaComponent:alpha];
 
78
    [_ftTxtField setBackgroundColor:color];
 
79
    [_candiWin setBgColor:bgColor];
 
80
    
 
81
    float radius = [pref floatForKey:@"radius"];
 
82
    [_candiWin setRadius:radius];
 
83
 
 
84
    data = [pref dataForKey:@"fgColor"];
 
85
    color = data? (NSColor*) [NSUnarchiver unarchiveObjectWithData:data]:
 
86
    [NSColor whiteColor];
 
87
    [_ftTxtField setTextColor:color];
 
88
    [_candiWin setFgColor:color];
 
89
    
 
90
    data = [pref dataForKey:@"hlColor"];
 
91
    color = data? (NSColor*) [NSUnarchiver unarchiveObjectWithData:data]:
 
92
    [NSColor blueColor];
 
93
    [_candiWin setHlColor:color];
 
94
    
 
95
    //setting font
 
96
    NSString *ftname = [pref stringForKey:@"fontName"];
 
97
    float ftsize = [pref floatForKey:@"fontSize"];
 
98
    NSFont *font = [NSFont fontWithName:ftname size:ftsize];
 
99
    NSString* text = [NSString stringWithFormat:@"%@ %.0f",ftname,ftsize];
 
100
    [_ftTxtField setFont:font];
 
101
    [_ftTxtField setStringValue:text];
 
102
    [_candiWin setFont:font];
 
103
}
 
104
 
 
105
-(void)updateIMESettings
 
106
{
 
107
    NSUserDefaults* pref = [NSUserDefaults standardUserDefaults];
 
108
    
 
109
    //setting full/half puncts and symbols
 
110
    _inputChinesePuncts = [pref boolForKey:@"inputChinesePuncts"];
 
111
    _inputFullSymbols   = [pref boolForKey:@"inputFullSymbols"];
 
112
    _switchingPolicy    = (SwitchingPolicies) [pref integerForKey:@"switchingPolicy"];
 
113
    _commitPolicy       = (CommitPolicies) [pref integerForKey:@"commitPolicy"];
 
114
    _usingUSKbLayout    = [pref boolForKey:@"usingUSKbLayout"];
 
115
    
 
116
    updateFactorySettings(pref);
 
117
    updateQuanpinSettings(pref);
 
118
    updateShuangpinSettings(pref);
 
119
    updateSimplifiedChineseSettings(pref);
 
120
    updateKeyProfileSettings(pref);
 
121
}
 
122
 
 
123
-(void)loadPreferences
 
124
{
 
125
    [self updateUISettings];
 
126
    [self updateIMESettings];
 
127
}
 
128
 
 
129
//add an awakeFromNib item so that we can set the action method.  Note that 
 
130
//any menuItems without an action will be disabled when displayed in the Text 
 
131
//Input Menud.
 
132
-(void)awakeFromNib
 
133
{
 
134
    [self loadPreferences];
 
135
    
 
136
    NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
 
137
    [center addObserver:self
 
138
            selector:@selector(preferencesChanged:)
 
139
            name:NSUserDefaultsDidChangeNotification
 
140
            object:nil];
 
141
 
 
142
    [GrowlApplicationBridge setGrowlDelegate: self];
 
143
    
 
144
    string res_path = [[[NSBundle mainBundle] resourcePath] UTF8String];
 
145
    AOptionEventBus::instance().publishEvent(COptionEvent(SYSTEM_DATA_DIR, res_path));
 
146
 
 
147
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
 
148
    if ([paths count]) 
 
149
    {
 
150
        string user_data_dir = [[paths objectAtIndex: 0] UTF8String];
 
151
        user_data_dir.append ("/SunPinyin");
 
152
        AOptionEventBus::instance().publishEvent(COptionEvent(USER_DATA_DIR, user_data_dir));
 
153
        
 
154
        /* Test Plugin */
 
155
        CIMIPluginManager& plugin_manager = AIMIPluginManager::instance();
 
156
        plugin_manager.loadPlugin("cloudpinyin.py");
 
157
        NSLog (@"%s", plugin_manager.getLastError().c_str());
 
158
    }
 
159
}
 
160
 
 
161
-(void)preferencesChanged:(NSNotification *)notification
 
162
{
 
163
    if ([[notification name] compare: @"NSUserDefaultsDidChangeNotification"])
 
164
        return;
 
165
    
 
166
    [self loadPreferences];
 
167
}
 
168
 
 
169
//though we specified the showPrefPanel: in SunPinyinApplicationDelegate as the
 
170
//action receiver, the IMKInputController will actually receive the event. 
 
171
-(IBAction)showPrefPanel:(id)sender
 
172
{
 
173
    [_prefPanel makeKeyAndOrderFront:sender];
 
174
}
 
175
 
 
176
-(IBAction)showFontPanel:(id)sender
 
177
{
 
178
    NSFont *oldFont = [_candiWin font];
 
179
    NSFontPanel* ftDlg = [NSFontPanel sharedFontPanel];
 
180
    [ftDlg setDelegate:self];
 
181
    [ftDlg setPanelFont:oldFont isMultiple:NO];
 
182
    [ftDlg makeKeyAndOrderFront:sender];
 
183
}
 
184
 
 
185
-(void) changeFont:(id)sender
 
186
{
 
187
    NSFont *oldFont =[_candiWin font];
 
188
    NSFont *newFont = [sender convertFont:oldFont];
 
189
    
 
190
    NSUserDefaults* pref = [NSUserDefaults standardUserDefaults];
 
191
    NSString* ftname = [newFont fontName];
 
192
    float ftsize = [newFont pointSize];
 
193
    [pref setObject:ftname forKey:@"fontName"];
 
194
    [pref setFloat:ftsize forKey:@"fontSize"];
 
195
}
 
196
 
 
197
-(void) changeAttributes:(id)sender
 
198
{
 
199
    NSColor *fgColor = [_candiWin fgColor];
 
200
    NSDictionary *oldAttributes = [NSDictionary dictionaryWithObject:fgColor forKey:@"NSColor"];
 
201
    NSDictionary *newAttributes = [sender convertAttributes: oldAttributes];
 
202
 
 
203
    fgColor = [newAttributes objectForKey:@"NSColor"];
 
204
    [_ftTxtField setTextColor:fgColor];
 
205
 
 
206
    NSUserDefaults* pref = [NSUserDefaults standardUserDefaults];
 
207
    NSData *data=[NSArchiver archivedDataWithRootObject:fgColor];
 
208
    [pref setObject:data forKey:@"fgColor"];
 
209
}
 
210
 
 
211
-(IBAction)toggleChinesePuncts:(id)sender
 
212
{
 
213
    NSMenuItem *item = [_menu itemWithTag:0];
 
214
    _inputChinesePuncts = ![item state];
 
215
    [[NSUserDefaults standardUserDefaults] setBool:_inputChinesePuncts 
 
216
                                           forKey:@"inputChinesePuncts"];
 
217
}
 
218
 
 
219
-(bool)inputChinesePuncts
 
220
{
 
221
    return _inputChinesePuncts;
 
222
}
 
223
 
 
224
-(IBAction)toggleFullSymbols:(id)sender
 
225
{
 
226
    NSMenuItem *item = [_menu itemWithTag:1];
 
227
    _inputFullSymbols = ![item state];
 
228
    [[NSUserDefaults standardUserDefaults] setBool:_inputFullSymbols 
 
229
                                           forKey:@"inputFullSymbols"];
 
230
}
 
231
 
 
232
-(bool)inputFullSymbols
 
233
{
 
234
    return _inputFullSymbols;
 
235
}
 
236
 
 
237
-(SwitchingPolicies)switchingPolicy
 
238
{
 
239
    return _switchingPolicy;
 
240
}
 
241
 
 
242
-(CommitPolicies)commitPolicy
 
243
{
 
244
    return _commitPolicy;
 
245
}
 
246
 
 
247
-(bool)usingUSKbLayout
 
248
{
 
249
    return _usingUSKbLayout;
 
250
}
 
251
 
 
252
-(void)dealloc 
 
253
{
 
254
    delete _data;
 
255
    delete _history;
 
256
    [[NSNotificationCenter defaultCenter] removeObserver:self];
 
257
    [super dealloc];
 
258
}
 
259
 
 
260
-(NSDictionary *)registrationDictionaryForGrowl
 
261
{
 
262
    NSArray *notifications;
 
263
    notifications = [NSArray arrayWithObject: @"SunPinyin"];
 
264
 
 
265
    NSDictionary *dict;
 
266
    dict = [NSDictionary dictionaryWithObjectsAndKeys:
 
267
                         notifications, GROWL_NOTIFICATIONS_ALL,
 
268
                         notifications, GROWL_NOTIFICATIONS_DEFAULT, nil];
 
269
           
 
270
    return (dict);
 
271
}
 
272
 
 
273
-(void)messageNotify:(NSString*)msg
 
274
{
 
275
    [GrowlApplicationBridge notifyWithTitle: @"SunPinyin"
 
276
                            description: msg
 
277
                            notificationName: @"SunPinyin"
 
278
                            iconData: [NSData dataWithData:[[NSImage imageNamed:@"SunPinyin"] TIFFRepresentation]]
 
279
                            priority: 0
 
280
                            isSticky: NO
 
281
                            clickContext: nil];
 
282
}
 
283
 
 
284
@end //SunPinyinApplicationDelegate
 
285
 
 
286
void updateFactorySettings(NSUserDefaults* pref)
 
287
{
 
288
    CSunpinyinSessionFactory& factory = CSunpinyinSessionFactory::getFactory();
 
289
    COptionEventBus& event_bus = AOptionEventBus::instance();
 
290
    
 
291
    int pinyin_scheme = [pref integerForKey: @"pinyinMode"];
 
292
    factory.setPinyinScheme((CSunpinyinSessionFactory::EPyScheme)pinyin_scheme);
 
293
    /* pinyin mode is not a shared configuration item, need to broadcast to session wrapper */
 
294
    event_bus.publishEvent(COptionEvent(PINYIN_SCHEME, pinyin_scheme));      
 
295
    
 
296
    int candi_number = [pref integerForKey:@"candiNumbers"];
 
297
    factory.setCandiWindowSize(candi_number);
 
298
    /* candiWindowSize is not a shared configuration item */
 
299
    event_bus.publishEvent(COptionEvent(CONFIG_GENERAL_PAGE_SIZE, candi_number));
 
300
}
 
301
 
 
302
void updateQuanpinSettings(NSUserDefaults* pref)
 
303
{    
 
304
    CQuanpinSchemePolicy& quanpin_policy = AQuanpinSchemePolicy::instance();
 
305
    CShuangpinSchemePolicy& shuangpin_policy = AShuangpinSchemePolicy::instance();
 
306
    
 
307
    bool simpler_initials_enabled = [pref boolForKey:@"Quanpin.Fuzzy.SimplerInitials"];    
 
308
    bool quanpin_fuzzy_enabled = [pref boolForKey: @"Quanpin.Fuzzy.Enabled"];
 
309
     
 
310
    quanpin_policy.setFuzzyForwarding   (quanpin_fuzzy_enabled, simpler_initials_enabled);
 
311
    shuangpin_policy.setFuzzyForwarding (quanpin_fuzzy_enabled, simpler_initials_enabled);
 
312
    
 
313
    quanpin_policy.clearFuzzyPinyinPairs();
 
314
    shuangpin_policy.clearFuzzyPinyinPairs();
 
315
 
 
316
    if (simpler_initials_enabled)
 
317
    {
 
318
        string_pairs fuzzy_pairs;
 
319
        
 
320
        fuzzy_pairs.push_back(make_pair("z",  "zh"));
 
321
        fuzzy_pairs.push_back(make_pair("c",  "ch"));
 
322
        fuzzy_pairs.push_back(make_pair("s",  "sh"));
 
323
        
 
324
        quanpin_policy.setFuzzyPinyinPairs   (fuzzy_pairs, false);
 
325
        shuangpin_policy.setFuzzyPinyinPairs (fuzzy_pairs, false);        
 
326
    }
 
327
    
 
328
    if (quanpin_fuzzy_enabled)
 
329
    {
 
330
        string_pairs fuzzy_pairs;
 
331
        
 
332
        if ([pref boolForKey: @"Quanpin.Fuzzy.ZhiZi"])   fuzzy_pairs.push_back(make_pair("zh",  "z"));
 
333
        if ([pref boolForKey: @"Quanpin.Fuzzy.ChiCi"])   fuzzy_pairs.push_back(make_pair("ch",  "c"));
 
334
        if ([pref boolForKey: @"Quanpin.Fuzzy.ShiSi"])   fuzzy_pairs.push_back(make_pair("sh",  "s"));
 
335
        if ([pref boolForKey: @"Quanpin.Fuzzy.AnAng"])   fuzzy_pairs.push_back(make_pair("an",  "ang"));
 
336
        if ([pref boolForKey: @"Quanpin.Fuzzy.OnOng"])   fuzzy_pairs.push_back(make_pair("on",  "ong"));
 
337
        if ([pref boolForKey: @"Quanpin.Fuzzy.EnEng"])   fuzzy_pairs.push_back(make_pair("en",  "eng"));
 
338
        if ([pref boolForKey: @"Quanpin.Fuzzy.InIng"])   fuzzy_pairs.push_back(make_pair("in",  "ing"));
 
339
        if ([pref boolForKey: @"Quanpin.Fuzzy.EngOng"])  fuzzy_pairs.push_back(make_pair("eng", "ong"));
 
340
        if ([pref boolForKey: @"Quanpin.Fuzzy.IanIang"]) fuzzy_pairs.push_back(make_pair("ian", "iang"));
 
341
        if ([pref boolForKey: @"Quanpin.Fuzzy.UanUang"]) fuzzy_pairs.push_back(make_pair("uan", "uang"));
 
342
        if ([pref boolForKey: @"Quanpin.Fuzzy.NeLe"])    fuzzy_pairs.push_back(make_pair("n",   "l"));
 
343
        if ([pref boolForKey: @"Quanpin.Fuzzy.FoHe"])    fuzzy_pairs.push_back(make_pair("f",   "h"));
 
344
        if ([pref boolForKey: @"Quanpin.Fuzzy.LeRi"])    fuzzy_pairs.push_back(make_pair("l",   "r"));
 
345
        if ([pref boolForKey: @"Quanpin.Fuzzy.KeGe"])    fuzzy_pairs.push_back(make_pair("k",   "g"));
 
346
        
 
347
        quanpin_policy.setFuzzyPinyinPairs   (fuzzy_pairs);
 
348
        shuangpin_policy.setFuzzyPinyinPairs (fuzzy_pairs);
 
349
    }
 
350
        
 
351
    bool quanpin_autocorrecting_enabled = [pref boolForKey: @"Quanpin.AutoCorrecting.Enabled"];
 
352
    quanpin_policy.setAutoCorrecting (quanpin_autocorrecting_enabled);
 
353
    
 
354
    string_pairs correcting_pairs;
 
355
    
 
356
    if ([pref boolForKey: @"Quanpin.AutoCorrecting.GnNg"]) correcting_pairs.push_back(make_pair("gn", "ng"));
 
357
    if ([pref boolForKey: @"Quanpin.AutoCorrecting.UenUn"])  correcting_pairs.push_back(make_pair("uen", "un"));
 
358
    if ([pref boolForKey: @"Quanpin.AutoCorrecting.ImgIng"]) correcting_pairs.push_back(make_pair("img", "ing"));
 
359
    if ([pref boolForKey: @"Quanpin.AutoCorrecting.IouIu"])  correcting_pairs.push_back(make_pair("iou", "iu"));
 
360
    if ([pref boolForKey: @"Quanpin.AutoCorrecting.UeiUi"])  correcting_pairs.push_back(make_pair("uei", "ui"));
 
361
    
 
362
    quanpin_policy.setAutoCorrectionPairs (correcting_pairs);
 
363
 
 
364
    bool quanpin_fuzzy_segments_enabled       = [pref boolForKey:@"Quanpin.FuzzySegs.Enabled"];
 
365
    bool quanpin_inner_fuzzy_segments_enabled = [pref boolForKey:@"Quanpin.FuzzySegs.InnerFuzzy.Enabled"];
 
366
    quanpin_policy.setFuzzySegmentation (quanpin_fuzzy_segments_enabled);
 
367
    quanpin_policy.setInnerFuzzySegmentation (quanpin_inner_fuzzy_segments_enabled);
 
368
}
 
369
 
 
370
void updateShuangpinSettings(NSUserDefaults* pref)
 
371
{
 
372
    /* Shuangpin type is not a shared configuration item */
 
373
    COptionEventBus& event_bus = AOptionEventBus::instance();    
 
374
    int  shuangpin_type = [pref integerForKey: @"Shuangpin.Scheme"];
 
375
    event_bus.publishEvent(COptionEvent(SHUANGPIN_TYPE, shuangpin_type));    
 
376
}
 
377
 
 
378
void updateSimplifiedChineseSettings(NSUserDefaults* pref)
 
379
{    
 
380
    CSimplifiedChinesePolicy& lang_policy = ASimplifiedChinesePolicy::instance();
 
381
    
 
382
    lang_policy.enableFullSymbol ([pref boolForKey:@"inputFullSymbols"]);
 
383
    lang_policy.enableFullPunct ([pref boolForKey:@"inputChinesePuncts"]);
 
384
        
 
385
    NSString *charset = [pref stringForKey:@"charset"];
 
386
    int charset_level = [charset isEqualToString:@"GB18030"]? 2: 
 
387
                            [charset isEqualToString:@"GBK"]? 1: 0;
 
388
    
 
389
    /* charset is not a shared configuration item */
 
390
    AOptionEventBus::instance().publishEvent (COptionEvent(CONFIG_GENERAL_CHARSET_LEVEL, charset_level));    
 
391
    
 
392
    string_pairs punct_pairs;
 
393
    NSArray* punct_mappings = [pref arrayForKey: @"punctationMappings"];
 
394
    for (int i=0; i<[punct_mappings count]; ++i)
 
395
    {
 
396
        NSDictionary *tmp = [punct_mappings objectAtIndex:i];
 
397
        NSNumber *enabled = [tmp objectForKey:@"enabled"];
 
398
        NSString *ascii = [tmp objectForKey:@"ASCII"];
 
399
        if ([ascii isEqualToString:@"SPACE"]) ascii = @" ";
 
400
        
 
401
        NSString *mapped_string = [tmp objectForKey:@"mappedString"];
 
402
        
 
403
        if ([enabled boolValue] && [mapped_string UTF8String])
 
404
            punct_pairs.push_back (make_pair([ascii UTF8String], [mapped_string UTF8String]));
 
405
    }
 
406
    lang_policy.setPunctMapping(punct_pairs);    
 
407
}
 
408
 
 
409
void updateKeyProfileSettings(NSUserDefaults* pref)
 
410
{
 
411
    /* hotkey profile settings are not shared configuration items */
 
412
    COptionEventBus& event_bus = AOptionEventBus::instance(); 
 
413
    
 
414
    bool paging_by_minus_equals = [pref boolForKey:@"pagingByMinusAndEqual"];
 
415
    event_bus.publishEvent (COptionEvent(CONFIG_KEYBOARD_PAGE_MINUS, paging_by_minus_equals));
 
416
    
 
417
    bool paging_by_brackets = [pref boolForKey:@"pagingByBrackets"];
 
418
    event_bus.publishEvent (COptionEvent(CONFIG_KEYBOARD_PAGE_BRACKET, paging_by_brackets));
 
419
    
 
420
    bool paging_by_comma_period = [pref boolForKey:@"pagingByCommaAndDot"];
 
421
    event_bus.publishEvent (COptionEvent(CONFIG_KEYBOARD_PAGE_COMMA, paging_by_comma_period));
 
422
 
 
423
    bool paging_by_arrows = [pref boolForKey:@"pagingByArrowUpAndDown"];
 
424
    event_bus.publishEvent (COptionEvent(CONFIG_KEYBOARD_PAGE_ARROWS, paging_by_arrows));
 
425
        
 
426
    bool cancel_on_backspace = [pref boolForKey:@"cancelSelectionOnBackspace"];
 
427
    event_bus.publishEvent(COptionEvent(CONFIG_KEYBOARD_MISC_CANCELONBSP, cancel_on_backspace));
 
428
    
 
429
    // store the session specific configurations
 
430
    CSessionConfigStore::instance().m_paging_by_minus_equals = paging_by_minus_equals;
 
431
    CSessionConfigStore::instance().m_paging_by_brackets     = paging_by_brackets;        
 
432
    CSessionConfigStore::instance().m_paging_by_comma_period = paging_by_comma_period;        
 
433
    CSessionConfigStore::instance().m_paging_by_arrows       = paging_by_arrows;
 
434
    CSessionConfigStore::instance().m_cancel_on_backspace    = cancel_on_backspace;
 
435
}
 
436
 
 
437