manqod 1.1532.0 → 1.1556.0
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/bin/manqod +1 -0
- data/lib/Common/Fixnum.rb +31 -0
- data/lib/Common/Nick.rb +0 -1
- data/lib/FormHolder/Form/InputHolder.rb +3 -2
- data/lib/FormHolder/Form/InputHolder/Button.rb +1 -1
- data/lib/FormHolder/Form/InputHolder/FileChooser.rb +4 -4
- data/lib/FormHolder/Form/InputHolder/QBuilder.rb +2 -2
- data/lib/FormHolder/Form/InputHolder/QBuilder/QObject.rb +2 -2
- data/lib/Gtk.rb +22 -0
- data/lib/ListHolder.rb +1 -1
- data/lib/ListHolder/EditableList.rb +30 -5
- data/lib/ListHolder/EditableList/Column.rb +4 -2
- data/lib/ListHolder/EditableList/DrbListModel.rb +10 -6
- data/lib/ListHolder/EditableList/ListPrintOperation.rb +27 -18
- data/lib/ListHolder/EditableList/ListPrintOperation/ColumnsHeaderLayout.rb +41 -2
- data/lib/ListHolder/EditableList/ListPrintOperation/HeaderLayout.rb +1 -1
- data/lib/ListHolder/EditableList/ListPrintOperation/IterLayout.rb +86 -8
- data/lib/ListHolder/GanttHolder.rb +4 -1
- data/lib/ListHolder/GanttHolder/Gantt.rb +29 -16
- data/lib/ListHolder/GanttHolder/Gantt/Rectangle.rb +29 -3
- data/lib/ListHolder/GanttHolder/GanttScaler.rb +12 -9
- data/lib/ListHolder/ListButtonHolder.rb +3 -1
- data/lib/ListHolder/ListButtonHolder/LegendsButton.rb +54 -0
- data/lib/ManqodRPC.rb +2 -2
- data/lib/Print/PrintItem.rb +3 -2
- data/lib/RelationBuilder.rb +38 -43
- data/lib/RelationBuilder/RTable.rb +23 -15
- data/lib/RelationBuilder/RTable/RField.rb +20 -15
- data/lib/RelationBuilder/Relation.rb +24 -18
- metadata +4 -3
data/bin/manqod
CHANGED
@@ -109,6 +109,7 @@ erequire "PrintEditor/ItemInfo/ItemTextAlignment.rb"
|
|
109
109
|
|
110
110
|
erequire 'ListHolder/ListButtonHolder/FilterButton'
|
111
111
|
erequire 'ListHolder/ListButtonHolder/ArchiveButton'
|
112
|
+
erequire 'ListHolder/ListButtonHolder/LegendsButton'
|
112
113
|
erequire 'ListHolder/ListButtonHolder/OrderingButton'
|
113
114
|
erequire 'ListHolder/ListButtonHolder/SumPanelButton'
|
114
115
|
erequire 'ListHolder/ListButtonHolder/ButtonGroup'
|
data/lib/Common/Fixnum.rb
CHANGED
@@ -16,3 +16,34 @@ class Fixnum
|
|
16
16
|
ret
|
17
17
|
end
|
18
18
|
end
|
19
|
+
|
20
|
+
class Time
|
21
|
+
def wday_non_gb
|
22
|
+
wday==0 ? 6 : wday-1
|
23
|
+
end
|
24
|
+
def strftime_w(str)
|
25
|
+
s=str.clone
|
26
|
+
s.sub!("%W",(strftime("%W").to_i+1).to_s) if str.include?("%W")
|
27
|
+
strftime(s)
|
28
|
+
end
|
29
|
+
def round(res='d')
|
30
|
+
#res can be H=hour,d=day,W=week
|
31
|
+
#Time.gm(0,0,res=="H" ? hour : 0,day,month,year)#,yday - (res=="W" ? wday_non_gb : 0),false)
|
32
|
+
m=month
|
33
|
+
y=year
|
34
|
+
if res=="W"
|
35
|
+
if day <= wday_non_gb
|
36
|
+
t=Time.at(self-7*24*60*60)
|
37
|
+
d=t.day
|
38
|
+
m=t.month
|
39
|
+
y=t.year
|
40
|
+
else
|
41
|
+
d=day - wday_non_gb
|
42
|
+
end
|
43
|
+
else
|
44
|
+
d=day
|
45
|
+
end
|
46
|
+
Time.mktime(y, m, d, res=="H" ? hour : 0)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
data/lib/Common/Nick.rb
CHANGED
@@ -97,7 +97,7 @@ class MyInputHolder
|
|
97
97
|
end
|
98
98
|
|
99
99
|
#Button in info mode is editable
|
100
|
-
item[
|
100
|
+
item['editable']=(item['gtktype']=='gtk_button').to_s if caller.runmode == 'info'
|
101
101
|
@widget.set_border_width(1)
|
102
102
|
|
103
103
|
@widget.add(@eventbox=Gtk::EventBox.new)
|
@@ -225,6 +225,7 @@ class MyInputHolder
|
|
225
225
|
item['querysql']="#{item['querysql']} #{(gtk_attribute("tree_key").nil? ? "order by":",")} #{s[2..s.length]}" if s.length>0
|
226
226
|
edebug("generated query:#{querySQL}","sql")
|
227
227
|
end
|
228
|
+
item['querysql']=add_where(item['querysql'],"#{guess_base(item['querysql'])}.id = '" + "#" +"{default}'") if caller.runmode == 'info' && item['querysql'].length>0
|
228
229
|
self
|
229
230
|
end
|
230
231
|
|
@@ -314,7 +315,7 @@ class MyInputHolder
|
|
314
315
|
end
|
315
316
|
|
316
317
|
def editable
|
317
|
-
|
318
|
+
editable?
|
318
319
|
end
|
319
320
|
|
320
321
|
def editable?
|
@@ -96,7 +96,7 @@ class MyRendererButton < Gtk::Button
|
|
96
96
|
s="#{s}#{@pc.query_result[key]}" if @pc.query_result.has_key?(key)
|
97
97
|
}
|
98
98
|
set_label(s)
|
99
|
-
set_image(Gtk::Image.new((text=="-1" || text=="0" ? Gtk::Stock::ADD : Gtk::Stock::EDIT ),Gtk::IconSize.from_name(get_conf(0,0,"button-size"))))
|
99
|
+
set_image(Gtk::Image.new((parentM.runmode=='info' ? Gtk::Stock::INFO : (text=="-1" || text=="0" ? Gtk::Stock::ADD : Gtk::Stock::EDIT )),Gtk::IconSize.from_name(get_conf(0,0,"button-size"))))
|
100
100
|
notify_changes
|
101
101
|
end
|
102
102
|
edebug("#{text} updated","gtk_button","info")
|
@@ -80,10 +80,10 @@ class MyFileChooserButton < Gtk::FileChooserWidget
|
|
80
80
|
ftp=Net::FTP.new(@ftp[0],@ftp[1],@ftp[2])
|
81
81
|
@ftp[3].each("/"){|s|
|
82
82
|
begin
|
83
|
-
|
83
|
+
einfo("changing ftp dir: #{s}","form")
|
84
84
|
ftp.chdir(s)
|
85
85
|
rescue =>err
|
86
|
-
|
86
|
+
einfo("creating ftp dir: #{s}","form")
|
87
87
|
ftp.mkdir(s)
|
88
88
|
retry
|
89
89
|
end
|
@@ -105,11 +105,11 @@ class MyFileChooserButton < Gtk::FileChooserWidget
|
|
105
105
|
set_conf(0,item['id'],"path",current_folder)
|
106
106
|
ftp=Net::FTP.new(@ftp[0],@ftp[1],@ftp[2])
|
107
107
|
@ftp[3].each("/"){|s|
|
108
|
-
|
108
|
+
einfo("changing ftp dir: #{s}","form")
|
109
109
|
ftp.chdir(s)
|
110
110
|
} if @ftp[3]
|
111
111
|
perc=0
|
112
|
-
|
112
|
+
einfo(item["initial"],"form")
|
113
113
|
ftp.getbinaryfile(item["initial"],filename,ftp.size(item["initial"])/100){
|
114
114
|
progress.set_fraction(perc/100.0)
|
115
115
|
Gtk.show_thread_changes
|
@@ -121,7 +121,7 @@ class QBuilder < Gtk::HPaned
|
|
121
121
|
}
|
122
122
|
begin
|
123
123
|
i=model.append
|
124
|
-
row.each{|k,v| i[headers.
|
124
|
+
row.each{|k,v| i[headers.key(k)]=v}
|
125
125
|
end while (row=res.fetch_hash(true))
|
126
126
|
sview.set_model(model)
|
127
127
|
w.vbox.add(Gtk::ScrolledWindow.new.add(sview).set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC)).set_size_request(600,400)
|
@@ -189,7 +189,7 @@ class QBuilder < Gtk::HPaned
|
|
189
189
|
when "QBuilder"
|
190
190
|
#we update ourself
|
191
191
|
else
|
192
|
-
|
192
|
+
ewarn("notifier: #{new_value.class.name}","relation-builder")
|
193
193
|
end
|
194
194
|
@qobjects.each{|qobject| qobject.update}
|
195
195
|
test_query if @autotest.active?
|
@@ -109,7 +109,7 @@ class QObject < Gtk::HBox
|
|
109
109
|
ret=rel.rfield1 if rel.rfield1.table.table_id.to_i == @q.base_object.obj_id.to_i
|
110
110
|
ret=rel.rfield2 if rel.rfield2.table.table_id.to_i == @q.base_object.obj_id.to_i
|
111
111
|
unless ret
|
112
|
-
@q.rb.relations.
|
112
|
+
@q.rb.relations.each_pair{|rel_id,r|
|
113
113
|
unless been_there.include?(r.relation_id)
|
114
114
|
if r.rfield1.table.table_id == rel.rfield1.table.table_id or r.rfield2.table.table_id == rel.rfield1.table.table_id
|
115
115
|
if other_dir=find_base_dir(r,been_there)
|
@@ -172,7 +172,7 @@ class QObject < Gtk::HBox
|
|
172
172
|
@link=case @obj_type
|
173
173
|
when "b" then @q.rb.table_by_id(@obj_id)
|
174
174
|
when "f" then if table=@q.rb.table_by_id(@obj_id) then table.fields[@field]; end
|
175
|
-
when "r" then @q.rb.
|
175
|
+
when "r" then @q.rb.relations[@obj_id]
|
176
176
|
else
|
177
177
|
edebug("unknown type: #{@obj_type}","relation-builder",WARNING)
|
178
178
|
nil
|
data/lib/Gtk.rb
CHANGED
@@ -69,6 +69,28 @@ module Gtk
|
|
69
69
|
self
|
70
70
|
end
|
71
71
|
end
|
72
|
+
|
73
|
+
class TreeIter
|
74
|
+
def next_with_children
|
75
|
+
ret=nil
|
76
|
+
if self.has_child?
|
77
|
+
ret=self.first_child
|
78
|
+
else
|
79
|
+
if clone.next!
|
80
|
+
self.next!
|
81
|
+
ret=self
|
82
|
+
else
|
83
|
+
if par=self.parent
|
84
|
+
if par.clone.next!
|
85
|
+
par.next!
|
86
|
+
ret=par
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
ret
|
92
|
+
end
|
93
|
+
end
|
72
94
|
|
73
95
|
def self.is_windows?
|
74
96
|
RUBY_PLATFORM.downcase.include?("mswin") || RUBY_PLATFORM.downcase.include?("mingw")
|
data/lib/ListHolder.rb
CHANGED
@@ -103,7 +103,7 @@ module Mylist
|
|
103
103
|
end
|
104
104
|
attr_accessor :list, :list_scroller, :list_panel, :list_id
|
105
105
|
attr_accessor :notebook, :child_placement
|
106
|
-
attr_reader :caller, :parentM, :widget, :info
|
106
|
+
attr_reader :caller, :parentM, :widget, :info, :gantt
|
107
107
|
attr_accessor :buttonholder, :placeholder_button
|
108
108
|
|
109
109
|
def embedd?
|
@@ -55,6 +55,11 @@ class MyEditableList < Gtk::TreeView
|
|
55
55
|
}
|
56
56
|
@tmp=Hash.new
|
57
57
|
@is_embedded=nil
|
58
|
+
@keep_expanded=false
|
59
|
+
|
60
|
+
signal_connect("row-collapsed"){|me, iter, path|
|
61
|
+
me.expand_all if @keep_expanded
|
62
|
+
}
|
58
63
|
end
|
59
64
|
attr_accessor :caller, :selected, :list_id, :list_model, :parentM, :headertypes, :headers, :info, :title, :tip, :pop, :tmp, :is_embedded
|
60
65
|
|
@@ -157,6 +162,7 @@ class MyEditableList < Gtk::TreeView
|
|
157
162
|
set_cursor_id(id_to_scroll,scroll)
|
158
163
|
changed
|
159
164
|
notify_observers(self)
|
165
|
+
expand_all if @keep_expanded
|
160
166
|
get_cursor_id
|
161
167
|
end
|
162
168
|
|
@@ -168,13 +174,12 @@ class MyEditableList < Gtk::TreeView
|
|
168
174
|
case get_conf(0,0,"list-tooltip")
|
169
175
|
when "filters" then
|
170
176
|
t="filters:"
|
171
|
-
@caller.
|
172
|
-
|
173
|
-
|
174
|
-
case h['type']
|
177
|
+
@caller.list_panel.list_filter.columns.each_value{|frenderer|
|
178
|
+
fl=get_conf(get_id,frenderer.header['id'],"filter")
|
179
|
+
case frenderer.header['type']
|
175
180
|
when 'gtk_combo', 'gtk_const_combo' then fl = (fl=="-1" or fl=="") ? "" : "=#{fl}"
|
176
181
|
end
|
177
|
-
t+="\n#{
|
182
|
+
t+="\n#{frenderer.header['header']}: #{fl}" if !fl.nil? and fl.length>0
|
178
183
|
}
|
179
184
|
t="#{t}\nnone" if t=="filters:"
|
180
185
|
@tip.set_tip(self,t,'extra hint')
|
@@ -187,6 +192,7 @@ class MyEditableList < Gtk::TreeView
|
|
187
192
|
edebug(" can't update","list","error")
|
188
193
|
return
|
189
194
|
end
|
195
|
+
@keep_expanded=(gtk_attribute("keep_expanded") || "false") == "true"
|
190
196
|
set_model(nil)
|
191
197
|
@list_model.create_skeleton
|
192
198
|
set_info("initializing")
|
@@ -283,6 +289,25 @@ class MyEditableList < Gtk::TreeView
|
|
283
289
|
next_col
|
284
290
|
end
|
285
291
|
|
292
|
+
def column_by_id(column_id)
|
293
|
+
ret=nil
|
294
|
+
columns.each{|col|
|
295
|
+
if col.header['id'].to_i == column_id.to_i
|
296
|
+
ret=col
|
297
|
+
break
|
298
|
+
end
|
299
|
+
}
|
300
|
+
ret
|
301
|
+
end
|
302
|
+
|
303
|
+
def columns_height
|
304
|
+
colh=0
|
305
|
+
columns.each{|col|
|
306
|
+
colh=col.header_widget.allocation.height if col.header_widget.allocation.height > colh
|
307
|
+
}
|
308
|
+
colh
|
309
|
+
end
|
310
|
+
|
286
311
|
def wipe
|
287
312
|
save_config
|
288
313
|
set_model(nil)
|
@@ -34,8 +34,10 @@ class MyColumn < Gtk::TreeViewColumn
|
|
34
34
|
end
|
35
35
|
|
36
36
|
super(header['header'],@renderer,attributes)
|
37
|
-
set_widget(header_widget=Gtk::Label.new(header['header']).set_visible(true))
|
37
|
+
set_widget(@header_widget=Gtk::Label.new(header['header']).set_visible(true))
|
38
38
|
header_widget.set_angle(gtk_attribute("header_angle").to_f) if gtk_attribute("header_angle")
|
39
|
+
@list.tip.set_tip(header_widget,header['header'],'extra hint')
|
40
|
+
@list.tip.enable
|
39
41
|
#set color
|
40
42
|
# header_widget.modify_fg(Gtk::STATE_NORMAL,Gdk::Color.new(0,35000, 0))
|
41
43
|
# header_widget.modify_fg(Gtk::STATE_PRELIGHT,Gdk::Color.new(0,35000, 0))
|
@@ -122,7 +124,7 @@ class MyColumn < Gtk::TreeViewColumn
|
|
122
124
|
=end
|
123
125
|
end
|
124
126
|
attr_accessor :list
|
125
|
-
attr_accessor :header
|
127
|
+
attr_accessor :header, :header_widget
|
126
128
|
attr_accessor :renderer
|
127
129
|
attr_reader :decimals_attribute, :duration_format, :timestamp_format
|
128
130
|
|
@@ -39,6 +39,7 @@ class ListModel
|
|
39
39
|
attr_reader :column_of_gantt_start, :column_of_gantt_duration, :column_of_gantt_successors, :column_of_gantt_group, :column_of_gantt_group_color, :column_of_gantt_partial, :column_of_gantt_percentage
|
40
40
|
attr_reader :show_archive, :archive_key
|
41
41
|
attr_reader :headers, :headertypes
|
42
|
+
attr_reader :foreground_legend, :background_legend
|
42
43
|
|
43
44
|
|
44
45
|
def drbmodel
|
@@ -57,7 +58,7 @@ class ListModel
|
|
57
58
|
def resubscribe
|
58
59
|
begin
|
59
60
|
@remote_model=manqod_db.moditem(get_id)
|
60
|
-
drbmodel.subscribe(self)
|
61
|
+
drbmodel.subscribe(ManqodRPC.instance.to_s,self)
|
61
62
|
rescue =>err
|
62
63
|
retry if warn("can't reconnect to server",err.to_s,"list",ERROR,false,true)
|
63
64
|
end
|
@@ -72,7 +73,7 @@ class ListModel
|
|
72
73
|
|
73
74
|
def wipe
|
74
75
|
begin
|
75
|
-
drbmodel.unsubscribe(
|
76
|
+
drbmodel.unsubscribe(ManqodRPC.instance.to_s) if @remote_model && @remote_model.alive?
|
76
77
|
rescue =>err
|
77
78
|
eerror("unsubscribing: #{err}","main")
|
78
79
|
end
|
@@ -174,7 +175,7 @@ class ListModel
|
|
174
175
|
# list.progress.pulse(list.get_id)
|
175
176
|
# @thread=Thread.new{
|
176
177
|
begin
|
177
|
-
drbmodel.unsubscribe(
|
178
|
+
drbmodel.unsubscribe(ManqodRPC.instance.to_s) unless @remote_model.nil?
|
178
179
|
rescue => err
|
179
180
|
ewarn("server model is gone")
|
180
181
|
end
|
@@ -215,7 +216,7 @@ class ListModel
|
|
215
216
|
@column_of_fetch_filter=moditem_attributes[:column_of_fetch_filter]
|
216
217
|
@archive_key=moditem_attributes[:archive_key]
|
217
218
|
|
218
|
-
drbmodel.subscribe(self)
|
219
|
+
drbmodel.subscribe(ManqodRPC.instance.to_s,self)
|
219
220
|
|
220
221
|
|
221
222
|
@parentM=list.parentM.get_model if list.parentM
|
@@ -287,6 +288,9 @@ class ListModel
|
|
287
288
|
if gantt_percentage=list.gtk_attribute('gantt_percentage')
|
288
289
|
@column_of_gantt_percentage=headers[gantt_percentage]
|
289
290
|
end
|
291
|
+
|
292
|
+
@foreground_legend=cache.get("#{get_id}foreground")
|
293
|
+
@background_legend=cache.get("#{get_id}background")
|
290
294
|
|
291
295
|
list.set_info("created")
|
292
296
|
# }
|
@@ -356,7 +360,7 @@ class ListModel
|
|
356
360
|
edebug("refiltering #{one}")
|
357
361
|
if one.nil?
|
358
362
|
list.set_model(nil)
|
359
|
-
list.progress.zero(list.object_id,@
|
363
|
+
list.progress.zero(list.object_id,@rows_loaded,@moditem["display"])
|
360
364
|
@thread=Thread.new{
|
361
365
|
r=0
|
362
366
|
@data.each{|model, path, iter|
|
@@ -382,7 +386,7 @@ class ListModel
|
|
382
386
|
|
383
387
|
@filtered_rowcount=0
|
384
388
|
@data.each{|model, path, iter| @filtered_rowcount+=1 if iter[column_of_visible]}
|
385
|
-
list.set_info("#{@filtered_rowcount}/#{@
|
389
|
+
list.set_info("#{@filtered_rowcount}/#{@rows_loaded}")
|
386
390
|
self
|
387
391
|
end
|
388
392
|
|
@@ -8,21 +8,22 @@ class ListPrintOperation < Gtk::PrintOperation
|
|
8
8
|
|
9
9
|
def initialize(list)
|
10
10
|
@list=list
|
11
|
-
@print_sums=list.gtk_attribute("print_sums") || "true" =="true"
|
11
|
+
@print_sums=(list.gtk_attribute("print_sums") || "true") =="true"
|
12
12
|
@sum_font=list.gtk_attribute("sum_font") || "verdana bold 6"
|
13
13
|
@cell_font=list.gtk_attribute("cell_font") || "verdana 6"
|
14
14
|
@columns_header_font=list.gtk_attribute("columns_header_font") || "verdana bold 6"
|
15
15
|
@header_font=list.gtk_attribute("header_font") || "verdana bold 10"
|
16
16
|
@footer_font=list.gtk_attribute("footer_font") || "verdana 6"
|
17
17
|
@date_font=list.gtk_attribute("date_font") || "verdana 5"
|
18
|
-
@print_date=list.gtk_attribute("print_date") || "true" == "true"
|
18
|
+
@print_date=(list.gtk_attribute("print_date") || "true") == "true"
|
19
19
|
@row_spacing=(list.gtk_attribute("row_spacing") || 1.0).to_f
|
20
20
|
@column_spacing=(list.gtk_attribute("column_spacing") || 1.0).to_f
|
21
|
-
@draw_footer_line=list.gtk_attribute("draw_footer_line") || "true" == "true"
|
22
|
-
@line_above_parent=list.gtk_attribute("line_above_parent") || "true" == "true"
|
23
|
-
@draw_header_line=list.gtk_attribute("draw_header_line") || "true" == "true"
|
24
|
-
@
|
25
|
-
@
|
21
|
+
@draw_footer_line=(list.gtk_attribute("draw_footer_line") || "true") == "true"
|
22
|
+
@line_above_parent=(list.gtk_attribute("line_above_parent") || "true") == "true"
|
23
|
+
@draw_header_line=(list.gtk_attribute("draw_header_line") || "true") == "true"
|
24
|
+
@print_title=(list.gtk_attribute("print_title") || "true") == "true"
|
25
|
+
@draw_header_cell_borders=(list.gtk_attribute("draw_header_cell_borders") || "true") == "true"
|
26
|
+
@fill_header_background=(list.gtk_attribute("fill_header_background") || "true") == "true"
|
26
27
|
@row_underline=(list.gtk_attribute("row_underline") || 0.0).to_f
|
27
28
|
|
28
29
|
if @print_with_child=list.gtk_attribute("print_with_child")
|
@@ -30,7 +31,7 @@ class ListPrintOperation < Gtk::PrintOperation
|
|
30
31
|
@child_model=Gtk::TreeModelSort.new(@child_list.list_model.data)
|
31
32
|
@child_model.set_sort_column_id(@child_list.list_model.sorter.sort_column_id[0],@child_list.list_model.sorter.sort_column_id[1]) unless @child_list.list_model.sorter.sort_column_id.nil?
|
32
33
|
end
|
33
|
-
@print_sub_sums=list.gtk_attribute("print_sub_sums") || "true" == "true"
|
34
|
+
@print_sub_sums=(list.gtk_attribute("print_sub_sums") || "true") == "true"
|
34
35
|
@child_indent=(list.gtk_attribute("child_indent") || 100).to_f
|
35
36
|
@child_cell_font=list.gtk_attribute("child_cell_font") || "verdana 5"
|
36
37
|
@child_sum_font=list.gtk_attribute("child_sum_font") || "verdana bold 5"
|
@@ -40,6 +41,9 @@ class ListPrintOperation < Gtk::PrintOperation
|
|
40
41
|
@footer_line_width=(list.gtk_attribute("footer_line_width") || 1.0).to_f
|
41
42
|
@cell_line_width=(list.gtk_attribute("cell_line_width") || 0.3).to_f
|
42
43
|
@sum_line_width=(list.gtk_attribute("sum_line_width") || 0.6).to_f
|
44
|
+
|
45
|
+
@print_with_gantt=(list.gtk_attribute("print_with_gantt") || "false") == "true"
|
46
|
+
@gantt_cell_font=list.gtk_attribute("gantt_cell_font") || "verdana 5"
|
43
47
|
|
44
48
|
@line_width=1
|
45
49
|
|
@@ -66,8 +70,9 @@ class ListPrintOperation < Gtk::PrintOperation
|
|
66
70
|
col_cnt+=1
|
67
71
|
end
|
68
72
|
} #summ the width of all columns
|
73
|
+
columns_width_sum+=list.holder.widget.allocation.width - list.allocation.width if @print_with_gantt
|
69
74
|
coef=(width-col_cnt*@column_spacing)/columns_width_sum
|
70
|
-
|
75
|
+
einfo("colums width sum: #{columns_width_sum}","printing")
|
71
76
|
|
72
77
|
#@column_width will store the column positions on the context
|
73
78
|
@column_width=Hash.new
|
@@ -80,6 +85,10 @@ class ListPrintOperation < Gtk::PrintOperation
|
|
80
85
|
col_cur_pos+=@column_width[col.data]+@column_spacing
|
81
86
|
end
|
82
87
|
}
|
88
|
+
if @print_with_gantt
|
89
|
+
@column_pos[:gantt]=col_cur_pos
|
90
|
+
@column_width[:gantt]=(list.holder.widget.allocation.width - list.allocation.width).to_f*coef
|
91
|
+
end
|
83
92
|
if child_list
|
84
93
|
columns_width_sum=@child_indent.to_f
|
85
94
|
col_cnt=0
|
@@ -90,7 +99,7 @@ class ListPrintOperation < Gtk::PrintOperation
|
|
90
99
|
end
|
91
100
|
} #summ the width of all columns
|
92
101
|
coef=(width-col_cnt*@column_spacing)/columns_width_sum
|
93
|
-
|
102
|
+
einfo("child colums width sum: #{columns_width_sum}","printing")
|
94
103
|
|
95
104
|
#@column_width will store the column positions on the context
|
96
105
|
col_cur_pos=@child_indent.to_f*coef
|
@@ -109,11 +118,11 @@ class ListPrintOperation < Gtk::PrintOperation
|
|
109
118
|
@header=HeaderLayout.new(cr,self)
|
110
119
|
@current_height=@current_height+@header.height
|
111
120
|
@columns_header=ColumnsHeaderLayout.new(self,cr,list.columns,@columns_header_font)
|
112
|
-
@columns_header.
|
121
|
+
@columns_header.set_y(@current_height)
|
113
122
|
@current_height=@current_height+@columns_header.height+@row_spacing
|
114
123
|
if child_list
|
115
124
|
@child_columns_header=ColumnsHeaderLayout.new(self,cr,child_list.columns,@child_columns_header_font) if child_list
|
116
|
-
@child_columns_header.
|
125
|
+
@child_columns_header.set_y(@current_height)
|
117
126
|
@current_height=@current_height+@child_columns_header.height+@row_spacing
|
118
127
|
end
|
119
128
|
@headers_height=@current_height
|
@@ -211,7 +220,7 @@ class ListPrintOperation < Gtk::PrintOperation
|
|
211
220
|
if @piter.nil?
|
212
221
|
break if past_last=!@piter=list.model.iter_first
|
213
222
|
else
|
214
|
-
break if past_last=!@piter.
|
223
|
+
break if past_last=!@piter.next_with_children
|
215
224
|
end
|
216
225
|
@sums.each_key{|key| @sums[key]=@sums[key]+@piter[key].to_f}
|
217
226
|
il=IterLayout.new(cr,@piter,list.columns, self,cell_font)
|
@@ -237,10 +246,10 @@ class ListPrintOperation < Gtk::PrintOperation
|
|
237
246
|
il=IterLayout.new(cr,@piter,list.columns, self,cell_font)
|
238
247
|
if lay_it(il)
|
239
248
|
#do not print it twice
|
240
|
-
past_last=!@piter.
|
249
|
+
past_last=!@piter.next_with_children
|
241
250
|
break
|
242
251
|
end
|
243
|
-
break if past_last=!@piter.
|
252
|
+
break if past_last=!@piter=@piter.next_with_children
|
244
253
|
edebug("piter: #{@piter[list.list_model.column_of_id]} #{@past_last}","printing","debug")
|
245
254
|
end
|
246
255
|
end
|
@@ -299,7 +308,7 @@ class ListPrintOperation < Gtk::PrintOperation
|
|
299
308
|
attr_accessor :fill_header_background, :header_line_width
|
300
309
|
attr_accessor :row_spacing
|
301
310
|
attr_accessor :column_spacing
|
302
|
-
attr_reader :cell_line_width, :sum_line_width, :row_underline
|
311
|
+
attr_reader :cell_line_width, :sum_line_width, :row_underline, :print_title, :print_with_gantt, :gantt_cell_font
|
303
312
|
def lay_it(il)
|
304
313
|
if @current_height + il.row_height > @footer.y
|
305
314
|
#page full
|
@@ -309,8 +318,8 @@ class ListPrintOperation < Gtk::PrintOperation
|
|
309
318
|
@current_height=@headers_height
|
310
319
|
@page_n=@page_n+1
|
311
320
|
end
|
312
|
-
il.
|
313
|
-
il.
|
321
|
+
il.set_page(@page_n)
|
322
|
+
il.set_y(@current_height)
|
314
323
|
@current_height=@current_height+il.row_height+@row_spacing
|
315
324
|
@iter_layouts.push(il)
|
316
325
|
edebug(il.inspect,"printing")
|