|
Post by alexfish on Aug 14, 2012 1:22:00 GMT 1
Hi all since thread " Anyone interested in collaborating on a RAD" , now seems long and entwined have started a new thread RAD TOOL FOR BACON/HUG This is a Rad-tool-demo precompiled "32bit pre-demo - using IMAGE" for testing "FIRST PART" test the canvas + arrays , reimplementing "svg" "librsvg-2.so" all widget feedback is independant of the .so's , all is bacon and hug code, it will run from where it sits : I.E. open the folder and click it there is a sgv file , feel free to edit this file text clipping us not implemented there may be a bit of lag as regards the mouse , due to a lot Var array checking ,some done 3 and 4 times * 2, things will fall into place by hold the mouse still. implemented : two button edit , left click and right click , but open to sugestions , IE , a sizer widget ? ; some internal buffers are pre set [screen array 1000x1000 , svg array 1000] clues ; left click bottom right , right click top-left , fix "both left click" if all is well , then will implement this method in the full rad tool demo. Feed back is important. Have Fun and Regards alexfish Attachments:
|
|
|
Post by alexfish on Aug 19, 2012 20:54:40 GMT 1
This is the base for the sizer module -testing need the svg viewbox in the directory as the compiled demo had a mad time getting to grips with new 12.04 , best to load librsvg , and rest will fall into place . the bacongui gtk3 is offnuts says he i think most work from set arrays so leave code as is unless u know what your doing save the svg file at foot of page as viewbox GLOBAL svg$ TYPE STRING SYSTEM "mkdir /tmp/hugrad; chmod 777 /tmp/hugrad &" COPY "viewbox" TO "/tmp/hugrad/0" INCLUDE "hug.bac" HUGOPTIONS("NOSCALING") SETENVIRON "OUTPUT_CHARSET", "UTF-8" OPTION INTERNATIONAL TRUE CONST rsvg$ = "librsvg-2.so" gtk$ = HUGLIB$("gtk") gdk$ = HUGLIB$("gdk") HUGOPTIONS("NOSCALING")
IMPORT "gtk_image_set_from_pixbuf(long,long)" FROM gtk$ TYPE void IMPORT "rsvg_init()" FROM rsvg$ TYPE void IMPORT "rsvg_term()" FROM rsvg$ TYPE void IMPORT "rsvg_handle_new()" FROM rsvg$ TYPE long IMPORT "rsvg_handle_write(long,char*,long,int)" FROM rsvg$ TYPE int IMPORT "rsvg_handle_close(long,int)" FROM rsvg$ TYPE int IMPORT "rsvg_handle_get_pixbuf(long)" FROM rsvg$ TYPE long IMPORT "gtk_image_new_from_pixbuf(long)" FROM gtk$ TYPE long IMPORT "gdk_pixbuf_get_width(long)" FROM "libgdk_pixbuf-2.0.so.0" TYPE int IMPORT "gdk_pixbuf_get_height(long)" FROM "libgdk_pixbuf-2.0.so.0" TYPE int REM -----------------------------------------------------------------------
FUNCTION HUG_IMAGE_PIXBUF_MOVE(NUMBER hug_widget,STRING hug_text$,int x, int y) LOCAL image,myimage,ebox rsvg_init() mysvg = rsvg_handle_new() svi = rsvg_handle_write(mysvg, svg$, LEN(svg$), 0) svi = rsvg_handle_close(mysvg, 0) mypix = rsvg_handle_get_pixbuf(mysvg) rsvg_term() image = hug_widget_font(STR$(hug_widget)) gtk_image_set_from_pixbuf(image, mypix) SYNC gtk_widget_queue_draw(image) hug_widget_image$(STR$(hug_widget)) = hug_text$ g_object_unref(mysvg) g_object_unref(mypix) SYNC RETURN TRUE END FUNCTION
REM-------------------------------------------- FUNCTION EVENT_IMAGE(STRING hug_file$, int hug_xsize, int hug_ysize)
LOCAL image, ebox
image = gtk_image_new_from_file(hug_file$) ebox = gtk_event_box_new() gtk_container_add(ebox, image)
gtk_widget_queue_draw(image) gtk_widget_set_events(ebox, GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_SCROLL_MASK) g_signal_connect_data(ebox, "button-press-event", hug_mouse_event, 20, 0, 0) g_signal_connect_data(ebox, "button-release-event", hug_mouse_event, 0, 0, 0) g_signal_connect_data(ebox, "motion-notify-event", hug_mouse_event, 0, 0, 0) g_signal_connect_data(ebox, "leave-notify-event", hug_mouse_event, 30, 0, 0) IF HUG_WIDGET_SHOW THEN gtk_widget_show_all(ebox)
hug_widget_xsize(STR$(ebox)) = hug_xsize hug_widget_ysize(STR$(ebox)) = hug_ysize hug_widget_signal(STR$(ebox)) = 4 hug_widget_s_widget(STR$(ebox)) = ebox
hug_widget_type$(STR$(ebox)) = "image" hug_widget_font(STR$(ebox)) = image hug_widget_focus(STR$(ebox)) = image
hug_widget_image$(STR$(ebox)) = hug_file$
RETURN ebox
END FUNCTION REM --------------------------------------------------------- FUNCTION mouse LOCAL t,bit TYPE int
svgdata$="" IF MOUSE(0) > -1 THEN IF MOUSE(2) > -1 THEN IF screen$[MOUSE(0)][MOUSE(1)] = "0" THEN RETURN TRUE ed$=screen$[MOUSE(0)][MOUSE(1)] 'FOR t = 0 TO file_count -3 ' NEXT FOR t = 0 TO file_count -3 ck=INSTR(file$[t],ed$) IF (ck > 0) THEN edit_line= t BREAK END IF NEXT END IF END IF REM -----------------------------------------------------------TODO MOUSE CORDINATES --------------------------------- IF MOUSE(2) = 1 THEN : WHILE (MOUSE(0) > -1) DO 'TODO
edit_hug$=file$[edit_line] SPLIT edit_hug$ BY ":" TO hugcode$ SIZE hug data$= hugcode$[3] 'PRINT data$ SPLIT data$ BY "," TO bitsize$ SIZE bits ed_x=VAL(bitsize$[1]) ed_y=VAL(bitsize$[2]) ed_x_width=VAL(bitsize$[3]) ed_y_height=VAL(bitsize$[4]) FOR y= ed_y TO (ed_y + ed_y_height) : FOR x = ed_x TO (ed_x+ed_x_width) screen$[x][y]="0" NEXT : NEXT REM ------------------------set the ords xon = MOUSE(0) - VAL(bitsize$[1]) IF xon < 16 THEN xon = 16 bitsize$[3]= STR$(xon) yon = MOUSE(1) - VAL(bitsize$[2]) IF yon < 16 THEN yon = 16 bitsize$[4]= STR$(yon) REM ------------------------set the edits EDIT_HUG_LINE_1$=CONCAT$(bitsize$[0],",",bitsize$[1],",",bitsize$[2],",",bitsize$[3],",",bitsize$[4]) hug_line$=CONCAT$(hugcode$[0],":",hugcode$[1],":",hugcode$[2],":",EDIT_HUG_LINE_1$,":",hugcode$[4]) file$[edit_line]=hug_line$ sgv_code$=file$[edit_line+1] SPLIT sgv_code$ BY "'" TO svg_bits$ SIZE svg_bit edline$ = CONCAT$(svg_bits$[0],"'",svg_bits$[1],"'",svg_bits$[2],"'",svg_bits$[3],"'",svg_bits$[4], "'", bitsize$[3],"'",svg_bits$[6],"'",bitsize$[4],"'") file$[edit_line+1]=edline$ text_edit$ = file$[edit_line+3] SPLIT file$[edit_line+3] BY "'" TO edits$ SIZE sets off_x$ = STR$(VAL(svg_bits$[1])+8) txt_x$ = off_x$ off_y$ = STR$(VAL(svg_bits$[3])+13) ed_text$=CONCAT$(edits$[0],"'",txt_x$,"'",edits$[2],"'",off_y$,"'",edits$[4]) file$[edit_line+3]=ed_text$ REM ------------------------- set the loader------------------------------------------------------------------
svg$="" FOR t=0 TO file_count -3 svg$=CONCAT$(svg$,file$[t]) ck=INSTR(file$[t],"HUG") IF (ck > 0) THEN SPLIT file$[t] BY ":" TO hugcode$ SIZE hug data$= hugcode$[3] SPLIT data$ BY "," TO bitsize$ SIZE bits wid_x = VAL(bitsize$[1]) wid_y = VAL(bitsize$[2]) wid_wdth = VAL(bitsize$[3]) wid_ht= VAL(bitsize$[4]) name$=bitsize$[0] FOR y = wid_y TO wid_y + wid_ht : FOR x = wid_x TO wid_x + wid_wdth screen$[x][y]=bitsize$[0] NEXT : NEXT END IF NEXT HUG_IMAGE_PIXBUF_MOVE(svg_screen1,svg$,MOUSE(0),MOUSE(1)) IF MOUSE(2) = 1 THEN BREAK WEND : END IF REM ------------MOVE------------------------------------------- IF MOUSE(2) = 3 THEN : WHILE (MOUSE(0) > -1) DO edit_hug$=file$[edit_line] SPLIT edit_hug$ BY ":" TO hugcode$ SIZE hug data$= hugcode$[3] SPLIT data$ BY "," TO bitsize$ SIZE bits ed_x=VAL(bitsize$[1]) ed_y=VAL(bitsize$[2]) ed_x_width=VAL(bitsize$[3]) ed_y_height=VAL(bitsize$[4]) FOR y= ed_y TO (ed_y + ed_y_height) : FOR x = ed_x TO (ed_x+ed_x_width) screen$[x][y]="0" NEXT : NEXT REM ------------------------set the ords xon = MOUSE(0) bitsize$[1]= STR$(xon) yon = MOUSE(1) bitsize$[2]= STR$(yon) REM ------------------------set the edits
EDIT_HUG_LINE_1$=CONCAT$(bitsize$[0],",",bitsize$[1],",",bitsize$[2],",",bitsize$[3],",",bitsize$[4]) hug_line$=CONCAT$(hugcode$[0],":",hugcode$[1],":",hugcode$[2],":",EDIT_HUG_LINE_1$,":",hugcode$[4]) file$[edit_line]=hug_line$ sgv_code$=file$[edit_line+1] SPLIT sgv_code$ BY "'" TO svg_bits$ SIZE svg_bit edline$ = CONCAT$(svg_bits$[0],"'",bitsize$[1],"'",svg_bits$[2],"'",bitsize$[2],"'",svg_bits$[4], "'", bitsize$[3],"'",svg_bits$[6],"'",bitsize$[4],"'") file$[edit_line+1]=edline$ text_edit$ = file$[edit_line+3] SPLIT file$[edit_line+3] BY "'" TO edits$ SIZE sets off_x$ = STR$(VAL(bitsize$[1])+8) txt_x$ = off_x$ off_y$ = STR$(VAL(bitsize$[2])+13) ed_text$=CONCAT$(edits$[0],"'",txt_x$,"'",edits$[2],"'",off_y$,"'",edits$[4]) file$[edit_line+3]=ed_text$ REM ------------------------- the loader------------------------------------------------------------------
' reset svg to 0 svg$="" FOR t=0 TO file_count -3 svg$=CONCAT$(svg$,file$[t]) ck=INSTR(file$[t],"HUG") IF (ck > 0) THEN SPLIT file$[t] BY ":" TO hugcode$ SIZE hug data$= hugcode$[3] SPLIT data$ BY "," TO bitsize$ SIZE bits wid_x = VAL(bitsize$[1]) wid_y = VAL(bitsize$[2]) wid_wdth = VAL(bitsize$[3]) MAX_X = wid_x + wid_wdth IF MAX_X > 1000 THEN MAX_X = 1000 END IF wid_ht= VAL(bitsize$[4]) name$=bitsize$[0] FOR y = wid_y TO wid_y + wid_ht : FOR x = wid_x TO MAX_X screen$[x][y]=bitsize$[0] NEXT : NEXT END IF NEXT HUG_IMAGE_PIXBUF_MOVE(svg_screen1,svg$,MOUSE(0),MOUSE(1) ) : IF MOUSE(2) = 1 THEN BREAK WEND : END IF
RETURN TRUE END FUNCTION
REM -----MAIN -----------------------------------------------------------------
win=WINDOW("Hug-raddemo-0.01-Test-sizing-module",600,600) PROPERTY(win, "resizable", 1) svg_screen1=EVENT_IMAGE("/tmp/hugrad/0",600,400) ATTACH(win,svg_screen1,0,0) DECLARE screen$[2010][2010] DECLARE file$[1000] '@ format the screen to all 0 FOR y = 0 TO 2000 : FOR x= 0 TO 2000 screen$[x][y]="0" NEXT : NEXT
REM ---------INIT-LOAD FROM FILE -------------------------------------------------------- file_count = 0 OPEN "/tmp/hugrad/0" FOR READING AS myfile WHILE NOT(ENDFILE(myfile)) DO IF NOT(ENDFILE(myfile)) THEN READLN txt$ FROM myfile IF (txt$ > "") THEN file$[file_[right][/right]count] = txt$ INCR file_count txt$=CHOP$(txt$) ck=INSTR(txt$,"HUG") IF (ck > 0) THEN SPLIT txt$ BY ":" TO hugcode$ SIZE hug data$= hugcode$[3] SPLIT data$ BY "," TO bitsize$ SIZE bits wid_x = VAL(bitsize$[1]) wid_y = VAL(bitsize$[2]) wid_wdth = VAL(bitsize$[3]) wid_ht= VAL(bitsize$[4]) name$=bitsize$[0] FOR y = wid_y TO wid_y + wid_ht : FOR x = wid_x TO wid_x + wid_wdth screen$[x][y]=bitsize$[0] NEXT : NEXT END IF END IF END IF WEND CLOSE FILE myfile
REM --------------------------------------------------------------------------- TIMEOUT(60,mouse) DISPLAY
REM ---- END
the svg file <svg id=':INIT:WINDOW:test-svg,600,400' width='600' height='400'> <rect id=':HUG:BUTTON:button1,0,0,75,25:' x='0' y='0' width='75' height='25' ry='3' fill='#d0d0d0' stroke='black' stroke-width='1' style='display:1 ' /> <text x='8' y='16'>Button1</text> <rect id=':HUG:BUTTON:button2,15,0,75,25:' x='15' y='0' width='75' height='25' ry='3' fill='#d0d0d0' stroke='black' stroke-width='1' style='display:1 ' /> <text x='23' y='16'>Button2</text> <rect id=':HUG:BUTTON:button3,15,100,200,25:' x='15' y='100' width='200' height='25' ry='3' fill='#d0d0d0' stroke='black' stroke-width='1' style='display:1 ' /> <text x='90' y='116'>Click Me</text> <rect id=':HUG:BUTTON:button4,0,80,75,25:' x='0' y='80' width='75' height='25' ry='3' fill='#d0d0d0' stroke='pink' stroke-width='1' style='display:1 ' /> <text x='8' y='88'>Click Me twice</text> </svg> can play around with this Have fun and regards alexfish
|
|
|
Post by alexfish on Aug 21, 2012 5:34:31 GMT 1
Here is speeded up version of the resizing the widgets module
the screen array is updated after drawing the pixpuff update
pre-set screen array is 2000x2000 and the image is set to 1000 x 1000
the sgv file set to 1000x1000
'extracts of sizing modules in the rad tool demo "in progress" SYSTEM "mkdir /tmp/hugrad; chmod 777 /tmp/hugrad &" COPY "viewbox" TO "/tmp/hugrad/0" INCLUDE "hug79.bac" HUGOPTIONS("NOSCALING") SETENVIRON "OUTPUT_CHARSET", "UTF-8" OPTION INTERNATIONAL TRUE CONST rsvg$ = "librsvg-2.so" gtk$ = HUGLIB$("gtk") gdk$ = HUGLIB$("gdk") HUGOPTIONS("NOSCALING")
IMPORT "gtk_image_set_from_pixbuf(long,long)" FROM gtk$ TYPE void IMPORT "rsvg_init()" FROM rsvg$ TYPE void IMPORT "rsvg_term()" FROM rsvg$ TYPE void IMPORT "rsvg_handle_new()" FROM rsvg$ TYPE long IMPORT "rsvg_handle_write(long,char*,long,int)" FROM rsvg$ TYPE int IMPORT "rsvg_handle_close(long,int)" FROM rsvg$ TYPE int IMPORT "rsvg_handle_get_pixbuf(long)" FROM rsvg$ TYPE long IMPORT "gtk_image_new_from_pixbuf(long)" FROM gtk$ TYPE long IMPORT "gdk_pixbuf_get_width(long)" FROM "libgdk_pixbuf-2.0.so.0" TYPE int IMPORT "gdk_pixbuf_get_height(long)" FROM "libgdk_pixbuf-2.0.so.0" TYPE int REM -----------------------------------------------------------------------
FUNCTION HUG_IMAGE_PIXBUF_MOVE(NUMBER hug_widget,STRING hug_text$,int x, int y) LOCAL image,myimage,ebox rsvg_init() mysvg = rsvg_handle_new() svi = rsvg_handle_write(mysvg, svg$, LEN(svg$), 0) svi = rsvg_handle_close(mysvg, 0) mypix = rsvg_handle_get_pixbuf(mysvg) rsvg_term() image = hug_widget_font(STR$(hug_widget)) gtk_image_set_from_pixbuf(image, mypix) SYNC gtk_widget_queue_draw(image) hug_widget_image$(STR$(hug_widget)) = hug_text$ g_object_unref(mysvg) g_object_unref(mypix) SYNC RETURN TRUE END FUNCTION
REM-------------------------------------------- FUNCTION EVENT_IMAGE(STRING hug_file$, int hug_xsize, int hug_ysize)
LOCAL image, ebox
image = gtk_image_new_from_file(hug_file$) ebox = gtk_event_box_new() gtk_container_add(ebox, image)
gtk_widget_queue_draw(image) gtk_widget_set_events(ebox, GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_SCROLL_MASK) g_signal_connect_data(ebox, "button-press-event", hug_mouse_event, 20, 0, 0) g_signal_connect_data(ebox, "button-release-event", hug_mouse_event, 0, 0, 0) g_signal_connect_data(ebox, "motion-notify-event", hug_mouse_event, 0, 0, 0) g_signal_connect_data(ebox, "leave-notify-event", hug_mouse_event, 30, 0, 0) IF HUG_WIDGET_SHOW THEN gtk_widget_show_all(ebox)
hug_widget_xsize(STR$(ebox)) = hug_xsize hug_widget_ysize(STR$(ebox)) = hug_ysize hug_widget_signal(STR$(ebox)) = 4 hug_widget_s_widget(STR$(ebox)) = ebox
hug_widget_type$(STR$(ebox)) = "image" hug_widget_font(STR$(ebox)) = image hug_widget_focus(STR$(ebox)) = image
hug_widget_image$(STR$(ebox)) = hug_file$
RETURN ebox
END FUNCTION REM --------------------------------------------------------- FUNCTION mouse LOCAL t,bit TYPE int EDIT_DONE = 0 svgdata$="" IF MOUSE(0) > -1 THEN IF MOUSE(2) > -1 THEN IF screen$[MOUSE(0)][MOUSE(1)] = "0" THEN RETURN TRUE ed$=screen$[MOUSE(0)][MOUSE(1)] FOR t = 0 TO file_count -3 ck=INSTR(file$[t],ed$) IF (ck > 0) THEN edit_line= t EDIT_DONE = 1 BREAK END IF NEXT END IF END IF REM -----------------------------------------------------------TODO MOUSE CORDINATES --------------------------------- IF MOUSE(2) = 1 THEN : WHILE (MOUSE(0) > -1) DO 'TODO EDIT_DONE = 1 PRINT "LT"
edit_hug$=file$[edit_line] SPLIT edit_hug$ BY ":" TO hugcode$ SIZE hug data$= hugcode$[3] SPLIT data$ BY "," TO bitsize$ SIZE bits ed_x=VAL(bitsize$[1]) ed_y=VAL(bitsize$[2]) ed_x_width=VAL(bitsize$[3]) ed_y_height=VAL(bitsize$[4]) 'FOR y= ed_y TO (ed_y + ed_y_height) : FOR x = ed_x TO (ed_x+ed_x_width) 'screen$[x][y]="0" 'NEXT : NEXT REM ------------------------set the ords xon = MOUSE(0) - VAL(bitsize$[1]) IF xon < 16 THEN xon = 16 bitsize$[3]= STR$(xon) yon = MOUSE(1) - VAL(bitsize$[2]) IF yon < 16 THEN yon = 16 bitsize$[4]= STR$(yon) REM ------------------------set the edits EDIT_HUG_LINE_1$=CONCAT$(bitsize$[0],",",bitsize$[1],",",bitsize$[2],",",bitsize$[3],",",bitsize$[4]) hug_line$=CONCAT$(hugcode$[0],":",hugcode$[1],":",hugcode$[2],":",EDIT_HUG_LINE_1$,":",hugcode$[4]) file$[edit_line]=hug_line$ sgv_code$=file$[edit_line+1] SPLIT sgv_code$ BY "'" TO svg_bits$ SIZE svg_bit edline$ = CONCAT$(svg_bits$[0],"'",svg_bits$[1],"'",svg_bits$[2],"'",svg_bits$[3],"'",svg_bits$[4], "'", bitsize$[3],"'",svg_bits$[6],"'",bitsize$[4],"'") file$[edit_line+1]=edline$ text_edit$ = file$[edit_line+3] SPLIT file$[edit_line+3] BY "'" TO edits$ SIZE sets off_x$ = STR$(VAL(svg_bits$[1])+8) txt_x$ = off_x$ off_y$ = STR$(VAL(svg_bits$[3])+13) ed_text$=CONCAT$(edits$[0],"'",txt_x$,"'",edits$[2],"'",off_y$,"'",edits$[4]) file$[edit_line+3]=ed_text$ REM ------------------------- set the loader------------------------------------------------------------------
svg$="" FOR t=0 TO file_count -3 svg$=CONCAT$(svg$,file$[t]) ck=INSTR(file$[t],"HUG") IF (ck > 0) THEN SPLIT file$[t] BY ":" TO hugcode$ SIZE hug data$= hugcode$[3] SPLIT data$ BY "," TO bitsize$ SIZE bits wid_x = VAL(bitsize$[1]) wid_y = VAL(bitsize$[2]) wid_wdth = VAL(bitsize$[3]) wid_ht= VAL(bitsize$[4]) 'name$=bitsize$[0] 'FOR y = wid_y TO wid_y + wid_ht : FOR x = wid_x TO wid_x + wid_wdth 'screen$[x][y]=bitsize$[0] 'NEXT : NEXT END IF NEXT HUG_IMAGE_PIXBUF_MOVE(svg_screen1,svg$,MOUSE(0),MOUSE(1)) IF MOUSE(2) = 1 THEN BREAK WEND : END IF REM ------------MOVE------------------------------------------- IF MOUSE(2) = 3 THEN : WHILE (MOUSE(0) > -1) DO EDIT_DONE = 1 PRINT "RT" edit_hug$=file$[edit_line] SPLIT edit_hug$ BY ":" TO hugcode$ SIZE hug data$= hugcode$[3] SPLIT data$ BY "," TO bitsize$ SIZE bits ed_x=VAL(bitsize$[1]) ed_y=VAL(bitsize$[2]) ed_x_width=VAL(bitsize$[3]) ed_y_height=VAL(bitsize$[4]) 'FOR y= ed_y TO (ed_y + ed_y_height) : FOR x = ed_x TO (ed_x+ed_x_width) 'screen$[x][y]="0" 'NEXT : NEXT REM ------------------------set the ords xon = MOUSE(0) bitsize$[1]= STR$(xon) yon = MOUSE(1) bitsize$[2]= STR$(yon) REM ------------------------set the edits
EDIT_HUG_LINE_1$=CONCAT$(bitsize$[0],",",bitsize$[1],",",bitsize$[2],",",bitsize$[3],",",bitsize$[4]) hug_line$=CONCAT$(hugcode$[0],":",hugcode$[1],":",hugcode$[2],":",EDIT_HUG_LINE_1$,":",hugcode$[4]) file$[edit_line]=hug_line$ sgv_code$=file$[edit_line+1] SPLIT sgv_code$ BY "'" TO svg_bits$ SIZE svg_bit edline$ = CONCAT$(svg_bits$[0],"'",bitsize$[1],"'",svg_bits$[2],"'",bitsize$[2],"'",svg_bits$[4], "'", bitsize$[3],"'",svg_bits$[6],"'",bitsize$[4],"'") file$[edit_line+1]=edline$ text_edit$ = file$[edit_line+3] SPLIT file$[edit_line+3] BY "'" TO edits$ SIZE sets off_x$ = STR$(VAL(bitsize$[1])+8) txt_x$ = off_x$ off_y$ = STR$(VAL(bitsize$[2])+13) ed_text$=CONCAT$(edits$[0],"'",txt_x$,"'",edits$[2],"'",off_y$,"'",edits$[4]) file$[edit_line+3]=ed_text$ REM ------------------------- the loader------------------------------------------------------------------
' reset svg to 0 svg$="" FOR t=0 TO file_count -3 svg$=CONCAT$(svg$,file$[t]) ck=INSTR(file$[t],"HUG") IF (ck > 0) THEN SPLIT file$[t] BY ":" TO hugcode$ SIZE hug data$= hugcode$[3] SPLIT data$ BY "," TO bitsize$ SIZE bits wid_x = VAL(bitsize$[1]) wid_y = VAL(bitsize$[2]) wid_wdth = VAL(bitsize$[3]) MAX_X = wid_x + wid_wdth IF MAX_X > 1000 THEN MAX_X = 1000 END IF wid_ht= VAL(bitsize$[4]) name$=bitsize$[0] 'FOR y = wid_y TO wid_y + wid_ht : FOR x = wid_x TO MAX_X 'screen$[x][y]=bitsize$[0] 'NEXT : NEXT END IF NEXT HUG_IMAGE_PIXBUF_MOVE(svg_screen1,svg$,MOUSE(0),MOUSE(1) ) : IF MOUSE(2) = 1 THEN BREAK WEND : END IF IF EDIT_DONE = 1 THEN 'BLANK IT FOR y = 0 TO 2000 : FOR x= 0 TO 2000 screen$[x][y]="0" NEXT : NEXT 'redo screen id array FOR t=0 TO file_count -3 'svg$=CONCAT$(svg$,file$[t]) ck=INSTR(file$[t],"HUG") IF (ck > 0) THEN SPLIT file$[t] BY ":" TO hugcode$ SIZE hug data$= hugcode$[3] SPLIT data$ BY "," TO bitsize$ SIZE bits wid_x = VAL(bitsize$[1]) wid_y = VAL(bitsize$[2]) wid_wdth = VAL(bitsize$[3]) MAX_X = wid_x + wid_wdth IF MAX_X > 1000 THEN MAX_X = 1000 END IF wid_ht= VAL(bitsize$[4]) name$=bitsize$[0] FOR y = wid_y TO wid_y + wid_ht : FOR x = wid_x TO MAX_X screen$[x][y]=bitsize$[0] NEXT : NEXT END IF NEXT END IF RETURN TRUE END FUNCTIONREM -----MAIN -----------------------------------------------------------------
win=WINDOW("Hug-raddemo-0.01-Test-sizing-module",600,600) PROPERTY(win, "resizable", 1) svg_screen1=EVENT_IMAGE("/tmp/hugrad/0",1000,1000) ATTACH(win,svg_screen1,0,0) DECLARE screen$[2010][2010] DECLARE file$[1000] '@ format the screen to all 0 FOR y = 0 TO 2000 : FOR x= 0 TO 2000 screen$[x][y]="0" NEXT : NEXT
REM ---------INIT-LOAD FROM FILE -------------------------------------------------------- file_count = 0 OPEN "/tmp/hugrad/0" FOR READING AS myfile WHILE NOT(ENDFILE(myfile)) DO IF NOT(ENDFILE(myfile)) THEN READLN txt$ FROM myfile IF (txt$ > "") THEN file$[file_count] = txt$ INCR file_count txt$=CHOP$(txt$) ck=INSTR(txt$,"HUG") IF (ck > 0) THEN SPLIT txt$ BY ":" TO hugcode$ SIZE hug data$= hugcode$[3] SPLIT data$ BY "," TO bitsize$ SIZE bits wid_x = VAL(bitsize$[1]) wid_y = VAL(bitsize$[2]) wid_wdth = VAL(bitsize$[3]) wid_ht= VAL(bitsize$[4]) name$=bitsize$[0] FOR y = wid_y TO wid_y + wid_ht : FOR x = wid_x TO wid_x + wid_wdth screen$[x][y]=bitsize$[0] NEXT : NEXT END IF END IF END IF WEND CLOSE FILE myfile
REM --------------------------------------------------------------------------- ' EDIT this value if have mouse issues TIMEOUT(50,mouse) DISPLAY
REM ---- END
the svg , save in same folder as the compiled code above , as as "viewbox"
<svg id=':INIT:WINDOW:test-svg,600,400' width='1000' height='1000'> <rect id=':HUG:BUTTON:button1,0,0,75,25:' x='0' y='0' width='75' height='25' ry='3' fill='#d0d0d0' stroke='black' stroke-width='1' style='display:1 ' /> <text x='8' y='16'>Button1</text> <rect id=':HUG:BUTTON:button2,15,0,75,25:' x='15' y='0' width='75' height='25' ry='3' fill='#d0d0d0' stroke='black' stroke-width='1' style='display:1 ' /> <text x='23' y='16'>Button2</text> <rect id=':HUG:BUTTON:button3,15,100,200,25:' x='15' y='100' width='200' height='25' ry='3' fill='#ffffff' stroke='black' stroke-width='1' style='display:1 ' /> <text x='90' y='116'>Click Me</text> <rect id=':HUG:BUTTON:button4,0,80,75,25:' x='0' y='80' width='75' height='25' ry='3' fill='#d0d0d0' stroke='blue' stroke-width='1' style='display:1 ' /> <text x='8' y='88'>Click Me twice</text> </svg>
try editing the colours and the stroke width
Have fun
Regards
alexfish
|
|
|
Post by alexfish on Sept 3, 2012 9:52:37 GMT 1
Hi all Rad tool demo Beta 0.1 Release Date is planned for Sun 9th Sep 2012 Attachments:
|
|
|
Post by vovchik on Sept 3, 2012 11:50:37 GMT 1
Dear alexfish,
Looks like the Glade designer. Nice.....
With kind regards, vovchik
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Sept 3, 2012 13:45:45 GMT 1
Rad tool demo Beta 0.1 Release Date is planned for Sun 9th Sep 2012 Nice work! I will definitely test it.
|
|
|
Post by Pjot on Sept 5, 2012 6:52:35 GMT 1
Impressive! Looking forward to test it too.
Best regards Peter
|
|
|
Post by alexfish on Sept 6, 2012 23:28:17 GMT 1
Now i got the shakes phew! almost there , here is a update of the widgets, as they will be shown on the editor only two to go List and file browser , Attachments:
|
|
|
Post by alexfish on Sept 7, 2012 3:04:03 GMT 1
if wondering , as regards , the widget format + the text positioning the screen shot will best explain examine the editor to the left , and compare to the compiled code to the right Attachments:
|
|
|
Post by alexfish on Sept 9, 2012 3:00:10 GMT 1
Hi all
uploading will start in 12 hrs + - 6hr
of time stamp.
regards, +, thanks to all members of this forum
Special thanks to Peter for an amazing concept, what can I say,
Dank u wel , Strange , I spent some time in Delft , or as they by Delft, and often went to Den Hauge. nearer to English is , IN, can't get to grips with Interglot. They Have a nice icecream. Can't wait to taste it again, Hope I can find that place as in icecream parlour .
all coding is a combination of code written within this Forum + BaCon + Hug
As said . Just need to put the Bits together.
Alex.
|
|
|
Post by alexfish on Sept 9, 2012 17:35:22 GMT 1
Rad demo beta 0.1 download from attachment please read the readme.txt usage, just explore it to place widget use the big ICON widget delete, not implemented only bug seems to be , after widget move or resize , wait a few seconds before compiling , disable of buttons not yet implement tab notebook , limited to one notebook and one tab , this is for purpose "testing only" have fun regards alexfish Attachments:
|
|
|
Post by alexfish on Sept 9, 2012 17:58:37 GMT 1
OOps just spotted something In the "gtk-widgets-imgs" open up each .svg widget files and edit the line xlink:href="file:///home/alexfish/Desktop/raddemo/gtk-widgets-imgs/button.png" to suit your " /path/to/raddemo/gtk-widgets-imgs/button.png" rename the folder "raddemo0.1" to "raddemo" regards alexfish
|
|
|
Post by alexfish on Sept 9, 2012 18:23:12 GMT 1
you can change the window size in the executor tab IE: id=':HUG:WINDOW:window1,0,0,600,600:' then go to the Gui code tab then compile / with the "Execute button" Attachments:
|
|
|
Post by vovchik on Sept 9, 2012 23:03:56 GMT 1
Dear Alex,
Great work. I am waiting eagerly for the next version. Thanks!
With kind regards, vovchik
|
|
|
Post by Pjot on Sept 12, 2012 9:18:36 GMT 1
Hi Alex, Sorry for my late reply but I'm on holidays in Africa. Nevertheless I got my laptop with me, and couldn't resist checking out your first demo. It looks really promising! That's good Dutch, "geen dank" as we say in reply (e.g. "don't mention it") Thanks and regards Peter
|
|