rsence-pre 2.2.0.38 → 2.2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/INSTALL.rdoc +1 -1
  2. data/VERSION +1 -1
  3. data/conf/default_conf.yaml +0 -4
  4. data/conf/rsence_command_strings.yaml +1 -1
  5. data/js/comm/queue/queue.js +17 -8
  6. data/js/comm/transporter/transporter.js +117 -93
  7. data/js/comm/values/values.js +2 -2
  8. data/js/controls/button/themes/bright/button_parts1.png +0 -0
  9. data/js/controls/button/themes/default/button_parts1.png +0 -0
  10. data/js/controls/checkbox/themes/default/checkbox_parts1.png +0 -0
  11. data/js/controls/dialogs/sheet/sheet.js +1 -1
  12. data/js/controls/dialogs/sheet/themes/default/sheet_bg.png +0 -0
  13. data/js/controls/dialogs/sheet/themes/default/sheet_dim.png +0 -0
  14. data/js/controls/dialogs/sheet/themes/default/sheet_parts1.png +0 -0
  15. data/js/controls/dialogs/sheet/themes/default/sheet_parts2.png +0 -0
  16. data/js/controls/dialogs/sheet/themes/default/sheet_warning.png +0 -0
  17. data/js/controls/radiobutton/themes/default/radiobutton_parts1.png +0 -0
  18. data/js/controls/searchfield/themes/default/searchfield.css +3 -3
  19. data/js/controls/searchfield/themes/default/searchfield_parts1.png +0 -0
  20. data/js/controls/sliders/slider/themes/default/hslider_tracks.png +0 -0
  21. data/js/controls/sliders/slider/themes/default/slider_thumbs.png +0 -0
  22. data/js/controls/sliders/vslider/themes/default/vslider_tracks.png +0 -0
  23. data/js/controls/tab/tab.js +4 -3
  24. data/js/controls/tab/themes/bright/tab_bg_color.png +0 -0
  25. data/js/controls/tab/themes/bright/tab_border_pattern.png +0 -0
  26. data/js/controls/tab/themes/bright/tab_parts1.png +0 -0
  27. data/js/controls/tab/themes/default/tab_bg_color.png +0 -0
  28. data/js/controls/tab/themes/default/tab_border_pattern.png +0 -0
  29. data/js/controls/tab/themes/default/tab_parts1.png +0 -0
  30. data/js/controls/textcontrol/textcontrol.js +3 -1
  31. data/js/controls/textcontrol/themes/default/textcontrol.css +1 -1
  32. data/js/controls/textcontrol/themes/default/textcontrol_parts1.png +0 -0
  33. data/js/controls/textcontrol/themes/default/textcontrol_parts2.png +0 -0
  34. data/js/controls/textcontrol/themes/default/textcontrol_parts3.png +0 -0
  35. data/js/controls/validatorview/themes/default/validator.png +0 -0
  36. data/js/controls/window/themes/default/window.css +66 -54
  37. data/js/controls/window/themes/default/window.html +6 -2
  38. data/js/controls/window/themes/default/window_bg_active.png +0 -0
  39. data/js/controls/window/themes/default/window_bg_inactive.png +0 -0
  40. data/js/controls/window/themes/default/window_buttons.png +0 -0
  41. data/js/controls/window/themes/default/window_parts1.png +0 -0
  42. data/js/controls/window/themes/default/window_parts2.png +0 -0
  43. data/js/controls/window/window.js +167 -40
  44. data/js/core/class/class.js +10 -0
  45. data/js/core/elem/elem.coffee +54 -27
  46. data/js/core/event/event.js +2 -2
  47. data/js/datetime/calendar/calendar.coffee +24 -8
  48. data/js/datetime/calendar/themes/default/calendar.html +2 -2
  49. data/js/datetime/calendar/themes/default/calendar_arrows.png +0 -0
  50. data/js/datetime/calendar/themes/default/calendar_bg.png +0 -0
  51. data/js/datetime/calendar/themes/default/calendar_parts1.png +0 -0
  52. data/js/datetime/calendar/themes/default/calendar_parts2.png +0 -0
  53. data/js/datetime/timesheet_item/themes/default/timesheet_item_icons.png +0 -0
  54. data/js/datetime/timesheet_item/timesheet_item.js +1 -1
  55. data/js/foundation/application/application.js +28 -7
  56. data/js/foundation/control/eventresponder/eventresponder.js +7 -4
  57. data/js/foundation/eventmanager/eventmanager.js +28 -3
  58. data/js/foundation/geom/rect/rect.js +83 -46
  59. data/js/foundation/json_renderer/json_renderer.js +5 -5
  60. data/js/foundation/thememanager/thememanager.js +3 -0
  61. data/js/foundation/view/markupview/markupview.js +13 -13
  62. data/js/foundation/view/view.js +209 -56
  63. data/js/lists/propertylist/propertylist.js +33 -31
  64. data/js/menus/minimenu/minimenu.js +23 -6
  65. data/js/menus/minimenu/themes/default/minimenu.png +0 -0
  66. data/js/menus/minimenuitem/minimenuitem.js +11 -1
  67. data/js/menus/minimenuitem/themes/default/minimenuitem_checkmark.png +0 -0
  68. data/js/menus/popupmenu/themes/default/popupmenu.png +0 -0
  69. data/js/util/reloadapp/themes/default/reloadapp_warning.png +0 -0
  70. data/lib/rsence/argv/startup_argv.rb +1 -1
  71. data/lib/rsence/daemon.rb +2 -2
  72. data/lib/rsence/default_config.rb +2 -2
  73. data/lib/rsence/http/broker.rb +2 -4
  74. data/lib/rsence/msg.rb +1 -0
  75. data/lib/rsence/plugins/plugin.rb +11 -4
  76. data/lib/rsence/sessionmanager.rb +99 -37
  77. data/lib/rsence/sessionstorage.rb +29 -15
  78. data/lib/rsence/transporter.rb +3 -5
  79. data/plugins/client_pkg/client_pkg.rb +7 -8
  80. data/plugins/client_pkg/lib/client_pkg_build.rb +212 -95
  81. data/plugins/client_pkg/lib/client_pkg_cache.rb +1 -1
  82. data/plugins/main/main.rb +5 -1
  83. data/plugins/ticket/ticket.rb +9 -1
  84. metadata +72 -66
