rsence-pre 2.1.0.7.pre → 2.1.0.8.pre

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.
@@ -552,7 +552,7 @@ HView = HClass.extend({
552
552
  * ++
553
553
  **/
554
554
  _setCSS: function(_additional){
555
- var _cssStyle = 'display:none;overflow:hidden;visibility:hidden;';
555
+ var _cssStyle = 'overflow:hidden;visibility:hidden;';
556
556
  if(this.isAbsolute){
557
557
  _cssStyle += 'position:absolute;';
558
558
  } else {
@@ -568,20 +568,18 @@ HView = HClass.extend({
568
568
  * ++
569
569
  **/
570
570
  _getParentElemId: function(){
571
- var _parentElemId;
572
- // if the parent does not have an element:
573
- if(this.parent.elemId === undefined) {
574
- _parentElemId = 0;
575
- }
576
- // if a subview element is defined in the template, use it:
577
- else if(this.parent.markupElemIds&&this.parent.markupElemIds['subview']){
578
- _parentElemId = this.parent.markupElemIds['subview'];
571
+ var _parent = this.parent;
572
+ return ((_parent.elemId === undefined)?0:((_parent._getSubviewId===undefined)?0:_parent._getSubviewId()));
573
+ },
574
+
575
+ _getSubviewId: function(){
576
+ if(this.markupElemIds&&this.markupElemIds.subview!==undefined){
577
+ return this.markupElemIds.subview;
579
578
  }
580
- // otherwise, use main elemId
581
- else {
582
- _parentElemId = this.parent.elemId;
579
+ else if(this.elemId !== undefined) {
580
+ return this.elemId;
583
581
  }
584
- return _parentElemId;
582
+ return 0;
585
583
  },
586
584
 
587
585
  /** --
@@ -616,30 +614,52 @@ HView = HClass.extend({
616
614
  *
617
615
  **/
618
616
  drawRect: function() {
617
+ if(!this.rect.isValid){
618
+ console.log('invalid rect:',ELEM.get(this.elemId));
619
+ }
620
+ if(!this.parent){
621
+ console.log('no parent:',ELEM.get(this.elemId));
622
+ }
619
623
  if (this.parent && this.rect.isValid) {
620
- var _this = this,
621
- _elemId = _this.elemId,
622
- _styl = ELEM.setStyle,
623
- _rect = _this.rect;
624
-
625
- _styl( _elemId, 'left', _this.flexLeft?(_rect.left+'px'):'auto', true);
626
- _styl( _elemId, 'top', _this.flexTop?(_rect.top+'px'):'auto', true);
627
- _styl( _elemId, 'right', _this.flexRight?(_this.flexRightOffset+'px'):'auto', true);
628
- _styl( _elemId, 'bottom', _this.flexBottom?(_this.flexBottomOffset+'px'):'auto', true);
629
- _styl( _elemId, 'width', (_this.flexLeft&&_this.flexRight)?'auto':(_rect.width+'px'), true);
630
- _styl( _elemId, 'height', (_this.flexTop&&_this.flexBottom)?'auto':(_rect.height+'px'), true);
631
-
624
+ var
625
+ i = 0,
626
+ _this = this,
627
+ _elemId = _this.elemId,
628
+ _styl = ELEM.setStyle,
629
+ _rect = _this.rect,
630
+ _auto = 'auto',
631
+ _left = _this.flexLeft?_rect.left:_auto,
632
+ _top = _this.flexTop?_rect.top:_auto,
633
+ _right = _this.flexRight?_this.flexRightOffset:_auto,
634
+ _bottom = _this.flexBottom?_this.flexBottomOffset:_auto,
635
+ _width = (_this.flexLeft&&_this.flexRight)?_auto:_rect.width,
636
+ _height = (_this.flexTop&&_this.flexBottom)?_auto:_rect.height,
637
+ _styles = [
638
+ [ 'left', _left ],
639
+ [ 'top', _top ],
640
+ [ 'right', _right ],
641
+ [ 'bottom', _bottom ],
642
+ [ 'width', _width ],
643
+ [ 'height', _height ],
644
+ [ 'display', _this.displayMode ]
645
+ ],
646
+ _key, _value;
632
647
  // Show the rectangle once it gets created, unless visibility was set to
633
648
  // hidden in the constructor.
634
- if(_this.isHidden === undefined || _this.isHidden === false) {
635
- _styl( _elemId, 'visibility', 'inherit', true);
649
+ if(!_this.isHidden) {
650
+ _styles.push( [ 'visibility', 'inherit' ] );
651
+ }
652
+ for(;i<_styles.length;i++){
653
+ _key = _styles[i][0];
654
+ _value = _styles[i][1];
655
+ if( i < 6 && _value !== _auto ){
656
+ _value += 'px';
657
+ }
658
+ _styl(_elemId,_key,_value,true);
636
659
  }
637
-
638
- _styl( _elemId, 'display', _this.displayMode, true);
639
-
640
660
  _this._updateZIndex();
641
-
642
- if (_this._cachedLeft !== _rect.left || _this._cachedTop !== _rect.top) {
661
+
662
+ if ( _this._cachedLeft !== _rect.left || _this._cachedTop !== _rect.top) {
643
663
  _this.invalidatePositionCache();
644
664
  _this._cachedLeft = _rect.left;
645
665
  _this._cachedTop = _rect.top;
@@ -688,15 +708,7 @@ HView = HClass.extend({
688
708
  }
689
709
  this.drawSubviews();
690
710
  if(this.options.style){
691
- var
692
- _style = this.options.style,
693
- _styleItem, _styleKey, _styleValue, i = 0;
694
- for(;i<_style.length;i++){
695
- _styleItem = _style[i];
696
- _styleKey = _styleItem[0];
697
- _styleValue = _styleItem[1];
698
- this.setStyle(_styleKey,_styleValue);
699
- }
711
+ this.setStyles( this.options.style );
700
712
  }
701
713
  if(this.options.html){
702
714
  this.setHTML(this.options.html);
@@ -866,17 +878,6 @@ HView = HClass.extend({
866
878
  return [ 0, 0, _parentSize[0], _parentSize[1] ];
867
879
  },
868
880
 
869
- parentSize: function(){
870
- var _parentElemId = this.parent.elemId;
871
- if ( _parentElemId === 0 ) {
872
- return ELEM.windowSize();
873
- }
874
- else {
875
- ELEM.flushLoop();
876
- return ELEM.getSize( _parentElemId );
877
- }
878
- },
879
-
880
881
  minWidth: 0,
881
882
  setMinWidth: function(_minWidth){
882
883
  this.minWidth = _minWidth;
@@ -1007,7 +1008,19 @@ HView = HClass.extend({
1007
1008
  }
1008
1009
  return this;
1009
1010
  },
1010
-
1011
+
1012
+ setStyles: function(_styles){
1013
+ var
1014
+ _styleItem, _styleKey, _styleValue, i = 0;
1015
+ for(;i<_styles.length;i++){
1016
+ _styleItem = _styles[i];
1017
+ _styleKey = _styleItem[0];
1018
+ _styleValue = _styleItem[1];
1019
+ this.setStyle(_styleKey,_styleValue);
1020
+ }
1021
+ return this;
1022
+ },
1023
+
1011
1024
  /** = Description
1012
1025
  * Returns a style of the main DOM element of the component.
1013
1026
  * Utilizes +ELEM+ cache to perform the action.
@@ -1043,7 +1056,7 @@ HView = HClass.extend({
1043
1056
  if (!this['markupElemIds']){
1044
1057
  console.log('Warning, setStyleOfPart: no markupElemIds');
1045
1058
  }
1046
- else if (!this.markupElemIds[_partName]) {
1059
+ else if (this.markupElemIds[_partName]===undefined) {
1047
1060
  console.log('Warning, setStyleOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
1048
1061
  }
1049
1062
  else {
@@ -1065,7 +1078,7 @@ HView = HClass.extend({
1065
1078
  *
1066
1079
  **/
1067
1080
  styleOfPart: function(_partName, _name) {
1068
- if (!this.markupElemIds[_partName]) {
1081
+ if (this.markupElemIds[_partName]===undefined) {
1069
1082
  console.log('Warning, styleOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
1070
1083
  return '';
1071
1084
  }
@@ -1085,7 +1098,7 @@ HView = HClass.extend({
1085
1098
  *
1086
1099
  **/
1087
1100
  setMarkupOfPart: function( _partName, _value ) {
1088
- if (!this.markupElemIds[_partName]) {
1101
+ if (this.markupElemIds[_partName]===undefined) {
1089
1102
  console.log('Warning, setMarkupOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
1090
1103
  }
1091
1104
  else {
@@ -1106,7 +1119,7 @@ HView = HClass.extend({
1106
1119
  *
1107
1120
  **/
1108
1121
  markupOfPart: function(_partName) {
1109
- if (!this.markupElemIds[_partName]) {
1122
+ if (this.markupElemIds[_partName]===undefined) {
1110
1123
  console.log('Warning, markupOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
1111
1124
  return '';
1112
1125
  }
@@ -1628,7 +1641,7 @@ HView = HClass.extend({
1628
1641
  ELEM.setCSS(_stringElem, "visibility:hidden;"+_extraCss);
1629
1642
  ELEM.setHTML(_stringElem, _string);
1630
1643
  // ELEM.flushLoop();
1631
- var _visibleSize=ELEM.getVisibleSize(_stringElem);
1644
+ var _visibleSize=ELEM.getSize(_stringElem);
1632
1645
  // console.log('visibleSize',_visibleSize);
1633
1646
  ELEM.del(_stringElem);
1634
1647
  return [_visibleSize[0]+_visibleSize[0]%2,_visibleSize[1]+_visibleSize[1]%2];
@@ -1649,20 +1662,13 @@ HView = HClass.extend({
1649
1662
  /** Returns the X coordinate that has the scrolled position calculated.
1650
1663
  **/
1651
1664
  pageX: function() {
1652
- var _x = 0,
1653
- _elem = this;
1654
- while(_elem) {
1655
- if(_elem.elemId && _elem.rect) {
1656
- _x += ELEM.get(_elem.elemId).offsetLeft;
1657
- _x -= ELEM.get(_elem.elemId).scrollLeft;
1658
- }
1659
- if(_elem.markupElemIds&&_elem.markupElemIds.subview){
1660
- _x += ELEM.get(_elem.markupElemIds.subview).offsetLeft;
1661
- _x -= ELEM.get(_elem.markupElemIds.subview).scrollLeft;
1662
- }
1663
- _elem = _elem.parent;
1664
- }
1665
- return _x;
1665
+ return ELEM._getVisibleLeftPosition( this.elemId );
1666
+ },
1667
+
1668
+ /** Returns the Y coordinate that has the scrolled position calculated.
1669
+ **/
1670
+ pageY: function() {
1671
+ return ELEM._getVisibleTopPosition( this.elemId );
1666
1672
  },
1667
1673
 
1668
1674
  /** = Description
@@ -1712,25 +1718,6 @@ HView = HClass.extend({
1712
1718
  return this;
1713
1719
  },
1714
1720
 
1715
- /** Returns the Y coordinate that has the scrolled position calculated.
1716
- **/
1717
- pageY: function() {
1718
- var _y = 0,
1719
- _elem = this;
1720
- while(_elem) {
1721
- if(_elem.elemId && _elem.rect) {
1722
- _y += ELEM.get(_elem.elemId).offsetTop;
1723
- _y -= ELEM.get(_elem.elemId).scrollTop;
1724
- }
1725
- if(_elem.markupElemIds&&_elem.markupElemIds.subview){
1726
- _y += ELEM.get(_elem.markupElemIds.subview).offsetTop;
1727
- _y -= ELEM.get(_elem.markupElemIds.subview).scrollTop;
1728
- }
1729
- _elem = _elem.parent;
1730
- }
1731
- return _y;
1732
- },
1733
-
1734
1721
  /** Returns the HPoint that has the scrolled position calculated.
1735
1722
  **/
1736
1723
  pageLocation: function() {
@@ -21,13 +21,13 @@ HPropertyList = HControl.extend({
21
21
  click: true
22
22
  },
23
23
 
24
- controlDefaults: (HControlDefaults.extend({
24
+ controlDefaults: HControlDefaults.extend({
25
25
  keyColumnWidth: 100,
26
26
  hideTypeColumn: false,
27
27
  useEditor: false,
28
28
  rowHeight: 15,
29
29
  keyIndent: 8
30
- })),
30
+ }),
31
31
 
32
32
  click: function(x,y){
33
33
  if(this.options.useEditor){
@@ -91,10 +91,17 @@ HPropertyList = HControl.extend({
91
91
  this.separatortParentElemId = separatorParentElemId;
92
92
 
93
93
  this.propertyItems = [];
94
-
95
94
  // Editor initialization
96
95
  if(this.options.useEditor){
97
- this.editorValue = HValue.nu( false, [ 'test', 's', 'Test String' ] );
96
+ this.editorValue = HValue.nu(
97
+ false, {
98
+ top: 0,
99
+ left: 0,
100
+ type: 'h',
101
+ name: '--',
102
+ value: {}
103
+ }
104
+ );
98
105
  this.editor = HPropertyListEditor.nu(
99
106
  [0,0,null,this.options.rowHeight+2,0,null],
100
107
  this.contentView, {
@@ -495,7 +502,7 @@ HPropertyList = HControl.extend({
495
502
  }
496
503
 
497
504
  this.selectedItem = itemNum;
498
- this.editorValue.set(this.valueTokens[itemNum]);
505
+ this.editorValue.set( COMM.Values.clone(this.valueTokens[itemNum]) );
499
506
  this.editor.show();
500
507
  EVENT.changeActiveControl(this.editor);
501
508
  this.editor.offsetTo( 0, targetY );
@@ -59,7 +59,9 @@ HPropertyListEditor = HControl.extend({
59
59
 
60
60
  lostActiveStatus: function(newActive){
61
61
  this.base();
62
- if(newActive && ((newActive === this) || (newActive.parents.indexOf(this) !== -1)) ){
62
+ if( newActive &&
63
+ ( (newActive === this) || (newActive.parents.indexOf(this) !== -1) )
64
+ ){
63
65
  return;
64
66
  }
65
67
  this.hide();
@@ -111,12 +113,11 @@ HPropertyListEditor = HControl.extend({
111
113
  var
112
114
  parent = this.parent.parent,
113
115
  opts = parent.options;
114
-
115
116
  this.nameEditor = HTextControl.extend({
116
117
  boldTypes: ['a','h'],
117
118
  lostActiveStatus: function(newActive){
118
- this.parent.lostActiveStatus(newActive);
119
119
  this.base();
120
+ this.parent.lostActiveStatus(newActive);
120
121
  },
121
122
  refreshValue: function(){
122
123
  if(this.drawn){
@@ -141,7 +142,6 @@ HPropertyListEditor = HControl.extend({
141
142
 
142
143
  var
143
144
  height = this.nameEditor.rect.height;
144
-
145
145
  if(!opts.hideTypeColumn){
146
146
  this.typeEditor = HMiniMenu.extend({
147
147
  lostActiveStatus: function(newActive){
@@ -17,8 +17,7 @@ HMiniMenu = HRadioButtonList.extend({
17
17
  componentName: 'minimenu',
18
18
 
19
19
  defaultEvents: {
20
- mouseDown: true,
21
- mouseUp: true,
20
+ draggable: true,
22
21
  click: true
23
22
  },
24
23
 
@@ -52,7 +51,7 @@ HMiniMenu = HRadioButtonList.extend({
52
51
  },
53
52
 
54
53
  click: function(){
55
- this.mouseDown();
54
+ this.menuShow();
56
55
  },
57
56
 
58
57
  refreshValue: function(){
@@ -60,22 +59,40 @@ HMiniMenu = HRadioButtonList.extend({
60
59
  for(var i=0;i<this.listItems.length;i++){
61
60
  if(this.listItems[i][0]===this.value){
62
61
  this.setLabel( this.listItems[i][1] );
63
- break;
62
+ return;
64
63
  }
65
64
  }
66
65
  },
67
66
 
68
- mouseDown: function(){
67
+ menuShow: function(){
69
68
  this.repositionMenuItems();
70
69
  this.menuItemView.bringToFront();
71
70
  this.menuItemView.show();
72
71
  return true;
73
72
  },
74
73
 
74
+ menuHide: function(){
75
+ this.menuItemView.sendToBack();
76
+ this.menuItemView.hide();
77
+ },
78
+
79
+ startDrag: function(x,y){
80
+ this.dragStart = [x,y];
81
+ this.menuShow();
82
+ },
83
+
75
84
  lostActiveStatus: function(newActive){
76
- this.base(newActive);
77
- if((newActive.parent !== this.menuItemView) && (newActive !== this.menuItemView)){
78
- this.menuItemView.hide();
85
+ this.menuHide();
86
+ },
87
+
88
+ endDrag: function(x,y){
89
+ if( (Math.round(this.dragStart[0]*0.2)===Math.round(x*0.2)) &&
90
+ (Math.round(this.dragStart[1]*0.2)===Math.round(y*0.2))
91
+ ){
92
+ this.menuShow();
93
+ }
94
+ else {
95
+ this.menuHide();
79
96
  }
80
97
  },
81
98
 
@@ -85,15 +102,21 @@ HMiniMenu = HRadioButtonList.extend({
85
102
  },
86
103
 
87
104
  drawSubviews: function(){
105
+ this.markupElemIds.subview = 0;
88
106
  this.menuItemView = HView.extend({
89
- drawSubviews: function(){
90
- this.setStyle( 'background-color','#f6f6f6' );
91
- this.setStyle( 'border', '1px solid #999' );
107
+ bringToFront: function(){
108
+ this.setStyle('z-index',this.app.views.length);
92
109
  }
93
110
  }).nu(
94
111
  [ this.rect.left, this.rect.top, this.rect.width, 500 ],
95
- this.app, {
96
- visible: false
112
+ this, {
113
+ visible: false,
114
+ style: [
115
+ ['background-color','#f6f6f6'],
116
+ ['border', '1px solid #999'],
117
+ ['overflow-y', 'auto'],
118
+ ['opacity', 0.9]
119
+ ]
97
120
  }
98
121
  );
99
122
  },
@@ -22,7 +22,7 @@ HMiniMenuItem = HRadioButton.extend({
22
22
 
23
23
  click: function(){
24
24
  this.base();
25
- this.parent.hide();
25
+ EVENT.changeActiveControl(this.parent.parent);
26
26
  },
27
27
 
28
28
  mouseUp: function(){
@@ -37,7 +37,7 @@
37
37
  font-size: 11px;
38
38
  color: #333;
39
39
  }
40
- .minimenuitem_control:hover > .minimenuitem_label {
40
+ .minimenuitem_label:hover {
41
41
  color: #000;
42
42
  }
43
43
  .disabled .minimenuitem_control {
data/lib/conf/argv.rb CHANGED
@@ -19,6 +19,25 @@ module RSence
19
19
  return (not ['i386-mingw32','x86-mingw32'].include?(RUBY_PLATFORM))
20
20
  end
21
21
 
22
+ # @private Returns true, if platform is linux
23
+ def self.linux?
24
+ return RUBY_PLATFORM.end_with?('-linux')
25
+ end
26
+
27
+ # @private Returns true, if platform is Mac OS X
28
+ def self.darwin?
29
+ return RUBY_PLATFORM.include?('-darwin')
30
+ end
31
+
32
+ # @private Returns signal name that resembles INFO or PWR (extra signal to poll for server status)
33
+ def self.info_signal_name
34
+ if self.linux?
35
+ return 'PWR'
36
+ else
37
+ return 'INFO'
38
+ end
39
+ end
40
+
22
41
  # @private ARGVParser is the "user interface" as a command-line argument parser.
23
42
  # It parses the command-line arguments and sets up things accordingly.
24
43
  class ARGVParser
@@ -327,7 +346,8 @@ module RSence
327
346
  end
328
347
  end
329
348
 
330
- # Main argument parser for the status command, sends the INFO POSIX signal to the process, if running.
349
+ # Main argument parser for the status command, sends the INFO (or PWR on linux) POSIX signal to
350
+ # the process, if running.
331
351
  # Checks if the process responds on the port and address it's configured for.
332
352
  def parse_status_argv
333
353
  init_args
@@ -406,8 +426,9 @@ module RSence
406
426
  pid_fn = config[:daemon][:pid_fn]
407
427
  if File.exists?( pid_fn )
408
428
  pid = File.read( pid_fn ).to_i
429
+ sig_name = RSence.info_signal_name
409
430
  pid_status = RSence::SIGComm.wait_signal_response(
410
- pid, pid_fn, 'INFO', 3
431
+ pid, pid_fn, sig_name, 3
411
432
  )
412
433
  else
413
434
  warn @@strs[:messages][:no_pid_file] if @args[:verbose]
data/lib/daemon/daemon.rb CHANGED
@@ -47,7 +47,7 @@ module RSence
47
47
  end
48
48
 
49
49
  def self.responds?( daemon )
50
- wait_signal_response( daemon, 'INFO' )
50
+ wait_signal_response( daemon, RSence.info_signal_name )
51
51
  end
52
52
 
53
53
  # Reads the pid file and calls the process.
@@ -123,9 +123,9 @@ module RSence
123
123
  daemon.alrm
124
124
  write_signal_response( daemon, 'ALRM' )
125
125
  end
126
- Signal.trap( 'INFO' ) do
126
+ Signal.trap( RSence.info_signal_name ) do
127
127
  daemon.info
128
- write_signal_response( daemon, 'INFO' )
128
+ write_signal_response( daemon, RSence.info_signal_name )
129
129
  end
130
130
  ['INT', 'TERM', 'KILL'].each do | signal |
131
131
  Signal.trap( signal ) do
@@ -355,7 +355,7 @@ module RSence
355
355
  # save
356
356
  # end
357
357
 
358
- # Called on INFO signals ("Alive?")
358
+ # Called on INFO (PWR) signals ("Alive?")
359
359
  def info
360
360
  puts "#{Time.now.strftime('%Y-%m-%d %H:%M:%S')} -- RSence version #{RSence.version} is running."
361
361
  end
@@ -253,9 +253,10 @@ module RSence
253
253
  end
254
254
  if is_dir
255
255
  Dir.entries( bundle_path ).each do |entry_name|
256
- next if entry_name[0].chr == '.'
256
+ next if entry_name[0].chr == '.' # skip hidden, '.' and '..'
257
257
  full_path = File.join( bundle_path, entry_name )
258
258
  unless File.directory?( full_path )
259
+ next if entry_name == 'plugins' # skip sub-plugins
259
260
  has_dot = entry_name.include?('.')
260
261
  next unless has_dot
261
262
  is_src_file = ['yaml','rb'].include?( entry_name.split('.')[-1] )
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsence-pre
3
3
  version: !ruby/object:Gem::Version
4
- hash: 961916152
4
+ hash: 961916100
5
5
  prerelease: true
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
9
  - 0
10
- - 7
10
+ - 8
11
11
  - pre
12
- version: 2.1.0.7.pre
12
+ version: 2.1.0.8.pre
13
13
  platform: ruby
14
14
  authors:
15
15
  - Riassence Inc.
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-09-09 00:00:00 +03:00
20
+ date: 2010-09-12 00:00:00 +03:00
21
21
  default_executable: rsence-pre
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency