gCAD3D 2.35
gui_gtk2/gtk_ed1.h File Reference

Go to the source code of this file.

Functions

MemObj GUI_edi__ (MemObj *o_par, void *funcnam, int mode, char *opts)
 
int GUI_edi_Insert (MemObj *mo, long cpos, char *txbuf, long txlen)
 
int GUI_edi_Write (MemObj *mo, char *txbuf, long *txlen, long maxlen)
 
int GUI_edi_Read (char *txbuf, long *txlen, long p1, long p2, MemObj *mo)
 
long GUI_edi_getEof (MemObj *mo)
 
long GUI_edi_getCpos (MemObj *mo)
 
int GUI_edi_setCpos (MemObj *mo, long cpos)
 
long GUI_edi_getLnr (MemObj *mo)
 
int GUI_edi_setLnr (MemObj *mo, long lNr)
 
int GUI_edi_scroll_s (MemObj *mo)
 
void GUI_edi_Focus (MemObj *mo)
 
int GUI_ed1_decode (MemObj *mo)
 
int GUI_edi_sel_get (long *p1, long *p2, MemObj *mo)
 
int GUI_edi_sel_ln (MemObj *mo, long lNr)
 
int GUI_edi_sel_wrf (MemObj *mo, char *fnam)
 
int GUI_edi_mod_ln (MemObj *mo, long lNr, char *newLn)
 

Function Documentation

MemObj GUI_edi__ ( MemObj o_par,
void *  funcnam,
int  mode,
char *  opts 
)
o_par parentBox
funcnam callback-function for Keypress & FocusIn-Events (none: NULL)
mode 0 = do not wrap lines; 1=yes, wrap lines
opts options; (HorSiz,VertSiz)
HorSiz,VertSiz: size in characters; default is automatic size.
negative values: size in pixels.
'e' = expand widget; default is fixed size.
Examples: "" or "10" or "10e,e"
"10e,e" horiz. size 10 chars, hor. and vert. expandable.
prototyp funcnam:
int funcnam (MemObj *mo, void **data);
// data=table of 3 pointers;
GUI_DATA_L1 =*(long*)data[1]=act.cursorPosition
GUI_DATA_L2 =*(long*)data[2]=act.lineNr.
GUI_DATA_I1 =*(int*)data[1]=keyvalue; eg 'a'
GUI_DATA_I2 =*(int*)data[2]=state of modifierkeys;
&1=shift; &4=ctrl; &8=alt.
Example without callback-function:
ed1 = GUI_edi__ (&box1, NULL, "");
Example with callback-function:
ed2 = GUI_edi__ (&box1, ed1_cb, "50,40");
..
int ed1_cb (MemObj *mo, void **data) {
printf(" event=%d typ=%d\n",GUI_DATA_EVENT,GUI_OBJ_TYP(mo));
printf(" key=%d modi=%d\n",GUI_DATA_I1,GUI_DATA_I2);
}
o_par parentBox
funcnam callback-function for Keypress & FocusIn-Events (none: NULL)
mode 0 = do not wrap lines; 1=yes, wrap lines
opts options; (HorSiz,VertSiz)
HorSiz,VertSiz: size in characters; default is automatic size.
negative values: size in pixels.
'e' = expand widget; default is fixed size.
Examples: "" or "10" or "10e,e"
"10e,e" horiz. size 10 chars, hor. and vert. expandable.
prototyp funcnam:
int funcnam (MemObj *mo, void **data);
// data=table of 3 pointers;
GUI_DATA_L1 =*(long*)data[1]=act.cursorPosition
GUI_DATA_L2 =*(long*)data[2]=act.lineNr.
GUI_DATA_I1 =*(int*)data[1]=keyvalue; eg 'a'
GUI_DATA_I2 =*(int*)data[2]=state of modifierkeys;
&1=shift; &4=ctrl; &8=alt.
Example without callback-function:
ed1 = GUI_edi__ (&box1, NULL, "");
Example with callback-function:
ed2 = GUI_edi__ (&box1, ed1_cb, "50,40");
..
int ed1_cb (MemObj *mo, void **data) {
printf(" event=%d typ=%d\n",GUI_DATA_EVENT,GUI_OBJ_TYP(mo));
printf(" key=%d modi=%d\n",GUI_DATA_I1,GUI_DATA_I2);
}
int GUI_edi_Insert ( MemObj mo,
long  cpos,
char *  txbuf,
long  txlen 
)
text einfuegen
cpos zB von GUI_edi_getCpos
text einfuegen
cpos zB von GUI_edi_getCpos
int GUI_edi_Write ( MemObj mo,
char *  txbuf,
long *  txlen,
long  maxlen 
)
das gesamte Editfenster neu schreiben (txbuf(=mem) -> Window).
ATTENTION: GUI_edi_Write can modify txbuf (changes into UTF8)
Input:
txbuf NULL-terminated
maxlen
Modif.:
2013-04-03 do not set cursor at eof.
das gesamte Editfenster neu schreiben (txbuf(=mem) -> Window).
ATTENTION: GUI_edi_Write can modify txbuf (changes into UTF8)
Modif.:
2013-04-03 do not set cursor at eof.
int GUI_edi_Read ( char *  txbuf,
long *  txlen,
long  p1,
long  p2,
MemObj mo 
)
get text between 2 positions
p1, p2 character-offset, not byte offsets !
get whole window with: p1=0L, p2=-1L
Input:
txlen size of txbuf
get text between 2 positions
p1, p2 character-offset, not byte offsets !
get whole window with: p1=0L, p2=-1L
Input:
txlen size of txbuf
long GUI_edi_getEof ( MemObj mo)

