1 /* Copyright 2001 Kjetil S. Matheussen
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public License
5 as published by the Free Software Foundation; either version 2
6 of the License, or (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 /*******************************************************************
19 Various functions that is called between the programs GFX_*
20 routines and the OS/hardware ones. The difference between
21 this and gfx_shrink.c is that this functions cuts the
22 x parameters after temponodeare.x2 before calling the GFXS_*
24 ********************************************************************/
26 #include "nsmtracker.h"
28 #define GFX_DONTSHRINK
29 #include "visual_proc.h"
33 #define getMinX(a) a->wblock->t.x1
38 struct Tracker_Windows
*window
,
40 int x
,int y
,int x2
,int y2
42 struct Tracker_Windows
*window
,
44 int x
,int y
,int x2
,int y2
47 int minx
=getMinX(window
);
54 y
=y2
-(((y2
-y
)*(x2
-minx
))/(x2
-x
));
59 y2
=y
+(((y2
-y
)*(minx
-x2
))/(x
-x2
));
65 GFXS_LineType(GFX_OSFunc
,window
,color
,x
,y
,x2
,y2
);
72 struct Tracker_Windows
*window
,
74 int x
,int y
,int x2
,int y2
76 struct Tracker_Windows
*window
,
78 int x
,int y
,int x2
,int y2
81 int minx
=getMinX(window
);
87 GFXS_BoxType(GFX_OSFunc
,window
,color
,max(minx
,x
),y
,x2
,y2
);
93 struct Tracker_Windows
*window
,
98 struct Tracker_Windows
*window
,
104 int minx
=getMinX(window
);
107 if(GFX_OSFunc
==GFX_Text
){
110 sprintf(temp
,"<--%s",text
);
111 GFXS_TextType(GFX_OSFunc
,window
,color
,temp
,x
,y
,clear
);
113 GFXS_TextType(GFX_OSFunc
,window
,color
,text
,x
,y
,clear
);
116 if((strlen(text
)+1)*window
->fontwidth
<minx
) return;
117 text
+=(minx
-x
)/window
->fontwidth
;
120 GFXS_TextType(GFX_OSFunc
,window
,color
,text
,x
,y
,clear
);
126 void GFXST_TextType2(
128 struct Tracker_Windows
*window
,
133 struct Tracker_Windows
*window
,
139 int minx
=getMinX(window
);
140 GFXS_TextType2(GFX_OSFunc
,window
,color
,len
,max(minx
,x
),y
,clear
);
143 void GFXST_BorderType(
144 void (*GFX_P_OSFunc
)(
145 struct Tracker_Windows
*window
,
148 struct Tracker_Windows
*window
,
152 int minx
=getMinX(window
);
155 GFXS_BorderType(GFX_P_OSFunc
,window
,x
,y
,y2
);
158 void GFXST_BorderType2(
159 void (*GFX_P_OSFunc
)(
160 struct Tracker_Windows
*window
,
163 struct Tracker_Windows
*window
,
167 int minx
=getMinX(window
);
170 GFXS_BorderType2(GFX_P_OSFunc
,window
,x
,y
,y2
);