• R/O
  • SSH
  • HTTPS

bchan: 提交


Commit MetaInfo

修訂432 (tree)
時間2012-04-14 16:10:01
作者ornse01

Log Message

fix window title handling.

Change Summary

差異

--- bchanf/trunk/src/tools/hmi_generator.rb (revision 431)
+++ bchanf/trunk/src/tools/hmi_generator.rb (revision 432)
@@ -1352,6 +1352,13 @@
13521352 def get_window_parent()
13531353 @yaml["parent"]
13541354 end
1355+ def get_window_title_max_length()
1356+ len = @yaml["title_max_length"];
1357+ if len == nil
1358+ return 128
1359+ end
1360+ return len
1361+ end
13551362
13561363 def generate_header_eventtype_enumulate(main_name)
13571364 script = <<-EOS
@@ -1486,6 +1493,9 @@
14861493 <%- if self.is_attr_scrollable() -%>
14871494 hmi_windowscroll_t wscr;
14881495 <%- end -%>
1496+ <%- if !self.is_attr_alwaysopen() -%>
1497+ TC title[<%= self.get_window_title_max_length() %>+1];
1498+ <%- end -%>
14891499 WEVENT savedwev;
14901500 <%- @parts.each do |p| -%><%= p.generate_source_struct(self.struct_name()) %><%- end -%>
14911501 };
@@ -1648,7 +1658,13 @@
16481658
16491659 EXPORT W <%= self.struct_name() %>_settitle(<%= self.struct_name() %>_t *window, TC *title)
16501660 {
1661+ <%- if !self.is_attr_alwaysopen() -%>
1662+ tc_strncpy(window->title, title, <%= self.get_window_title_max_length() %>);
1663+ window->title[<%= self.get_window_title_max_length() %>] = TNULL;
1664+ return wset_tit(window->wid, -1, window->title, 0);
1665+ <%- else -%>
16511666 return wset_tit(window->wid, -1, title, 0);
1667+ <%- end -%>
16521668 }
16531669
16541670 EXPORT Bool <%= self.struct_name() %>_isactive(<%= self.struct_name() %>_t *window)
@@ -1709,12 +1725,9 @@
17091725 }
17101726
17111727 <%- end -%>
1712-<% if self.is_attr_alwaysopen() %>LOCAL<% else %>EXPORT<% end %> W <%= self.struct_name() %>_open(<%= self.struct_name() %>_t *window)
1728+<% if self.is_attr_alwaysopen() %>LOCAL<% else %>EXPORT<% end %> W <%= self.struct_name() %>_open(<%= self.struct_name() %>_t *window<% if self.is_attr_alwaysopen() %>, TC *title<% end %>)
17131729 {
17141730 WID wid;
1715- <%- if self.get_window_title() != nil -%>
1716- TC title[] = {<%= conv_TCArray_to_hex_definition(conv_euc_to_TCArray(self.get_window_title())) %>};
1717- <%- end -%>
17181731 <%- if self.is_exist_controllparts() -%>
17191732 RECT r;
17201733 <%- end -%>
@@ -1723,7 +1736,7 @@
17231736 return 0;
17241737 }
17251738
1726- wid = wopn_wnd(WA_STD<% if self.is_attr_subwindow() %>|WA_SUBW<% end %><% if self.is_attr_resizable() %>|WA_SIZE|WA_HHDL|WA_VHDL<% end %><% if self.is_attr_scrollable() %>|WA_BBAR|WA_RBAR<% end %>, <% if self.is_attr_subwindow() %>window->parent->wid<% else %>window->parent<% end %>, &(window->r), NULL, 2, <%- if self.get_window_title() != nil -%>title<%- else -%>NULL<%- end -%>, &window->bgpat, NULL);
1739+ wid = wopn_wnd(WA_STD<% if self.is_attr_subwindow() %>|WA_SUBW<% end %><% if self.is_attr_resizable() %>|WA_SIZE|WA_HHDL|WA_VHDL<% end %><% if self.is_attr_scrollable() %>|WA_BBAR|WA_RBAR<% end %>, <% if self.is_attr_subwindow() %>window->parent->wid<% else %>window->parent<% end %>, &(window->r), NULL, 2, <% if !self.is_attr_alwaysopen() %>window->title<%- else -%>title<%- end -%>, &window->bgpat, NULL);
17271740 if (wid < 0) {
17281741 DP_ER("wopn_wnd: subjectoption error", wid);
17291742 return wid;
@@ -1832,10 +1845,21 @@
18321845 return NULL;
18331846 }
18341847 <%- end -%>
1848+ <%- if !self.is_attr_alwaysopen() -%>
1849+ tc_strset(window->title, TNULL, <%= self.get_window_title_max_length() %>+1);
1850+ if (title != 0) {
1851+ tc_strncpy(window->title, title, <%= self.get_window_title_max_length() %>);
1852+ } else {
1853+ <%- l = 0 -%>
1854+ <%- conv_euc_to_TCArray(self.get_window_title()).each do |ch| -%>
1855+ window->title[<%= l %>] = 0x<%= ch.to_s(16) %>;<%- l+=1 %>
1856+ <%- end -%>
1857+ }
1858+ <%- end -%>
18351859 <%- @parts.each do |p| -%><%= p.generate_initialize_in_new() %><%- end -%>
18361860
18371861 <%- if self.is_attr_alwaysopen() -%>
1838- err = <%= self.struct_name() %>_open(window);
1862+ err = <%= self.struct_name() %>_open(window, title);
18391863 if (err < 0) {
18401864 <%- if self.is_attr_scrollable() -%>
18411865 hmi_windowscroll_finalize(&window->wscr);
Show on old repository browser