Changes On Branch testSettingsReload Вы: nobody
Вход

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch testSettingsReload Excluding Merge-Ins

This is equivalent to a diff from 26b83521b1 to 05929eb51e

2012-11-11
10:25
Исправлена ошибка: при повторной загрузке настроек при помощи LoadSettings() происходила ошибка инициализации менеджера настроек из-за того, что при первом вызове изменялось значение свойства settings формы. Leaf check-in: 05929eb51e user: kuntashov tags: testSettingsReload
2012-11-08
11:22
Пофиксена установка положения каретки при разворачивании шаблонов в SciColorer check-in: 085644d193 user: orefkov tags: trunk
2012-11-07
12:44
Добавил форму настроек check-in: ef802b48e3 user: sosnae tags: testSettingsReload
12:42
Create new branch named "testSettingsReload" check-in: c96bfbc8f3 user: sosnae tags: testSettingsReload
2012-11-06
14:25
Испраленна ошибка определения позиции текста для некоторых окон (СКД, конструктор запросов) check-in: 26b83521b1 user: sosnae tags: trunk
14:17
Добавлен скрипт Менеджер сессий, позволяет запоминать при выходе из Конфигуратора список открытых окон и воссатнавливать их при следующем входе. check-in: 8185b47180 user: sosnae tags: trunk

Changes to CfgStore.js.

43
44
45
46
47
48
49





















50
51
52
53
54
55
56
        res = stdcommands.CfgStore.CaptureIntoCfgStore.send() // true если успешно

        if(isEventConnected)
            events.disconnect(windows, "onDoModal", SelfScript.self, "hookCaptureCfgStoreWindow")
        if(view)
            view.activate();





















    }catch(e)
    {
        Message("Ошибка : " + e.description)
    }

    return true;
}






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
        res = stdcommands.CfgStore.CaptureIntoCfgStore.send() // true если успешно

        if(isEventConnected)
            events.disconnect(windows, "onDoModal", SelfScript.self, "hookCaptureCfgStoreWindow")
        if(view)
            view.activate();
    }catch(e)
    {
        Message("Ошибка : " + e.description)
    }

    return true;
}

SelfScript.self['macrosПоместить объект в хранилище'] = function() {

    try{ //иногда вылетают странные исключения :( при работе с элементами форм
        view = windows.getActiveView();
        if (!view || !view.mdObj || view.mdObj.container != metadata.current) return false;
        
        
        res1 = view.mdObj.activateInTree();
        
        isEventConnected = true

        res = stdcommands.CfgStore.StoreIntoCfgStore.send() // true если успешно

    }catch(e)
    {
        Message("Ошибка : " + e.description)
    }

    return true;
}

Changes to Libs/ScriptForm.js.

141
142
143
144
145
146
147
148







149
150
151
152
153
154
155
156
157
158
159
        return this.settingsRootPath && this.settings;
    },
    
    loadSettings : function () {
        
        if (!this.hasSettings())
            return false;
            







        var sm = stdlib.require('SettingsManagement.js').SettingsManagement;
        for (var pflType in this.settings) 
        {
            var defaults = this.settings[pflType];
            // Имя ключа = строка - имя значения перечисления. Выполняя строку получаем необходимое значение. 
            var pflTypeValue = eval(pflType); 
            var settings = sm.CreateManager(this.settingsRootPath, defaults, pflTypeValue);
            
            settings.LoadSettings();
            if (this.form)
                settings.ApplyToForm(this.form);            







>
>
>
>
>
>
>

|

|







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
        return this.settingsRootPath && this.settings;
    },
    
    loadSettings : function () {
        
        if (!this.hasSettings())
            return false;
            
        if (!this._defaultSettings) {
        	this._defaultSettings = {};
        	for(var prop in this.settings) {
	        	this._defaultSettings[prop] = this.settings[prop];
        	}
        }    
            
        var sm = stdlib.require('SettingsManagement.js').SettingsManagement;
        for (var pflType in this._defaultSettings) 
        {
            var defaults = this._defaultSettings[pflType];
            // Имя ключа = строка - имя значения перечисления. Выполняя строку получаем необходимое значение. 
            var pflTypeValue = eval(pflType); 
            var settings = sm.CreateManager(this.settingsRootPath, defaults, pflTypeValue);
            
            settings.LoadSettings();
            if (this.form)
                settings.ApplyToForm(this.form);            

Changes to SessionManager.js.

47
48
49
50
51
52
53












54
55
56
57
58
59
60
..
64
65
66
67
68
69
70
71
72
73
74



75
76
77
78
79
80
81
...
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
...
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
...
351
352
353
354
355
356
357
358


359
360

361





































































362
363
364
365
366
367
368
...
586
587
588
589
590
591
592







593
594
595
596
597
598
599
}
SelfScript.self['macrosОчистить всю историю'] = function() {

    var sm = GetSessionManager();
    sm.sessionTreeClear();
    return true;
}












/* Возвращает название макроса по умолчанию - вызывается, когда пользователь
дважды щелкает мышью по названию скрипта в окне Снегопата. */
function getDefaultMacros() {
    return 'Восстановить последнюю сессию';
}

////} Макросы
................................................................................
////
SessionManager = ScriptForm.extend({

    settingsRootPath : SelfScript.uniqueName,

    settings : {
        pflBase : {
            'SessionsHistory' : "", //Таблица значений.
            'SassionSaved'     : v8New('ValueList'),
            'AutoSave'      : false, // Автосохранение сессии.
            'HistoryDepth'  : 15 // Количество элементов истории сессий.




        }
    },

    construct : function (isExtend) {

        if (isExtend == undefined) isExtend = false;
................................................................................
            this.SessionTree.Columns.Add("prop");
            this.SessionTree.Columns.Add("rootId");
            this.SessionTree.Columns.Add("sortkey");
            this.SessionTree.Columns.Add("curLine");
        }
        
        try{

            this.SessionTree.Columns.Add("curLine");
        } catch(e){  }

    },

    restoreSession:function(sessionName){

        var sessionsHistory = this.SessionTree;

        if (sessionsHistory.Rows.Count()==0){
            return ;
        }

        if (sessionName==undefined) sessionName = ""





        if (sessionName.length>0){
            for (var i = 0; i<sessionsHistory.Rows.Count(); i++){
                session  = sessionsHistory.Rows.Get(i);
                if (session.Name == sessionName){
                    sessionRow = session;
                    break;
................................................................................
            newRow.path = item.path;
            newRow.uuid = item.uuid;
            newRow.prop = item.prop;
            newRow.name = item.name;
            newRow.curLine = item.curLine;
            
        }






        this.form.SessionsHistory = ValueToStringInternal(this.SessionTree);
    },
    saveSettings:function(){
        this.form.SessionsHistory = ValueToStringInternal(this.SessionTree);
        this._super();
    },
    beforeExitApp:function(){
        
        this.watcher.onTimer(1);
        this.watcher.stopWatch();
        

        this.saveSession();


        this.saveSettings();
    },

    expandTree : function (collapse) {
        var tree = this.form.Controls.SessionsList;
        for (var i=0; i < this.form.SessionsList.Rows.Count(); i++)
        {
................................................................................
                //     }
                // };
                 
    },

    sessionTreeClear:function(){
        this.SessionTree.Rows.Clear();
    }





})






































































////////////////////////////////////////////////////////////////////////////////////////
////{ TextWindowsWatcher - отслеживает активизацию текстовых окон и запоминает последнее.
////

TextWindowsWatcher = stdlib.Class.extend({

................................................................................
////
function GetSessionManager() {
    if (!SessionManager._instance)
        new SessionManager();

    return SessionManager._instance;
}








function onTimer(Id) {

    se = GetSessionManager();
    se.restoreSession();
    if (!timerId)
        return;






>
>
>
>
>
>
>
>
>
>
>
>







 







|
|
|
|
>
>
>







 







>








>



>

>
>
>
>







 







>
>
>
>
>
>










|
>
|
>
>







 







|
>
>
|

>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>







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
..
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
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
...
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
...
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
...
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
}
SelfScript.self['macrosОчистить всю историю'] = function() {

    var sm = GetSessionManager();
    sm.sessionTreeClear();
    return true;
}

SelfScript.self['macrosОткрыть настройку'] = function() {

    var sms = GetSessionManagerSettings();
    sms.show(true);
    sms = null;
    var sm = GetSessionManager();
    sm.reloadSettings();
    return true;
}


/* Возвращает название макроса по умолчанию - вызывается, когда пользователь
дважды щелкает мышью по названию скрипта в окне Снегопата. */
function getDefaultMacros() {
    return 'Восстановить последнюю сессию';
}

////} Макросы
................................................................................
////
SessionManager = ScriptForm.extend({

    settingsRootPath : SelfScript.uniqueName,

    settings : {
        pflBase : {
            'SessionsHistory' : "", //Таблица значений 
            'SassionSaved'    : "",
            'AutoSave'        : true, // Автосохранение сессии.
            'HistoryDepth'    : 15, // Количество элементов истории сессий.
            'AutoRestore'     : true,
            'MarksSave'       : true,
            'MarksRestore'    : true

        }
    },

    construct : function (isExtend) {

        if (isExtend == undefined) isExtend = false;
................................................................................
            this.SessionTree.Columns.Add("prop");
            this.SessionTree.Columns.Add("rootId");
            this.SessionTree.Columns.Add("sortkey");
            this.SessionTree.Columns.Add("curLine");
        }
        
        try{

            this.SessionTree.Columns.Add("curLine");
        } catch(e){  }

    },

    restoreSession:function(sessionName){

        var sessionsHistory = this.SessionTree;
        
        if (sessionsHistory.Rows.Count()==0){
            return ;
        }

        if (sessionName==undefined) sessionName = ""

        if (!this.form.AutoRestore) {
            return;
        }

        if (sessionName.length>0){
            for (var i = 0; i<sessionsHistory.Rows.Count(); i++){
                session  = sessionsHistory.Rows.Get(i);
                if (session.Name == sessionName){
                    sessionRow = session;
                    break;
................................................................................
            newRow.path = item.path;
            newRow.uuid = item.uuid;
            newRow.prop = item.prop;
            newRow.name = item.name;
            newRow.curLine = item.curLine;
            
        }

        // Не позволяем истории расти более заданной глубины.
        while (this.SessionTree.Rows.Count() > this.form.HistoryDepth){
            currRow = this.SessionTree.Rows.Get(0);
            this.SessionTree.Rows.Delete(currRow);
        }
        this.form.SessionsHistory = ValueToStringInternal(this.SessionTree);
    },
    saveSettings:function(){
        this.form.SessionsHistory = ValueToStringInternal(this.SessionTree);
        this._super();
    },
    beforeExitApp:function(){
        
        this.watcher.onTimer(1);
        this.watcher.stopWatch();

        if (this.form.AutoSave){
            this.saveSession();    
        }

        this.saveSettings();
    },

    expandTree : function (collapse) {
        var tree = this.form.Controls.SessionsList;
        for (var i=0; i < this.form.SessionsList.Rows.Count(); i++)
        {
................................................................................
                //     }
                // };
                 
    },

    sessionTreeClear:function(){
        this.SessionTree.Rows.Clear();
    }, 
    reloadSettings:function(){
        this.loadSettings();
    }


})

////////////////////////////////////////////////////////////////////////////////////////
////{ SessionManagerSettings - Настройки менеджера сессий. 
////
SessionManagerSettings = ScriptForm.extend({

    settingsRootPath : SelfScript.uniqueName,

    settings : {
        pflBase : {
            'SessionsHistory' : "", //Таблица значений 
            'SassionSaved'    : "",
            'AutoSave'        : false, // Автосохранение сессии.
            'HistoryDepth'    : 15, // Количество элементов истории сессий.
            'AutoRestore'     : true,
            'MarksSave'       : true,
            'MarksRestore'    : true

        }
    },

    construct : function () {

        this._super("scripts\\SessionManager.settings.ssf");

        this.loadSettings();

        SessionManagerSettings._instance = this;

    },
    loadSettings:function(){
        this._super();
        try{
            this.SessionTree = ValueFromStringInternal(this.form.SessionsHistory);
        } catch(e){
            this.SessionTree = v8New("ValueTree");
            this.SessionTree.Columns.Add("Name");
            this.SessionTree.Columns.Add("path");
            this.SessionTree.Columns.Add("uuid");
            this.SessionTree.Columns.Add("prop");
            this.SessionTree.Columns.Add("rootId");
            this.SessionTree.Columns.Add("sortkey");
            this.SessionTree.Columns.Add("curLine");
        }
        
        try{

            this.SessionTree.Columns.Add("curLine");
        } catch(e){  }

    },

    saveSettings:function(){
        this.form.SessionsHistory = ValueToStringInternal(this.SessionTree);
        this._super();
    },

    Ok_Click:function(Button){
        this.saveSettings();
        this.form.Close();
    }, 

    Close_Click:function(Button){
        this.form.Close();
    }

})



////////////////////////////////////////////////////////////////////////////////////////
////{ TextWindowsWatcher - отслеживает активизацию текстовых окон и запоминает последнее.
////

TextWindowsWatcher = stdlib.Class.extend({

................................................................................
////
function GetSessionManager() {
    if (!SessionManager._instance)
        new SessionManager();

    return SessionManager._instance;
}

function GetSessionManagerSettings() {
    if (!SessionManagerSettings._instance)
        new SessionManagerSettings();

    return SessionManagerSettings._instance;
}

function onTimer(Id) {

    se = GetSessionManager();
    se.restoreSession();
    if (!timerId)
        return;

Added SessionManager.settings.ssf.

cannot compute difference between binary files

Changes to SessionManager.ssf.

cannot compute difference between binary files