@@ -29,7 +29,7 @@
29
29
  .window_titlebar {
30
30
  opacity: 0.97;
31
31
  }
32
- .inactive .window_titlebar {
32
+ .inactive > .window_titlebar {
33
33
  opacity: 0.95;
34
34
  }
35
35
 
@@ -41,18 +41,18 @@
41
41
  box-shadow: 3px 3px 20px #333, 3px 3px 10px #000;
42
42
  }
43
43
 
44
- .inactive .window_shadow {
44
+ .inactive > .window_shadow {
45
45
  -moz-box-shadow: 3px 3px 13px #333;
46
46
  -webkit-box-shadow: 3px 3px 13px #333;
47
47
  box-shadow: 3px 3px 13px #333;
48
48
  }
49
49
 
50
- .window_controls * {
50
+ .window_controls {
51
51
  cursor: pointer;
52
52
  }
53
53
 
54
54
  .window_titlebar {
55
- left: 0px; top: 0px; height: 24px; min-width: 96px; right: 0px;
55
+ left: 0; top: 0; height: 24px; min-width: 96px; right: 0;
56
56
  }
57
57
 
58
58
  .window_titlebar * {
@@ -60,33 +60,33 @@
60
60
  }
61
61
 
62
62
  .window_titlebar_edge_left {
63
- left: 0px; top: 0px; width: 24px; height: 24px;
64
- background-position: 0px 0px;
63
+ left: 0; top: 0; width: 24px; height: 24px;
64
+ background-position: 0 0;
65
65
  }
66
66
 
67
- .inactive .window_titlebar_edge_left {
68
- background-position: 0px -48px;
67
+ .inactive > .window_titlebar > .window_titlebar_edge_left {
68
+ background-position: 0 -48px;
69
69
  }
70
70
 
71
71
  .window_titlebar_edge_right {
72
- right: 0px; top: 0px; width: 24px; height: 24px;
73
- background-position: -24px 0px;
72
+ right: 0; top: 0; width: 24px; height: 24px;
73
+ background-position: -24px 0;
74
74
  }
75
75
 
76
- .inactive .window_titlebar_edge_right {
77
- right: 0px; top: 0px; width: 24px; height: 24px;
76
+ .inactive > .window_titlebar > .window_titlebar_edge_right {
77
+ right: 0; top: 0; width: 24px; height: 24px;
78
78
  background-position: -24px -48px;
79
79
  }
80
80
 
81
81
  .window_titlebar_center {
82
- left: 24px; top: 0px; right: 24px; height: 24px;
83
- background-position: 0px 0px;
82
+ left: 24px; top: 0; right: 24px; height: 24px;
83
+ background-position: 0 0;
84
84
  background-repeat: repeat-x;
85
85
  background-image: #{this.getCssFilePath('window_parts2.png')};
86
86
  }
87
87
 
88
- .inactive .window_titlebar_center {
89
- background-position: 0px -48px;
88
+ .inactive > .window_titlebar > .window_titlebar_center {
89
+ background-position: 0 -48px;
90
90
  }
91
91
 
92
92
  .window_bg {
@@ -95,12 +95,12 @@
95
95
  background-image: #{this.getCssFilePath('window_bg_active.png')};
96
96
  }
97
97
 
98
- .inactive .window_bg {
98
+ .inactive > .window_bg {
99
99
  background-image: #{this.getCssFilePath('window_bg_inactive.png')};
100
100
  }
101
101
 
102
102
  .window_body {
103
- left: 0px; top: 24px; right: 0px; bottom: 0px;
103
+ left: 0; top: 24px; right: 0; bottom: 0;
104
104
  }
105
105
 
106
106
  .window_body * {
@@ -108,55 +108,55 @@
108
108
  }
109
109
 
110
110
  .window_body_edge_left {
111
- left: 0px; top: 0px; bottom: 24px; width: 24px;
111
+ left: 0; top: 0; bottom: 24px; width: 24px;
112
112
  background-repeat: repeat-y;
113
- background-position: -72px 0px;
113
+ background-position: -72px 0;
114
114
  }
115
115
 
116
- .inactive .window_body_edge_left {
117
- background-position: -120px 0px;
116
+ .inactive > .window_body > .window_body_edge_left {
117
+ background-position: -120px 0;
118
118
  }
119
119
 
120
120
  .window_body_edge_right {
121
- right: 0px; top: 0px; bottom: 24px; width: 24px;
121
+ right: 0; top: 0; bottom: 24px; width: 24px;
122
122
  background-repeat: repeat-y;
123
- background-position: -96px 0px;
123
+ background-position: -96px 0;
124
124
  }
125
125
 
126
- .inactive .window_body_edge_right {
127
- background-position: -144px 0px;
126
+ .inactive > .window_body > .window_body_edge_right {
127
+ background-position: -144px 0;
128
128
  }
129
129
 
130
130
  .window_body_corner_left {
131
- left: 0px; bottom: 0px; height: 24px; width: 24px;
132
- background-position: 0px -24px;
131
+ left: 0; bottom: 0; height: 24px; width: 24px;
132
+ background-position: 0 -24px;
133
133
  }
134
- .inactive .window_body_corner_left {
135
- background-position: 0px -72px;
134
+ .inactive > .window_body > .window_body_corner_left {
135
+ background-position: 0 -72px;
136
136
  }
137
137
 
138
138
  .window_body_corner_right {
139
- right: 0px; bottom: 0px; height: 24px; width: 24px;
139
+ right: 0; bottom: 0; height: 24px; width: 24px;
140
140
  background-position: -24px -24px;
141
141
  }
142
142
 
143
- .inactive .window_body_corner_right {
143
+ .inactive > .window_body > .window_body_corner_right {
144
144
  background-position: -24px -72px;
145
145
  }
146
146
 
147
147
  .window_body_edge_bottom {
148
- left: 24px; bottom: 0px; right: 24px; height: 24px;
148
+ left: 24px; bottom: 0; right: 24px; height: 24px;
149
149
  background-repeat: repeat-x;
150
- background-position: 0px -24px;
150
+ background-position: 0 -24px;
151
151
  background-image: #{this.getCssFilePath('window_parts2.png')};
152
152
  }
153
153
 
154
- .inactive .window_body_edge_bottom {
155
- background-position: 0px -72px;
154
+ .inactive > .window_body > .window_body_edge_bottom {
155
+ background-position: 0 -72px;
156
156
  }
157
157
 
158
158
  .window_label {
159
- left: 0px; top: 0px; right: 0px; height: 24px;
159
+ left: 0; top: 0; right: 0; height: 24px;
160
160
  line-height: 26px;
161
161
  text-align: center;
162
162
  vertical-align: middle;
@@ -166,29 +166,29 @@
166
166
  color: #000;
167
167
  }
168
168
 
169
- .inactive .window_label {
169
+ .inactive > .window_label {
170
170
  color: #666;
171
171
  }
172
172
 
173
173
  .window_controls {
174
- left: 0px; top: 0px; right: 0px; bottom: 0px;
174
+ left: 0; top: 0; right: 0; bottom: 0;
175
175
  }
176
176
 
177
177
  .window_subview {
178
- left: 2px; top: 26px; right: 2px; bottom: 2px;
178
+ left: 2px; top: 24px; right: 2px; bottom: 2px;
179
179
  }
180
180
 
181
181
  .window_resize_se {
182
182
  position: absolute;
183
- right: 0px; bottom: 0px; width: 13px; height: 13px;
183
+ right: 0; bottom: 0; width: 13px; height: 13px;
184
184
  cursor: se-resize;
185
185
  z-index: 10000;
186
186
  background-position: -59px -35px;
187
- font-size: 0px;
187
+ font-size: 0;
188
188
  background-image: #{this.getCssFilePath('window_parts1.png')};
189
189
  }
190
190
 
191
- .inactive .window_resize_se {
191
+ .inactive > .window_resize_se {
192
192
  background-position: -59px -83px;
193
193
  }
194
194
 
@@ -201,42 +201,54 @@
201
201
 
202
202
  .window_controls_close {
203
203
  #{BROWSER_TYPE.mac?'left':'right'}: 8px;
204
- background-position: 0px 0px;
204
+ background-position: 0 0;
205
+ }
206
+
207
+ .window_controls_close.disable_close {
208
+ opacity: 0.3;
205
209
  }
206
210
 
207
- .window_controls:hover .window_controls_close {
208
- background-position: 0px -15px;
211
+ .window_controls:hover .window_controls_close.enable_close {
212
+ background-position: 0 -15px;
209
213
  }
210
214
 
211
- .window_controls:hover .window_controls_close:active {
212
- background-position: 0px -30px;
215
+ .window_controls:hover .window_controls_close:active.enable_close {
216
+ background-position: 0 -30px;
213
217
  }
214
218
 
215
219
 
216
220
  .window_controls_collapse {
217
221
  #{BROWSER_TYPE.mac?'left: 27px':'right: 46px'};
218
- background-position: -30px 0px;
222
+ background-position: -30px 0;
219
223
  }
220
224
 
221
- .window_controls:hover .window_controls_collapse {
225
+ .window_controls_collapse.disable_collapse {
226
+ opacity: 0.3;
227
+ }
228
+
229
+ .window_controls:hover .window_controls_collapse.enable_collapse {
222
230
  background-position: -30px -15px;
223
231
  }
224
232
 
225
- .window_controls:hover .window_controls_collapse:active {
233
+ .window_controls:hover .window_controls_collapse:active.enable_collapse {
226
234
  background-position: -30px -30px;
227
235
  }
228
236
 
229
237
 
230
238
  .window_controls_zoom {
231
239
  #{BROWSER_TYPE.mac?'left: 46px':'right: 27px'};
232
- background-position: -15px 0px;
240
+ background-position: -15px 0;
241
+ }
242
+
243
+ .window_controls_zoom.disable_zoom {
244
+ opacity: 0.3;
233
245
  }
234
246
 
235
- .window_controls:hover .window_controls_zoom {
247
+ .window_controls:hover .window_controls_zoom.enable_zoom {
236
248
  background-position: -15px -15px;
237
249
  }
238
250
 
239
- .window_controls:hover .window_controls_zoom:active {
251
+ .window_controls:hover .window_controls_zoom:active.enable_zoom {
240
252
  background-position: -15px -30px;
241
253
  }
242
254
 
@@ -14,6 +14,10 @@ ${this.setStyle('overflow','visible')}
14
14
  <div class="window_body_corner_right"></div>
15
15
  </div>
16
16
  <div class="window_label" id="label#{_ID}">#{this.label}</div>
17
- <div class="window_controls" id="control#{_ID}">#{this.options.closeButton?'<div class="window_controls_close" onclick="HSystem.views['+this.viewId+'].windowClose();"></div>':''}#{this.options.collapseButton?'<div class="window_controls_collapse" onclick="HSystem.views['+this.viewId+'].windowCollapse();"></div>':''}#{this.options.zoomButton?'<div class="window_controls_zoom" onclick="HSystem.views['+this.viewId+'].windowZoom();"></div>':''}</div>
17
+ <div class="window_controls" id="control#{_ID}">
18
+ <div class="window_controls_close" id="close#{_ID}"></div>
19
+ <div class="window_controls_collapse" id="collapse#{_ID}"></div>
20
+ <div class="window_controls_zoom" id="zoom#{_ID}"></div>
21
+ </div>
18
22
  <div class="window_subview" id="subview#{_ID}"></div>
19
- #{this.options.noResize?'':'<div class="window_resize_se"></div>'}
23
+ <div class="window_resize_se" id="resize#{_ID}"></div>
@@ -51,7 +51,7 @@ HWindow = HDynControl.extend({
51
51
  * +resizeSE+:: The size of the south-east (right bottom) resizable corner.
52
52
  * Defaults to +[ 16, 16 ]+
53
53
  * +noResize+:: A flag (when true) disables all resizing and only allows
54
- * moving.
54
+ * moving. Does not disable the (-) and (+) buttons.
55
55
  * +fullWindowMove+:: A flag (when true) enables the full HWindow area
56
56
  * responds to drag events. By default it's false,
57
57
  * meaning only the title bar is draggable.
@@ -64,12 +64,15 @@ HWindow = HDynControl.extend({
64
64
  * disabled. When enabled, extend the
65
65
  * HWindow#windowCollapse method, which by default
66
66
  * zooms the window to its +minSize+.
67
+ * +minimizeButton+:: An alias for +collapseButton+
67
68
  * +zoomButton+:: A flag (when true) enables the zoom (or maximize)
68
69
  * button of the HWindow instance. By default it's
69
70
  * disabled. When enabled, extend the
70
71
  * HWindow#windowZoom method, which by default zooms the
71
72
  * contents of the HWindow to fit or the +maxSize+ depending
72
73
  * on which is smaller.
74
+ * +resizeButton+:: An alias for +zoomButton+
75
+ * +maximizeButton+:: An alias for +zoomButton+
73
76
  *
74
77
  **/
75
78
  controlDefaults: (HDynControl.prototype.controlDefaults.extend({
@@ -104,7 +107,7 @@ HWindow = HDynControl.extend({
104
107
  this.resizeSW = [ 6, 6 ];
105
108
  }
106
109
  if(!this.resizeSE){
107
- this.resizeSE = [ 16, 16 ];
110
+ this.resizeSE = [ 25, 25 ];
108
111
  }
109
112
  },
110
113
  maxX: 'auto',
@@ -117,7 +120,10 @@ HWindow = HDynControl.extend({
117
120
  fullWindowMove: false,
118
121
  closeButton: false,
119
122
  collapseButton: false,
120
- zoomButton: false
123
+ minimizeButton: false,
124
+ zoomButton: false,
125
+ resizeButton: false,
126
+ maximizeButton: false
121
127
  })),
122
128
 
123
129
  draw: function(){
@@ -127,6 +133,61 @@ HWindow = HDynControl.extend({
127
133
  HSystem.windowFocus(this);
128
134
  }
129
135
  },
136
+
137
+ markupElemNames: [
138
+ 'label', 'control', 'subview', 'close', 'collapse', 'zoom', 'resize'
139
+ ],
140
+
141
+ refreshWidgetStates: function(){
142
+ if(!this.drawn){ return; }
143
+ var
144
+ _this = this,
145
+ _opts = _this.options,
146
+ _elemId, _elem,
147
+ // _elemId = _this.markupElemIds.zoom,
148
+ // _elem = ELEM.get(_elemId),
149
+ _enablePrefix = 'enable_', _disablePrefix = 'disable_',
150
+ _listenEvent = 'click',
151
+ _addClass, _delClass,
152
+ _widgets = [
153
+ [ 'zoom', (_this.enabled && (_opts.zoomButton || _opts.maximizeButton || _opts.resizeButton)), function(){_this.windowZoom();} ],
154
+ [ 'collapse', (_this.enabled && (_opts.collapseButton || _opts.minimizeButton)), function(){_this.windowCollapse();} ],
155
+ [ 'close', (_this.enabled && _opts.closeButton), function(){_this.windowClose();} ]
156
+ ],
157
+ _elemName, _enabled, _callback,
158
+ _item, i = 0;
159
+ for(;i<_widgets.length;i++){
160
+ _item = _widgets[i];
161
+ _elemName = _item[0];
162
+ _enabled = _item[1];
163
+ _callback = _item[2];
164
+ _elemId = _this.markupElemIds[_elemName];
165
+ _elem = ELEM.get(_elemId);
166
+ Event.stopObserving( _elem, _listenEvent, _callback );
167
+ if(_enabled){
168
+ Event.observe( _elem, _listenEvent, _callback );
169
+ _addClass = _enablePrefix+_elemName;
170
+ _delClass = _disablePrefix+_elemName;
171
+ }
172
+ else {
173
+ _delClass = _enablePrefix+_elemName;
174
+ _addClass = _disablePrefix+_elemName;
175
+ }
176
+ ELEM.addClassName( _elemId, _addClass );
177
+ ELEM.delClassName( _elemId, _delClass );
178
+ }
179
+ _this.setStyleOfPart('resize','visibility',(_opts.noResize?'hidden':'inherit'));
180
+ },
181
+
182
+ drawSubviews: function(){
183
+ this.base();
184
+ this.refreshWidgetStates();
185
+ },
186
+
187
+ setEnabled: function(_state){
188
+ this.base(_state);
189
+ this.refreshWidgetStates();
190
+ },
130
191
 
131
192
  // -- overrides the drag rules to adapt to the !fullWindowMove as well
132
193
  // as disabling draggability in window button areas. ++
@@ -143,10 +204,10 @@ HWindow = HDynControl.extend({
143
204
  _opts = _this.options,
144
205
  _leftPx=_opts.resizeW;
145
206
  if(!_opts.fullWindowMove){
146
- if(_opts.zoomButton){
207
+ if(_opts.zoomButton || _opts.maximizeButton || _opts.resizeButton){
147
208
  _leftPx = 61;
148
209
  }
149
- else if(_opts.collapseButton){
210
+ else if(_opts.collapseButton || _opts.minimizeButton){
150
211
  _leftPx = 46;
151
212
  }
152
213
  else if(_opts.closeButton){
@@ -158,18 +219,18 @@ HWindow = HDynControl.extend({
158
219
  },
159
220
 
160
221
  maxRect: function(){
161
- var _rect = this.base();
162
- if(_rect[2]<this.options.minSize[0]){
163
- _rect[2] = this.options.minSize[0];
222
+ var _rect = this.base(), _opts = this.options;
223
+ if(_rect[2]<_opts.minSize[0]){
224
+ _rect[2] = _opts.minSize[0];
164
225
  }
165
- else if(_rect[2]>this.options.maxSize[0]){
166
- _rect[2] = this.options.maxSize[0];
226
+ else if(_rect[2]>_opts.maxSize[0]){
227
+ _rect[2] = _opts.maxSize[0];
167
228
  }
168
- if(_rect[3]<this.options.minSize[1]){
169
- _rect[3] = this.options.minSize[1];
229
+ if(_rect[3]<_opts.minSize[1]){
230
+ _rect[3] = _opts.minSize[1];
170
231
  }
171
- else if(_rect[3]>this.options.maxSize[1]){
172
- _rect[3] = this.options.maxSize[1];
232
+ else if(_rect[3]>_opts.maxSize[1]){
233
+ _rect[3] = _opts.maxSize[1];
173
234
  }
174
235
  return _rect;
175
236
  },
@@ -204,44 +265,74 @@ HWindow = HDynControl.extend({
204
265
  windowClose: function(){
205
266
  this.die(); // extend this to this.app.die(), if your app needs to die instead of just the window
206
267
  },
268
+
269
+ setLabel: function(_label){
270
+ this.base(_label);
271
+ var
272
+ _labelWidth = 128 + _win.stringWidth( _win.label );
273
+ if(this._origMinWidth === undefined){
274
+ this._origMinWidth = this.options.minSize[0];
275
+ }
276
+ if(this._origMinWidth<_labelWidth){
277
+ this.options.minSize[0] = _labelWidth;
278
+ }
279
+ else{
280
+ this.options.minSize[0] = this._origMinWidth;
281
+ }
282
+ this.makeRectRules();
283
+ },
207
284
 
208
285
  /** This method gets called, whenever the collapse (minimize) button has
209
286
  * been clicked
210
287
  **/
211
- windowCollapse: function(){
212
- if(this.options.collapseUsing){
213
- this.options.collapseUsing( this );
288
+ windowCollapse: function(_rectOnly){
289
+ var
290
+ _win = this, _opts = _win.options;
291
+ if(HSystem.globalCollapseHandler && !_rectOnly && HSystem.globalCollapseHandler( _win )){
292
+ return;
293
+ }
294
+ if(_opts.collapseUsing && !_rectOnly){
295
+ _opts.collapseUsing( this );
214
296
  }
215
297
  else {
216
- var _minRect = HRect.nu(
217
- this.rect.leftTop,
218
- this.rect.leftTop.subtract(
219
- 0-this.options.minSize[0],
220
- 0-this.options.minSize[1]
298
+ var
299
+ _labelSize = 128 + _win.stringWidth( _win.label ),
300
+ _minWidth = (_opts.minSize[1] > _labelSize)?_opts.minSize[0]:_labelSize,
301
+ _minRect = HRect.nu(
302
+ _win.rect.leftTop,
303
+ _win.rect.leftTop.subtract(
304
+ 0-_minWidth,
305
+ 0-_opts.minSize[1]
221
306
  )
222
307
  );
223
- if(!this.rect.equals(_minRect)){
224
- this.prevRect = HRect.nu(_minRect);
225
- this.animateTo( _minRect );
308
+ if(_rectOnly){
309
+ return _minRect;
310
+ }
311
+ if(!_win.rect.equals(_minRect)){
312
+ _win.prevRect = HRect.nu(_minRect);
313
+ _win.animateTo( _minRect );
226
314
  }
227
315
  }
316
+ this.makeRectRules();
228
317
  },
229
318
 
230
319
  /** This method gets called, whenever the zoom (maximize/restore)
231
320
  * button has been clicked
232
321
  **/
233
322
  windowZoom: function(){
234
- var _maxSize = this.options.maxSize === 'auto' ? this.parentSize() : this.options.maxSize,
235
- _maxRect = HRect.nu(
236
- this.options.minX,
237
- this.options.minY,
238
- _maxSize[0],
239
- _maxSize[1]
240
- ),
241
- _fitsRect = HRect.nu( this.rect ),
242
- i = 0,
243
- _views = this.views,
244
- _view, _size, _right, _bottom;
323
+ var
324
+ _maxSize = this.options.maxSize === 'auto' ? this.parentSize() : this.options.maxSize,
325
+ _maxRect = HRect.nu(
326
+ this.options.minX,
327
+ this.options.minY,
328
+ _maxSize[0],
329
+ _maxSize[1]
330
+ ),
331
+ _fitsRect = HRect.nu( this.rect ),
332
+ _newRect,
333
+ i = 0,
334
+ _views = this.views,
335
+ _view, _size, _right, _bottom;
245
336
  for( ; i < _views.length; i++ ){
246
337
  _view = HSystem.views[_views[i]];
247
338
  _size = ELEM.getSize(_view.elemId);
@@ -267,22 +358,58 @@ HWindow = HDynControl.extend({
267
358
  else if(_fitsRect.height < this.options.minSize[1]){
268
359
  _fitsRect.setHeight( this.options.minSize[1] );
269
360
  }
361
+ // doesn't fit or right-clicked or alt-clicked, maximize:
270
362
  if (!_fitsRect.equals(_maxRect) && (EVENT.status[ EVENT.button2 ] || EVENT.status[ EVENT.altKeyDown ]) ){
363
+ // console.log('force-max');
271
364
  this.animateTo( _maxRect );
272
365
  this.prevRect = HRect.nu( this.rect );
273
366
  this.animateTo( _maxRect );
274
367
  }
275
- else if(this.rect.equals(_fitsRect)){
276
- if(this.prevRect !== undefined && !this.prevRect.equals(_fitsRect)){
277
- this.animateTo( HRect.nu(this.prevRect) );
368
+ // already fits content
369
+ else if(this.rect.contains(_fitsRect)){
370
+ // restore previous
371
+ if(this.prevRect && !this.prevRect.equals(_fitsRect) && !this.prevRect.equals(this.windowCollapse(true))){
372
+ // restore previous size and position:
373
+ if( this.rect.equals( _maxRect ) ){
374
+ // console.log('restore');
375
+ this.animateTo( HRect.nu(this.prevRect) );
376
+ // this.prevRect = HRect.nu( this.rect );
377
+ }
378
+ else if( this.prevRect.equals( this.rect ) && !this.prevRect.equals(_fitsRect) ){
379
+ // console.log('smart-down');
380
+ this.animateTo( _fitsRect );
381
+ // this.prevRect = HRect.nu( this.rect );
382
+ }
383
+ else if( this.prevRect.equals( this.rect ) && this.prevRect.equals(_fitsRect) ){
384
+ // console.log('smart-max');
385
+ this.animateTo( _maxRect );
386
+ this.prevRect = HRect.nu( this.rect );
387
+ }
388
+ else{
389
+ // console.log('prev-size');
390
+ _newRect = HRect.nu( this.prevRect );
391
+ _newRect.offsetTo(this.rect.leftTop);
392
+ this.animateTo( _newRect );
393
+ this.prevRect = HRect.nu( _newRect );
394
+ }
395
+ }
396
+ // restore previous size only:
397
+ else if( this.rect.equals( _fitsRect ) && this.prevRect && !this.prevRect.equals(this.rect) ){
398
+ // console.log('restore-smart');
399
+ this.animateTo( this.prevRect );
400
+ // this.prevRect = HRect.nu( this.rect );
278
401
  }
402
+ // maximize
279
403
  else {
404
+ // console.log('max');
280
405
  this.prevRect = HRect.nu( this.rect );
281
406
  this.animateTo( _maxRect );
282
407
  }
283
408
  }
409
+ // smart-resize to fit content:
284
410
  else {
285
- this.prevRect = HRect.nu(_fitsRect);
411
+ // console.log('smart-up');
412
+ // this.prevRect = HRect.nu(_fitsRect);
286
413
  this.animateTo( _fitsRect );
287
414
  }
288
415
  }
@@ -66,6 +66,9 @@ HClass = function() {
66
66
 
67
67
 
68
68
  HClass.prototype = {
69
+
70
+ // detection for production build (compressed source; '_compressed' would be something like '_x4', whereas '_'+'compressed' is still '_compressed')
71
+ isProduction: '_'+'compressed' !== '_compressed',
69
72
 
70
73
  /* The property copying method. */
71
74
  extend: function(_source, _value) {
@@ -313,6 +316,13 @@ if ([]['indexOf']===undefined) {
313
316
  };
314
317
  }
315
318
 
319
+ // String fix
320
+ if(typeof String.prototype.trim !== 'function') {
321
+ String.prototype.trim = function() {
322
+ return this.replace(/^\s+|\s+$/g, '');
323
+ };
324
+ }
325
+
316
326
  // ff version 3.0.3 fails on this, when firebug installed: try/catch block
317
327
  try {
318
328