From ab9f8731e3cc096b0853dbeea44a61bb8b0e7fec Mon Sep 17 00:00:00 2001 From: betateilchen <> Date: Thu, 29 Jan 2015 18:06:51 +0000 Subject: [PATCH] contrib/Infopanel: updated added: buttonpanel added: button added: demo layout for buttonpanel git-svn-id: https://svn.fhem.de/fhem/trunk@7765 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/InfoPanel/55_InfoPanel.pm | 48 +++++++++++++- fhem/contrib/InfoPanel/buttonPanel.layout | 77 +++++++++++++++++++++++ 2 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 fhem/contrib/InfoPanel/buttonPanel.layout diff --git a/fhem/contrib/InfoPanel/55_InfoPanel.pm b/fhem/contrib/InfoPanel/55_InfoPanel.pm index 1765adcfb..dea9e39e0 100644 --- a/fhem/contrib/InfoPanel/55_InfoPanel.pm +++ b/fhem/contrib/InfoPanel/55_InfoPanel.pm @@ -41,6 +41,7 @@ sub btIP_Notify; sub btIP_readLayout($); sub btIP_itemArea; +sub btIP_itemButton; sub btIP_itemCircle; sub btIP_itemDate; sub btIP_itemEllipse; @@ -187,6 +188,35 @@ sub btIP_itemArea { return $output; } +sub btIP_itemButton { + my ($id,$x1,$y1,$x2,$y2,$rx,$ry,$link,$text,%params)= @_; + $id = ($id eq '-') ? createUniqueId() : $id; + my $width = $x2 - $x1; + my $height = $y2 - $y1; + my ($r,$g,$b,$a) = btIP_color($params{boxcolor}); + $text = AnalyzePerlCommand(undef,$text); + $link = AnalyzePerlCommand(undef,$link); + my $target = 'secret'; + $target = '_top' if $link =~ s/^-//; + $target = '_blank' if $link =~ s/^\+//; + + my $output = "\n"; + $output .= "\n"; + + my $oldhalign = $params{thalign}; + my $oldvalign = $params{tvalign}; + $params{thalign} = "middle"; + $params{tvalign} = "middle"; + $output .= btIP_itemText($id."_text",($x1+$x2)/2,($y1+$y2)/2,$text,%params); + $params{thalign} = $oldhalign; + $params{tvalign} = $oldvalign; + $output .= "\n"; + + return $output; +} + sub btIP_itemCircle { my ($id,$x,$y,$r,$filled,%params)= @_; $id = ($id eq '-') ? createUniqueId() : $id; @@ -591,7 +621,7 @@ sub btIP_evalLayout($$@) { my ($id,$x,$y,$x1,$y1,$x2,$y2,$r1,$r2); my ($scale,$inline,$boxwidth,$boxheight,$boxcolor); - my ($text,$imgtype,$srctype,$arg,$format); + my ($text,$link,$imgtype,$srctype,$arg,$format); my $cont= ""; foreach my $line (@layout) { @@ -638,6 +668,22 @@ sub btIP_evalLayout($$@) { $params{boxcolor} = AnalyzePerlCommand(undef, $def); } + when("button") { + ($id,$x1,$y1,$x2,$y2,$r1,$r2,$link,$text)= split("[ \t]+", $def, 9); + ($x1,$y1)= btIP_xy($x1,$y1,%params); + ($x2,$y2)= btIP_xy($x2,$y2,%params); + my $arg = AnalyzePerlCommand(undef,$arg); + $params{xx} = $x; + $params{yy} = $y; + $svg .= btIP_itemButton($id,$x1,$y1,$x2,$y2,$r1,$r2,$link,$text,%params); + } + + when("buttonpanel"){ + $defs{$params{name}}{fhem}{div} = "
". + "