gCAD3D 2.40
xa_ui_gr.c File Reference

GUI graphicwindow. More...

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "../ut/ut_geo.h"
#include "../ut/ut_txt.h"
#include "../ut/ut_memTab.h"
#include "../ut/ut_TX.h"
#include "../ut/ut_os.h"
#include "../ut/ut_cast.h"
#include "../ut/ut_err.h"
#include "../ut/ut_gtypes.h"
#include "../ut/ut_txfil.h"
#include "../gui/gui__.h"
#include "../gr/ut_gr.h"
#include "../gr/ut_DL.h"
#include "../ut/func_types.h"
#include "../gr/ut_GL.h"
#include "../db/ut_DB.h"
#include "../xa/xa.h"
#include "../xa/xa_ui.h"
#include "../xa/xa_edi__.h"
#include "../xa/xa_ui_gr.h"
#include "../xa/xa_ui_cad.h"
#include "../xa/xa_mem.h"
#include "../xa/xa_sele.h"
#include "../xa/xa_app.h"
#include "../xa/xa_ato.h"
#include "../xa/xa_ed_mem.h"

Macros

#define TRUE   1
 
#define FALSE   0
 
#define GR_Func_Pan   1
 
#define GR_Func_Rot   2
 
#define GR_Func_Scl   3
 
#define SEL_Posi2P   1
 
#define SEL_Vert2P   2
 
#define SEL_Obj2P   3
 
#define SEL_dump   4
 
#define SELTABSIZ   100
 
#define SELTABLEN   60
 
#define oaSIZ   10
 

Functions

int UI_GR_selMen_cbSel (MemObj *mo, void **data)
 
int UI_GL_draw__ (MemObj *mo, void **data)
 
int UI_GL_move__ (MemObj *mo, void **data)
 
int UI_GL_mouse__ (MemObj *mo, void **data)
 
int UI_key_mod_set (int event, int ikey, int keyMod)
 
int UI_key_mod_decode (imod)
 
int UI_key_view_decode ()
 
int UI_key_view__ (int imod, int ikey)
 
int UI_TUT_key (int ikey)
 
int UI_GL_keys__ (MemObj *mo, void **data)
 
int UI_key_spcAlt (int iKey)
 
int UI_key_spcCtrl (int iKey)
 
int UI_key_spcShAlt (int iKey)
 
int UI_key_return ()
 
int UI_key_delete ()
 
int UI_unHili ()
 
int UI_key_escape ()
 
int UI_key_sel_fi (int iKey)
 
int GR_set_dispTra (int mode)
 
int UI_CB_hide (MemObj *mo, void **data)
 
int UI_GR_ScalAuto (int mode)
 
int UI_viewCB (MemObj *mo, void **data)
 
int UI_GR_expose ()
 
int UI_GR_CB_Sel2 (MemObj *mo, void **data)
 
int UI_GR_Select1 (int mode, long *dlInd)
 
int UI_GR_namTab_ck_Uniq (char namTab[][SELTABLEN], int sNr, int tabSiz, int typ, long dbi)
 
int UI_GR_disp_oid (char *oid, int att)
 
int UI_GR_dump_selTab (ObjDB *selTab, char namTab[][SELTABLEN], int iNr)
 
int UI_GR_dump_dlTab (ObjDB *dlTab, int iNr)
 
int UI_GR_Select2 (int typ, long dbi, long dli)
 
int UI_GR_Select3 (long objInd)
 
int UI_GR_Sel_Filter (int mode)
 
int GR_set_constPlnPos ()
 
int GR_get_constPlnPos (Point *po)
 
int UI_GR_ButtonM1Release ()
 
int UI_CursorWait (int mode)
 
int UI_CursorNo (int mode)
 
int UI_ResetCursor ()
 
int UI_ChangeCursor (int newCur)
 
void UI_GR_view_set_Z (long objInd)
 
void UI_GR_view_set_Z1 (double zVal)
 
int UI_GR_SelVert (Point *pto)
 
int AP_Mousemove2dx (double *dv, int dx, int dy)
 
int UI_CurPos_upd ()
 
int UI_GR_get_actPosA (Point *curPosAbs)
 
int UI_GR_get_actPos_ (char **p)
 
int UI_GR_actPos ()
 
int UI_GR_Indicate ()
 
int UI_GR_Select_work1 (long objInd)
 
int AP_UserSelection_reset ()
 
int AP_UserSelection_get (int uFunc())
 
int AP_UserMousemove_get (int uFunc())
 
int AP_UserMousemove_reset ()
 
int UI_GR_Select_work2 (int typ, long dbi, char *buf, long dli)
 
int UI_KeyFieldWri ()
 
