Das was ich da so schreibe sieht wild aus ohne ende weil ich durch das rumprobieren herausfinden will wie wo wann was.
So nun mal das womit ich rumprobiere und auch eine kleine Doku wie die Parameter wirklich zu verstehn sind den da habe ich wohl was missverstanden
bei PaintBox steht nämlich
Code: Alles auswählen
/******************************************************************************
PaintBox
paint a box
\param sx,sy,ex,ey : x,y position and size
\param mode : box mode
\param color : color
\return : none
******************************************************************************/
und mit size habe ich das so aufgefasst das man einen startpunkt angibt und ex/ey nur sagen wie gross. das ist aber falsch !!!!!!!!
sx,sy,ex,ey in Paintbox sind absolute Koordinaten innerhalb des Bildschirms . Das soll heissen wie unten Beschrieben ich kann mit sx,sy in der Paintbox mit (0,0) anfangen das wäre dann links oben bis maximal
aus dem Plugin übergeben Werten die zwar gleich bezeichnet sind aber so direkt nix miteinander zu tun haben, ex(max) Paint Box
also sx,sy,ex,ey die übergeben werte geben mir dann an das der z.B an PaintBox übergeben Wert ex nicht grösser sein darf als dem Plugin übergeben Wert (ex-sx) = ex(max) Paint Box
Zudem schmiert das ganze ab sobald ey in der PaintBox grösser wird als 555
Code: Alles auswählen
void ShowBox(int iPos)
{
/******************************************************************************
PaintBox
paint a box
\param sx,sy,ex,ey : x,y position and size
\param mode : box mode
\param color : color
\return : none
Aufruf :
void PaintBox(int sx, int sy, int ex, int ey, int mode, int color)
!!!!! ey <= 555 sonst segmetaition fault
mode [FILL, GRID};
color kann m {TRANSP, WHITE, SKIN0, SKIN1, SKIN2, ORANGE, GREEN, YELLOW, RED};
aus gui.h
#define TCCHARSIZE 24
#define TCROWSIZE 28
******************************************************************************/
int i; // counter
int sxmax = ex - sx; //maximal darstellbarer x Bereich im Plugin
int symax = ey - sy; //maximal darstellbarer y Bereich im Plugin
/***************************************************************
Im Plugin dürfen nun die groessen Parameter die an PaintBox übergeben weden
Bsp void PaintBox(int x1, int y1 , int x2, int y2, int mode, int color)
innerhalb bestimtter Grössen liegen
0 <= x1 < X2 <= sxmax , 0 <= y1 < y2 <= symax
P1(0/0)
+-------------------------------------------+
| P3(xstart/ystart) |
| +---------------------------------+ |
| | Zeile 1 text1 text2 | | mrows[0][lang]
| +---------------------------------+ |
| | Zeile 2 text1 text2 | | mrows[1][lang]
| | | |
| | | |
| | Pbox(x1/y1) | |
| | + | |
| | Pbox(x2/y2) | |
| | + | |
| | | |
| | Zeile 10 text1 text2 | | mrows[9][lang]
| +---------------------------------+ |
| | OK select, DBOX save, HOME exit | | mrows[10][lang]
| +---------------------------------+ |
| P4 | P4(xstart + xpluginsize /ystart + ypluginsize )
+-------------------------------------------+
P2(sxmax/symax)
****************************************************************/
int k = 0.9; // Zoomfaktor 90% -> k = 90%/100%
int xpluginsize = sxmax * k; // x Groesse des Plugin Fenster
int ypluginsize = symax * k; // y Groesse des Plugin Fenster
int xstart = (sxmax - xpluginsize)/2; // Offset x Startpunkt des Plugin Fenster P3(x)
int ystart = (symax - ypluginsize)/2; // Offset y Startpunkt des Plugin Fenster P3)y)
// Definition von Pbox(x1/y1) und Pbox(x2/y2)
int Pbox [2] [2] = {
{0,0},
{0,0}
};
int iHStart = 0; // start col (210) = sx
int iHSize = 400; // columns
int iHEnd = iHStart+iHSize; // end col = ex = Position
int sy = TCCHARSIZE+TCROWSIZE-5; // rows step
char tmpstr[9]; // temporary var for integer conversion
printf("gui.c Line: %d\n",__LINE__);
// paint window box body
Pbox[0] [0] = xstart;
Pbox[0] [1] = ystart;
Pbox[1] [0] = xstart + xpluginsize;
Pbox[1] [1] = ystart + ypluginsize;
printf("gui.c Line: %d Pbox(x1/y1) = (%d/%d)\n",__LINE__, Pbox[0] [0], Pbox[0] [1]);
printf("gui.c Line: %d Pbox(x2/y2) = (%d/%d)\n",__LINE__, Pbox[1] [0], Pbox[1] [1]);
printf("gui.c Line: %d\n",__LINE__);
PaintBox( Pbox[0] [0], Pbox[0] [1], Pbox[1] [0], Pbox[1] [1], FILL, SKIN0 );
// paint Render Object inside Box
RenderSObject(50,60,RED,OBJ_CIRCLE);
printf("gui.c Line: %d\n",__LINE__);
// copy all from bufer to screen
memcpy(lfb, lbb, var_screeninfo.xres*var_screeninfo.yres);
}
Martin
P.S ach ja und die ganze Box wird jetz immer automatisch zentriert und gezoomt