GUI_edi_getEof get total nr of chars (not bytes)

gtk_text_buffer_get_char_count get nr of chars, not nr of bytes !

GUI_edi_getEof get total nr of chars (not bytes)

gtk_text_buffer_get_char_count get nr of chars, not nr of bytes !

long GUI_edi_getCpos ( MemObj mo)
get cursorposition as offset from start-of-file.
0=startpos; Linedelimiters '\n' is one char.
cpos -> Zeilennummer: UTF_GetLnrPos
get cursorposition as offset from start-of-file.
0=startpos; Linedelimiters '\n' is one char.
cpos -> Zeilennummer: UTF_GetLnrPos
int GUI_edi_setCpos ( MemObj mo,
long  cpos 
)
set to curPos and view text at curPos
cpos -1L is end of file
set to curPos and view text at curPos
cpos -1L is end of file
long GUI_edi_getLnr ( MemObj mo)
GUI_edi_getLnr get LineNr of act.Curpos
First line = 1 !
GUI_edi_getLnr get LineNr of act.Curpos
First line = 1 !
int GUI_edi_setLnr ( MemObj mo,
long  lNr 
)
int GUI_edi_scroll_s ( MemObj mo)

scroll to active insert-mark makes unselect ?

scroll to active insert-mark makes unselect ?

void GUI_edi_Focus ( MemObj mo)

den Focus auf EditWindow

den Focus auf EditWindow

int GUI_edi_sel_get ( long *  p1,
long *  p2,
MemObj mo 
)
write selected -> file
txlen input = size of txbuf; Output = nr of characters read
write selected -> file
txlen input = size of txbuf; Output = nr of characters read
int GUI_edi_sel_ln ( MemObj mo,
long  lNr 
)
GUI_edi_sel_ln select Line, set Curpos to Line.
Erste Zeile ist 1
rc -1: lNr does not exist
ACHTUNG: die ZeilenStart/Endposition wird aus dem mem gelesen !!!!
GUI_edi_sel_ln select Line, set Curpos to Line.
Erste Zeile ist 1
rc -1: lNr does not exist
ACHTUNG: die ZeilenStart/Endposition wird aus dem mem gelesen !!!!
int GUI_edi_sel_wrf ( MemObj mo,
char *  fnam 
)
GUI_edi_sel_wrf write selected -> file
returns nr of chars
GUI_edi_sel_wrf write selected -> file
returns nr of chars
int GUI_edi_mod_ln ( MemObj mo,
long  lNr,
char *  newLn 
)

change line lNr into <newLn>

change line lNr into <newLn>