summaryrefslogtreecommitdiff
path: root/macros/Misc/TEXT_f.sci
diff options
context:
space:
mode:
authorSunil Shetye2018-06-07 17:48:55 +0530
committerSunil Shetye2018-06-07 17:48:55 +0530
commit75a3a91595f06a1ac7d8ccc0a1ca0b5cd9552abf (patch)
tree2b584d8b6062684bd18beab96c5de019bd9c81c9 /macros/Misc/TEXT_f.sci
parentf97e60278c61e42308c32047109fcb983ded8dcd (diff)
downloadsci2js-75a3a91595f06a1ac7d8ccc0a1ca0b5cd9552abf.tar.gz
sci2js-75a3a91595f06a1ac7d8ccc0a1ca0b5cd9552abf.tar.bz2
sci2js-75a3a91595f06a1ac7d8ccc0a1ca0b5cd9552abf.zip
add macros from scicos_blocks from scilab 5.5.2
Diffstat (limited to 'macros/Misc/TEXT_f.sci')
-rw-r--r--macros/Misc/TEXT_f.sci117
1 files changed, 117 insertions, 0 deletions
diff --git a/macros/Misc/TEXT_f.sci b/macros/Misc/TEXT_f.sci
new file mode 100644
index 00000000..de7d62fb
--- /dev/null
+++ b/macros/Misc/TEXT_f.sci
@@ -0,0 +1,117 @@
+// Scicos
+//
+// Copyright (C) INRIA - METALAU Project <scicos@inria.fr>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// See the file ../license.txt
+//
+
+function [x,y,typ]=TEXT_f(job,arg1,arg2)
+ //** 22-23 Aug 2006: some carefull adjustements for the fonts
+ //** inside the new graphics datastructure
+ x=[];
+ y=[];
+ typ=[];
+
+ select job
+
+ case "set" then
+ x = arg1 ;
+ graphics = arg1.graphics ;
+ orig = graphics.orig ;
+ exprs = graphics.exprs ;
+ model = arg1.model ;
+ if size(exprs,"*")==1 then
+ exprs = [exprs;"3";"1"]
+ end // compatibility
+
+ while %t do
+ [ok,txt,font,siz,exprs] = scicos_getvalue("Set Text block parameters",..
+ ["Text";"Font number";"Font size"], list("str",-1,"vec",1,"vec",1),exprs)
+
+ if ~ok then
+ break,
+ end //**
+
+ if font<=0|font>6 then
+ message("Font number must be greater than 0 and less than 7")
+ ok=%f
+ end
+
+ if siz<0 then
+ message("Font size must be positive")
+ ok=%f
+ end
+
+ if ok then
+ graphics.exprs = exprs
+
+ //** save the font
+ //** oldfont = xget('font')
+ gh_winpal = gca(); //** get the current Axes proprieties
+ default_font_style = gh_winpal.font_style ;
+ default_font_size = gh_winpal.font_size ;
+ default_font_color = gh_winpal.font_color ;
+
+ //** set the new font
+ //** xset('font',font,siz)
+ gh_winpal.font_style = font ;
+ gh_winpal.font_size = siz ;
+
+
+ //** store the box coordinate that contains the string
+ r = xstringl(0,0,exprs(1),evstr(exprs(2)),evstr(exprs(3)));
+
+ //** restore the old font
+ //** xset('font',oldfont(1),oldfont(2));
+ gh_winpal.font_style = default_font_style ;
+ gh_winpal.font_size = default_font_size ;
+ gh_winpal.font_color = default_font_color ;
+
+ sz = r(3:4) ;
+ graphics.sz = sz ;
+ x.graphics = graphics ;
+ ipar = [font;siz]
+ model.rpar = txt ;
+ model.ipar = ipar ;
+ x.model = model ;
+ break
+ end
+
+ end //** of while
+
+
+ case "define" then
+ font = 2 ;
+ siz = 1 ;
+
+ model = scicos_model()
+ model.sim = "text"
+ model.rpar= "Text"
+ model.ipar=[font;siz]
+
+ exprs = ["Text";string(font); string(siz)]
+ graphics = scicos_graphics();
+ graphics.orig = [0,0];
+ graphics.sz =[2 1];
+ graphics.exprs = exprs
+
+
+ x = mlist(["Text","graphics","model","void","gui"],graphics,model," ","TEXT_f")
+
+ end
+
+endfunction