rsence-pre 2.1.0.8.pre → 2.1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.0.8.pre
1
+ 2.1.0.9.pre
@@ -53,7 +53,12 @@ HClickButton = HButton.extend({
53
53
  *
54
54
  **/
55
55
  refreshValue: function(){
56
- this.setEnabled( this.value === 0 );
56
+ if( this.options.inverseValue ){
57
+ this.setEnabled( this.value === 1 );
58
+ }
59
+ else {
60
+ this.setEnabled( this.value === 0 );
61
+ }
57
62
  },
58
63
  /** = Description
59
64
  * Click method, sets the value to disabled if the button is enabled.
@@ -61,7 +66,12 @@ HClickButton = HButton.extend({
61
66
  **/
62
67
  click: function(){
63
68
  if(this.enabled){
64
- this.setValue(1);
69
+ if( this.options.inverseValue ){
70
+ this.setValue(0);
71
+ }
72
+ else {
73
+ this.setValue(1);
74
+ }
65
75
  }
66
76
  }
67
77
 
@@ -26,6 +26,7 @@ HStepper = HControl.extend({
26
26
 
27
27
  defaultEvents: {
28
28
  mouseDown: true,
29
+ click: true,
29
30
  keyDown: true,
30
31
  mouseWheel: true
31
32
  },
@@ -101,17 +102,6 @@ HStepper = HControl.extend({
101
102
  );
102
103
  },
103
104
 
104
- // -- Returns an action string for the setInterval in _setRepeatInterval ++
105
- _repeatIntervalStr: function( _up ){
106
- return [
107
- 'HSystem.views[',
108
- this.viewId,
109
- '].step',
110
- (_up?'Up':'Down'),
111
- '();'
112
- ].join('');
113
- },
114
-
115
105
  // -- Background-offset of the state images up/down,
116
106
  // overrideable in the html template ++
117
107
  bgStateUp: '0px -23px',
@@ -131,15 +121,13 @@ HStepper = HControl.extend({
131
121
  _setRepeatInterval: function( _up ){
132
122
  var _this = this,
133
123
  _options = _this.options;
124
+ _this._repeatInterval && clearInterval( _this._repeatInterval );
134
125
  _this._bgStateOn( _up );
135
- if (_up) {
136
- _this.stepUp();
137
- _this._repeatInterval = setInterval( _this._repeatIntervalStr(1), _options.repeatInterval );
138
- }
139
- else {
140
- _this.stepDown();
141
- _this._repeatInterval = setInterval( _this._repeatIntervalStr(0), _options.repeatInterval );
142
- }
126
+ _up?_this.stepUp():_this.stepDown();
127
+ _this._repeatInterval = setInterval(
128
+ _up?function(){_this.stepUp();}:function(){_this.stepDown();},
129
+ _options.repeatInterval
130
+ );
143
131
  },
144
132
 
145
133
  // Stops the repeating stepping up or down enabled in _setRepeatInterval
@@ -153,6 +141,7 @@ HStepper = HControl.extend({
153
141
  mouseDown: function( x, y ){
154
142
  this.setMouseUp(true);
155
143
  this._setRepeatInterval( ( y - ELEM.getVisiblePosition( this.elemId )[1] ) <= 11 );
144
+
156
145
  },
157
146
 
158
147
  /** Stops the repeating stepping, when the mouse button goes up
@@ -161,6 +150,10 @@ HStepper = HControl.extend({
161
150
  this._clearRepeatInterval();
162
151
  },
163
152
 
153
+ click: function(){
154
+ this.mouseUp();
155
+ },
156
+
164
157
  /** Stops the repeating stepping, when the control becomes inactive
165
158
  **/
166
159
  blur: function(){
@@ -241,7 +241,7 @@ HWindow = HDynControl.extend({
241
241
  for( ; i < _views.length; i++ ){
242
242
  _view = HSystem.views[_views[i]];
243
243
  _size = ELEM.getSize(_view.elemId);
244
- _pos = ELEM.getPosition(_view.elemId);
244
+ _pos = ELEM.getVisiblePosition(_view.elemId);
245
245
  _right = _size[0]+_pos[0]-this.pageX();
246
246
  _bottom = _size[1]+_pos[1]-this.pageY();
247
247
  if(_right > _fitsRect.width){
@@ -174,13 +174,14 @@ HEventResponder = HClass.extend({
174
174
  **/
175
175
  setEnabled: function(_flag) {
176
176
 
177
- var _this = this,
178
- _elemId = this.elemId,
179
- _sysViews = HSystem.views,
180
- i = 0,
181
- _views = _this.views,
182
- _view,
183
- _viewsLen = _views.length;
177
+ var
178
+ _this = this,
179
+ _elemId = this.elemId,
180
+ _sysViews = HSystem.views,
181
+ i = 0,
182
+ _views = _this.views,
183
+ _view,
184
+ _viewsLen = _views.length;
184
185
 
185
186
  // Enable/disable the children first.
186
187
  for (; i < _viewsLen; i++) {
@@ -210,21 +210,23 @@ EVENT = {
210
210
  /** Registers the _ctrl object by event listener flags in _focusOptions.
211
211
  **/
212
212
  reg: function(_ctrl, _focusOptions) {
213
- var _elemId,
214
- _elem,
215
- _this = EVENT,
216
- _propIn;
213
+ var
217
214
  // Binds the class to the element (so it can be called on the event)
218
- _elemId = _ctrl.elemId;
219
- _elem = ELEM.get(_elemId);
215
+ _elemId = _ctrl.elemId,
216
+ _elem = ELEM.get(_elemId),
217
+ _this = EVENT,
218
+ _propIn,
219
+ _init = ( _this.listeners[_elemId] === undefined || _this.listeners[_elemId] === false );
220
220
  if (BROWSER_TYPE.ie) {
221
221
  _elem.setAttribute('ctrl', _ctrl);
222
222
  }
223
223
  else {
224
224
  _elem.ctrl = _ctrl;
225
225
  }
226
- _this.listeners[_elemId] = true;
227
- _this.focused[_elemId] = false;
226
+ if(_init){
227
+ _this.listeners[_elemId] = true;
228
+ _this.focused[_elemId] = false;
229
+ }
228
230
  for (_propIn in _this._defaultFocusOptions) {
229
231
  if (_focusOptions[_propIn] === undefined) {
230
232
  _focusOptions[_propIn] = _defaultFocusOptions[_propIn];
@@ -264,7 +266,9 @@ EVENT = {
264
266
  _this.resizeListeners.splice(_resizeIndex,1);
265
267
  }
266
268
  }
267
- Event.observe(_elem, 'mouseover', _this._mouseOver);
269
+ if(_init){
270
+ Event.observe(_elem, 'mouseover', _this._mouseOver);
271
+ }
268
272
  if(_ctrl.drawn){
269
273
  _this._updateHoverItems();
270
274
  (_this.hovered.length !== 0) && (_this.hovered.indexOf(_ctrl.elemId) === _this.hovered.length-1) && _this.focus(_ctrl);
@@ -274,9 +278,10 @@ EVENT = {
274
278
  /** Unregisters the _ctrl object event listeners
275
279
  **/
276
280
  unreg: function(_ctrl) {
277
- var _this = EVENT,
278
- _elemId,
279
- _elem;
281
+ var
282
+ _this = EVENT,
283
+ _elemId,
284
+ _elem;
280
285
  if (_ctrl === this.activeControl) {
281
286
  _this.changeActiveControl(null);
282
287
  }
@@ -734,7 +739,7 @@ EVENT = {
734
739
  // if it's no longer the active control.
735
740
  _prevActiveCtrl = _this.activeControl;
736
741
  // Did the active control change?
737
- if ((_ctrl !== _prevActiveCtrl) && (_ctrl._gainedActiveStatus || _prevActiveCtrl._lostActiveStatus)) {
742
+ if (_ctrl && (_ctrl !== _prevActiveCtrl) && (_ctrl._gainedActiveStatus || _prevActiveCtrl._lostActiveStatus)) {
738
743
  if (_prevActiveCtrl && _prevActiveCtrl._lostActiveStatus) {
739
744
  // Previously active control just lost the active status.
740
745
  _prevActiveCtrl.active = false;
@@ -785,7 +790,7 @@ EVENT = {
785
790
  for (; i !== _this.dragItems.length; i++) {
786
791
  _elemId = _this.dragItems[i];
787
792
  _ctrl = _this.focusOptions[_elemId].ctrl;
788
- _ctrl.endDrag(x, y,_isLeftButton);
793
+ _ctrl.endDrag(x, y, _isLeftButton);
789
794
  _didEndDrag = true;
790
795
  // If the mouse slipped off the dragged item before the mouse button was released, blur the item manually
791
796
  if (_this.enableDroppableChecks) {
@@ -808,10 +813,11 @@ EVENT = {
808
813
  document.onselectstart = _this._storedOnSelectStart;
809
814
  }
810
815
  // Check for mouseUp listeners.
811
- for (i = 0; i !== _this.focused.length; i++) {
816
+ for (i = 0; i < _this.focused.length; i++) {
812
817
  if (_this.focused[i] === true) {
818
+ _ctrl = _this.focusOptions[i].ctrl;
813
819
  if (_this.focusOptions[i].mouseUp === true) {
814
- _this.focusOptions[i].ctrl.mouseUp(x, y, _isLeftButton);
820
+ _ctrl.mouseUp(x, y, _isLeftButton);
815
821
  }
816
822
  }
817
823
  }
@@ -860,7 +866,7 @@ EVENT = {
860
866
  keyDown: function(e) {
861
867
  var _this = EVENT,
862
868
  _theKeyCode = e.keyCode,
863
- _keyDownStateForActiveControl = _this.activeControl?_this.focusOptions[_this.activeControl.elemId].keyDown:false,
869
+ _keyDownStateForActiveControl = _this.activeControl?(_this.focusOptions[_this.activeControl.elemId]?_this.focusOptions[_this.activeControl.elemId].keyDown:false):false,
864
870
  _repeat = (_keyDownStateForActiveControl === 'repeat'),
865
871
  _stopEvent = false;
866
872
  _this._modifiers(e);
@@ -902,7 +908,7 @@ EVENT = {
902
908
  _ctrl;
903
909
  _this._modifiers(e);
904
910
  _this._lastKeyDown = null;
905
- if (_this.activeControl && _this.focusOptions[_this.activeControl.elemId].keyUp === true) {
911
+ if (_this.activeControl && _this.activeControl.elemId && _this.focusOptions[_this.activeControl.elemId].keyUp === true) {
906
912
  if(_this.activeControl.keyUp(_theKeyCode)){
907
913
  _stopEvent = true;
908
914
  }
@@ -134,7 +134,7 @@ HRect = HClass.extend({
134
134
  }
135
135
  _parentHeight = _parentSize[1];
136
136
  if(_view.flexBottom){
137
- _this.bottom = _parentWidth - _view.flexBottomOffset - _this.top;
137
+ _this.bottom = _parentHeight - _view.flexBottomOffset - _this.top;
138
138
  }
139
139
  if(!_view.flexTop){
140
140
  _this.top = _this.bottom - _this.height;
@@ -97,7 +97,7 @@ HSystem = {
97
97
  i = 0;
98
98
  for( ; i < this.views.length; i++ ){
99
99
  _view = this.views[i];
100
- if(_view.flexRight || _view.flexBottom){
100
+ if(_view && (_view.flexRight || _view.flexBottom)){
101
101
  _view.rect._updateFlexibleDimensions();
102
102
  }
103
103
  }
@@ -615,7 +615,7 @@ HView = HClass.extend({
615
615
  **/
616
616
  drawRect: function() {
617
617
  if(!this.rect.isValid){
618
- console.log('invalid rect:',ELEM.get(this.elemId));
618
+ console.log('invalid rect:',this.rect);//,ELEM.get(this.elemId));
619
619
  }
620
620
  if(!this.parent){
621
621
  console.log('no parent:',ELEM.get(this.elemId));
@@ -830,8 +830,22 @@ HView = HClass.extend({
830
830
  * A string with the html escaped.
831
831
  **/
832
832
  escapeHTML: function( _html ) {
833
- return _html.replace(/&/gmi, '&amp;').replace(/>/gmi, '&gt;').replace(/</gmi, '&lt;');
834
- },
833
+ if( typeof _html !== 'string' ) {
834
+ return _html.toString();
835
+ }
836
+ for( var i=0, _reFrom, _reTo, _reArr = this._escapeHTMLArr; i < _reArr.length; i++ ){
837
+ _reFrom = _reArr[i][0];
838
+ _reTo = _reArr[i][1];
839
+ _html = _html.replace( _reFrom, _reTo );
840
+ }
841
+ return _html;
842
+ },
843
+ _escapeHTMLArr: [
844
+ [ new RegExp( /&/gmi ), '&amp;' ],
845
+ [ new RegExp( />/gmi ), '&gt;' ],
846
+ [ new RegExp( /</gmi ), '&lt;' ],
847
+ [ new RegExp( /\n/gmi ), '<br>' ]
848
+ ],
835
849
 
836
850
  /** = Description
837
851
  *
@@ -927,7 +941,6 @@ HView = HClass.extend({
927
941
  _validHeight = (typeof _height === 'number'),
928
942
  _right,
929
943
  _bottom;
930
-
931
944
  if(_arrLen === 6){
932
945
  var
933
946
  _parentSize = this.parentSize(),
@@ -976,6 +989,7 @@ HView = HClass.extend({
976
989
  }
977
990
 
978
991
  this.rect = HRect.nu(_leftOffset,_topOffset,_right,_bottom);
992
+
979
993
  }
980
994
  else {
981
995
  console.log(_throwPrefix + 'the length has to be either 4 or 6.');
@@ -74,7 +74,7 @@ HRadioButtonList = HControl.extend({
74
74
  die: function(){
75
75
  this.listItems = null;
76
76
  this.listItemViews = null;
77
- this.radioButtonIndexValue.die();
77
+ this.radioButtonIndexValue && this.radioButtonIndexValue.die();
78
78
  this.base();
79
79
  },
80
80
  radioButtonIndexValue: false,
@@ -105,7 +105,7 @@ HMiniMenu = HRadioButtonList.extend({
105
105
  this.markupElemIds.subview = 0;
106
106
  this.menuItemView = HView.extend({
107
107
  bringToFront: function(){
108
- this.setStyle('z-index',this.app.views.length);
108
+ this.setStyle('z-index',10000);//this.app.views.length);
109
109
  }
110
110
  }).nu(
111
111
  [ this.rect.left, this.rect.top, this.rect.width, 500 ],
@@ -124,6 +124,7 @@ HMiniMenu = HRadioButtonList.extend({
124
124
  setListItems: function(listItems){
125
125
  this.base(listItems);
126
126
  this.valueMatrix = this.menuItemView.valueMatrix;
127
+ this.refreshValue();
127
128
  },
128
129
 
129
130
  createComponent: function( i, _label ){
@@ -142,6 +142,15 @@ module RSence
142
142
  plugin_src = "_bundle_path = #{params[:bundle_path].inspect};" + plugin_src
143
143
  end
144
144
  m.module_eval( plugin_src )
145
+ rescue SyntaxError => e
146
+ src_path = params[:src_path]
147
+ src_path = "<undefined src_path>" if src_path == nil
148
+ params[:plugin_manager].plugin_error(
149
+ e,
150
+ 'BundleLoaderSyntaxError',
151
+ "The syntax of #{params[:bundle_name]} is invalid.",
152
+ src_path
153
+ )
145
154
  rescue => e
146
155
  src_path = params[:src_path]
147
156
  src_path = "<undefined src_path>" if src_path == nil
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsence-pre
3
3
  version: !ruby/object:Gem::Version
4
- hash: 961916100
5
- prerelease: true
4
+ hash: 117
5
+ prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
9
  - 0
10
- - 8
11
- - pre
12
- version: 2.1.0.8.pre
10
+ - 9
11
+ version: 2.1.0.9
13
12
  platform: ruby
14
13
  authors:
15
14
  - Riassence Inc.
@@ -17,7 +16,7 @@ autorequire:
17
16
  bindir: bin
18
17
  cert_chain: []
19
18
 
20
- date: 2010-09-12 00:00:00 +03:00
19
+ date: 2010-10-19 00:00:00 +03:00
21
20
  default_executable: rsence-pre
22
21
  dependencies:
23
22
  - !ruby/object:Gem::Dependency