int UI_GR_selMen_init (int mode)
 

Variables

AP_STAT AP_stat
 
int WC_modact_ind
 
MemObj UI_curPos
 
int WC_sur_ind
 Der Index auf die ActiveConstrPlane. More...
 
Mat_4x3 WC_sur_mat
 
Mat_4x3 WC_sur_imat
 inverse TrMat of ActiveConstrPlane More...
 
MemObj winMain
 
MemObj winGR
 
MemObj winED
 
MemObj ckb_such
 
MemObj ckb_meas
 
MemObj ckb_hide
 
MemObj ckb_view
 
int KeyStatShift
 
int KeyStatCtrl
 
int KeyStatAlt
 
int KeyStatEscape
 
int UI_Focus
 
int UI_InpMode
 
int UI_InpVWZ
 
int UI_EditMode
 
char UI_stat_view
 
char UI_stat_hide
 
char UI_stat_3D
 
int UI_RelAbs
 
int(* UI_UserKeyFunc )()
 
int xa_fl_TxMem
 
int APT_dispPT
 
int APT_dispPL
 
int APT_dispSOL
 
DL_AttGR_ObjTab
 
int GR_selTyp
 
long GR_selDbi
 
long GR_selDli
 
char GR_selNam [128]
 
int GL_rub_stat
 
void * GL_widget
 
int(* UI_UserSelFunc )()
 
int(* UI_UserMousemoveFunc )()
 
int KeyM1 = OFF
 
int KeyM2 = OFF
 
int KeyM3 = OFF
 
static Point GR_CurUk
 curPos in worldCoords on constructionPlane More...
 
int GR_Func_Act =0
 
int GR_Event_Act
 
static int GR_do_dispTra = 0
 
static int GR_Sel_Filter = 0
 
static char GR_actPos [60]
 
static int GR_optMenNr
 
static long GR_dli_hili
 

Detailed Description

GUI graphicwindow.

=====================================================
List_functions_start:
UI_GL_move__ callBack mouse-movement
UI_GL_mouse__ callback mouseButton press | release | scroll
UI_GL_draw__ Redraw whole scene.
UI_GR_ButtonM1Release
UI_GL_keys__ callback keypress
UI_key_spcAlt work keys with Alt
UI_key_spcCtrl work keys with Ctrl
UI_key_spcShAlt work keys with Alt shift
UI_key_mod_decode decode state of modier-keys;
UI_key_view_decode update GR_Func_Act & cursorType
UI_key_view__ do grafic-viewing (check for shift|Ctrl|Alt-key)
UI_TUT_key ScreenCast-mode: display key
UI_viewCB change view
UI_GR_ScalAuto "butRes"/ScaleFix & "butRes"/ScaleAll
UI_CK_HIDE_VIEW test if hide or view is active INLINE
UI_GR_expose Redraw; MS only ..
UI_CursorWait 0=change to wait-cursor, 1=reset cursor
UI_CurPos_upd update label cursor-position
UI_GR_get_actPos_ return the active cursorPosition as string "<x> <y> <z>"
UI_GR_get_actPosA get current curPos in userCoords on constructionPlane
UI_GR_SelVert get vertex nearest to cursor
UI_GR_CB_Sel2 CB of MouseOverPopup-Eintrag
UI_GR_Select1 get objs from GL
UI_GR_Select2 Popup-Eintrag selektiert
UI_GR_Select3 hilite obj ..
UI_GR_Destroy
UI_GR_Select_work_vc selection (only for vector)
UI_GR_selMen_init create popup-menu for mousebutton-middle
UI_GR_selMen_cbSel callback of popup-menu
GR_set_dispTra inhibit display-transformations; 0=yes, 1=no
UI_GR_GetdlInd get zuletzt selektierte DLIndex#
AP_Mousemove2dx get single value from relative mousemove
AP_UserSelFunc_get test if plugin is active
UI_GR_FROM
UI_GR_RAPID
List_functions_end:
=====================================================
// UI_key_sel_fi
// UI_GR_setKeyFocus set focus to glarea widget
// UI_GR_view
// UI_GR_Init
// UI_GR_Redraw Main RedrawFunction
// UI_GR_WinInit
// UI_GR_GLInit
// UI_GR_Draw When widget is exposed
// UI_GR_Reshape When glarea widget size changes
// UI_GR_CB_Sel1 CB of Select aus Popup-Men.

Macro Definition Documentation

#define TRUE   1
#define FALSE   0
#define GR_Func_Pan   1
#define GR_Func_Rot   2
#define GR_Func_Scl   3
#define SEL_Posi2P   1
#define SEL_Vert2P   2
#define SEL_Obj2P   3
#define SEL_dump   4
#define SELTABSIZ   100
#define SELTABLEN   60
#define oaSIZ   10

Function Documentation

int UI_GR_selMen_cbSel ( MemObj mo,
void **  data 
)
int UI_GL_draw__ ( MemObj mo,
void **  data 
)
* Redraw necessary. Redraw whole scene.
* GUI_DATA_DEVICE=*(int*)data[1]=TYP_DeviceScreen0
* GUI_DATA_I1 =*(int*)data[2]=window-width (for event=TYP_EventConfig)
* GUI_DATA_I2 =*(int*)data[3]=window-height (for event=TYP_EventConfig)
* GUI_DATA_I1 =*(int*)data[2]=modifierKeyState (for event=TYP_EventEnter)
*
int UI_GL_move__ ( MemObj mo,
void **  data 
)
* UI_GL_move__ callBack mouse-movement
* GUI_DATA_EVENT=*(int*)data[0]=TYP_EventMove
* GUI_DATA_I1 =*(int*)data[2]=x-val mousepos in screencoords
* GUI_DATA_I2 =*(int*)data[3]=y-val mousepos in screencoords
*
int UI_GL_mouse__ ( MemObj mo,
void **  data 
)
* UI_GL_mouse__ callback mouseButton press | release | scroll
* GUI_DATA_EVENT=*(int*)data[0]=TYP_EventPress|TYP_EventRelease
* GUI_DATA_I2 =*(int*)data[1]=button; GUI_MouseL|M|R|2L|ScUp|ScDown
*
int UI_key_mod_set ( int  event,
int  ikey,
int  keyMod 
)

update modifier-keys (KeyStatShift, KeyStatAlt, KeyStatCtrl); keyMod &1=shift; &4=ctrl; &8=alt; 0=normal. KeyStatShift,KeyStatAlt,KeyStatCtrl: 1=off, 0=on.

int UI_key_mod_decode ( imod  )
int UI_key_view_decode ( )
int UI_key_view__ ( int  imod,
int  ikey 
)
* do grafic-viewing (check for shift|Ctrl|Alt-key)
* Input:
* ikey keyCode
* RetCod: 0 = not used (no shift|Ctrl|Alt-key)
* 1 = found shift|Ctrl|Alt-key
* see also UI_GL_keys__
*
int UI_TUT_key ( int  ikey)

ScreenCast-mode: display key

int UI_GL_keys__ ( MemObj mo,
void **  data 
)
* GUI_DATA_EVENT=*(int*)data[0]=TYP_EventPress|TYP_EventRelease
* GUI_DATA_EVENT=*(int*)data[0]=TYP_EventPress|TYP_EventRelease
* GUI_DATA_I1 =*(int*)data[1]=TYP_DeviceKeyb
* GUI_DATA_I2 =*(int*)data[2]=keyvalue; eg 'a'
* GUI_DATA_I3 =*(int*)data[3]=state of modifierkeys;
* see ../gui/gui_types.h GUI_Modif_*
* &1=shift; &4=ctrl; &8=alt.
* Gtk3/Ubu-14 does not provide Ctrl-Press !
*
int UI_key_spcAlt ( int  iKey)

work keys with Alt

int UI_key_spcCtrl ( int  iKey)

work keys with Ctrl

int UI_key_spcShAlt ( int  iKey)
int UI_key_return ( )
int UI_key_delete ( )
int UI_unHili ( )
int UI_key_escape ( )
int UI_key_sel_fi ( int  iKey)
int GR_set_dispTra ( int  mode)
int UI_CB_hide ( MemObj mo,
void **  data 
)
int UI_GR_ScalAuto ( int  mode)
int UI_viewCB ( MemObj mo,
void **  data 
)
int UI_GR_expose ( )
int UI_GR_CB_Sel2 ( MemObj mo,
void **  data 
)
int UI_GR_Select1 ( int  mode,
long *  dlInd 
)
* get selected object;
* decode according requested type;
* start processing object
* Input:
* mode=-1: change ViewPlane; no List
* mode=0: create list of objects under cursor
* mode=0-99: display Popup-List; return selection
* mode=100: Popup-ListObj selected
* mode=101: ENTER Popup-ListObj; preview object
* mode=102: LEAVE Popup-ListObj;
* dlInd dispListIndex
* Output:
* RetCod 0 found more than 1 objects
* 1 one obj found; unknown obj: dlInd = -1; typ = Typ_Vertex.
* -1 no object selected; TmpPT on ConstPln
*
int UI_GR_namTab_ck_Uniq ( char  namTab[][SELTABLEN],
int  sNr,
int  tabSiz,
int  typ,
long  dbi 
)
int UI_GR_disp_oid ( char *  oid,
int  att 
)
int UI_GR_dump_selTab ( ObjDB selTab,
char  namTab[][SELTABLEN],
int  iNr 
)
int UI_GR_dump_dlTab ( ObjDB dlTab,
int  iNr 
)
int UI_GR_Select2 ( int  typ,
long  dbi,
long  dli 
)
int UI_GR_Select3 ( long  objInd)
int UI_GR_Sel_Filter ( int  mode)
int GR_set_constPlnPos ( )
* GR_set_constPlnPos set GR_CurUk = cursorPosition on constructionPlane
*
int GR_get_constPlnPos ( Point po)
int UI_GR_ButtonM1Release ( )
int UI_CursorWait ( int  mode)
int UI_CursorNo ( int  mode)
int UI_ResetCursor ( )
int UI_ChangeCursor ( int  newCur)
void UI_GR_view_set_Z ( long  objInd)
void UI_GR_view_set_Z1 ( double  zVal)
int UI_GR_SelVert ( Point pto)

get vertext nearest to cursor

int AP_Mousemove2dx ( double *  dv,
int  dx,
int  dy 
)

AP_Mousemove2dx get single value from relative mousemove

int UI_CurPos_upd ( )

UI_CurPos_upd update label cursor-position

int UI_GR_get_actPosA ( Point curPosAbs)
* get current curPos in userCoords on constructionPlane
* in absolute userCoords
* Input: GR_CurUk in worldCoords
* Output: curPosAbs in userCoords (relative to the active constrPlane)
* see also GL_GetViewPos
*
int UI_GR_get_actPos_ ( char **  p)

return (a pointer to) the active cursorPosition as string "P(<x> <y> <z>)" change "ConstrPlane" -> "P(<x> <y> <z>)"

int UI_GR_actPos ( )
int UI_GR_Indicate ( )
* get MousePos on Constr.Plane:
* - as *Point on Constr.Plane with DB_get_PT(0L)
* - as String ("P(x y z)") from GR_actPos
*
int UI_GR_Select_work1 ( long  objInd)
int AP_UserSelection_reset ( )
int AP_UserSelection_get ( int   uFunc())
* request Mousebutton-callback into function uFunc
*
* prototyp uFunc:
* int uFunc (int source, long DispListInd);
* DispListInd dli of selected obj
*
* get type of selected obj from global var GR_selTyp
* get cursorposition with UI_GR_get_actPosA (&Point)
* get DispList from DispListInd with DL_GetAtt (DispListInd)
*
int AP_UserMousemove_get ( int   uFunc())
* request Mousemove-callback into function uFunc
*
* prototyp uFunc:
* int uFunc (int dx, int dy);
*
*
int AP_UserMousemove_reset ( )
int UI_GR_Select_work2 ( int  typ,
long  dbi,
char *  buf,
long  dli 
)
int UI_KeyFieldWri ( )
int UI_GR_selMen_init ( int  mode)

Variable Documentation

AP_STAT AP_stat
int WC_modact_ind
MemObj UI_curPos
int WC_sur_ind

Der Index auf die ActiveConstrPlane.

Mat_4x3 WC_sur_mat

TrMat of ActiveConstrPlane only if (WC_sur_ind > 0)

Mat_4x3 WC_sur_imat

inverse TrMat of ActiveConstrPlane

MemObj winMain
MemObj winGR
MemObj winED
MemObj ckb_such
MemObj ckb_meas
MemObj ckb_hide
MemObj ckb_view
int KeyStatShift
int KeyStatCtrl
int KeyStatAlt
int KeyStatEscape
int UI_Focus
int UI_InpMode
int UI_InpVWZ
int UI_EditMode
char UI_stat_view
char UI_stat_hide
char UI_stat_3D
int UI_RelAbs
int(* UI_UserKeyFunc)()
int xa_fl_TxMem
int APT_dispPT
int APT_dispPL
int APT_dispSOL
DL_Att* GR_ObjTab
int GR_selTyp
long GR_selDbi
long GR_selDli
char GR_selNam[128]
int GL_rub_stat
void* GL_widget
int(* UI_UserSelFunc)()
int(* UI_UserMousemoveFunc)()
int KeyM1 = OFF
int KeyM2 = OFF
int KeyM3 = OFF
Point GR_CurUk
static

curPos in worldCoords on constructionPlane

int GR_Func_Act =0
int GR_Event_Act
int GR_do_dispTra = 0
static
int GR_Sel_Filter = 0
static
char GR_actPos[60]
static
int GR_optMenNr
static
long GR_dli_hili
static