First commit
This commit is contained in:
8800
tools/WEE/EuGTK/GtkEngine.e
Normal file
8800
tools/WEE/EuGTK/GtkEngine.e
Normal file
File diff suppressed because it is too large
Load Diff
1441
tools/WEE/EuGTK/GtkEnums.e
Normal file
1441
tools/WEE/EuGTK/GtkEnums.e
Normal file
File diff suppressed because it is too large
Load Diff
222
tools/WEE/EuGTK/GtkEvents.e
Normal file
222
tools/WEE/EuGTK/GtkEvents.e
Normal file
@@ -0,0 +1,222 @@
|
||||
|
||||
namespace events
|
||||
|
||||
--Thanks to Pete Eberlein for helping with this!
|
||||
|
||||
include GtkEngine.e
|
||||
include std/convert.e
|
||||
|
||||
-- Maps keys from keypad to match same keys on keyboard,
|
||||
-- maps control/arrow keys to negative numbers, so they
|
||||
-- can be differentiated from the same ascii character
|
||||
-- values;
|
||||
|
||||
constant keyvalues = {
|
||||
{8,-8}, -- bksp
|
||||
{9,-9}, -- tab
|
||||
{20,-20}, -- scroll lock
|
||||
{27,27}, -- escape
|
||||
{80,-80}, -- home 'P'
|
||||
{81,-81}, -- left arrow 'Q'
|
||||
{82,-82}, -- up arrow 'R'
|
||||
{83,-83}, -- right arrow 'S'
|
||||
{84,-84}, -- down arrow 'T'
|
||||
{85,-85}, -- page up 'U'
|
||||
{86,-86}, -- page dn 'V'
|
||||
{87,-87}, -- end 'W'
|
||||
{99,-99}, -- insert 'c'
|
||||
{103,-103},
|
||||
{127,-127}, -- num lock
|
||||
|
||||
{141,13}, -- keypad Enter, with or w/o numlock;
|
||||
|
||||
-- keypad keys w/o numlock;
|
||||
{149,-149}, -- keypad home
|
||||
{150,-150}, -- keypad left
|
||||
{151,-151}, -- keypad up
|
||||
{152,-152}, -- keypad right
|
||||
{153,-153}, -- keypad down
|
||||
{154,-154}, -- keypad pg up
|
||||
{155,-155}, -- keypad pg dn
|
||||
{156,-156}, -- keypad end
|
||||
{157,-157}, -- keypad 5
|
||||
{158,-158}, -- keypad ins
|
||||
{159,-159}, -- keypad del
|
||||
|
||||
-- keypad keys with numlock - return ascii 0..9
|
||||
{170,'*'},{171,'+'},{173,'-'},{175,'/'},
|
||||
{176,48},{177,49},{178,50},{179,51},{180,52}, -- keypad numbers 0..4
|
||||
{181,53},{182,54},{183,55},{184,56},{185,57}, -- keypad numbers 5..9
|
||||
|
||||
-- F keys;
|
||||
{190,-190}, -- F1
|
||||
{191,-191}, -- F2
|
||||
{192,-192}, -- F3
|
||||
{193,-193}, -- F4
|
||||
{194,-194}, -- F5
|
||||
{195,-195}, -- F6
|
||||
{196,-196}, -- F7
|
||||
{197,-197}, -- F8
|
||||
{198,-198}, -- F9
|
||||
{199,-199}, -- F10
|
||||
{200,-200}, -- F11
|
||||
{201,-201}, -- F12
|
||||
{227,-227}, -- left ctl
|
||||
{228,-228}, -- right ctl
|
||||
{229,-229},
|
||||
{225,-225}, -- left shift
|
||||
{226,-226}, -- right shift
|
||||
{228,-228},
|
||||
{233,-233}, -- left alt
|
||||
{234,-234}, -- right alt
|
||||
{236,-236},
|
||||
{255,-255}, -- delete
|
||||
$}
|
||||
|
||||
constant shiftkeys = {
|
||||
{32,-9}, -- shift tab
|
||||
$}
|
||||
|
||||
----------------------------------------------------------------------
|
||||
export function key(atom event) -- get key pressed;
|
||||
----------------------------------------------------------------------
|
||||
integer k = peek(event+16)
|
||||
integer z = peek(event+17)
|
||||
integer s = state(event)
|
||||
ifdef BITS64 then
|
||||
k = peek(event+28)
|
||||
z = peek(event+29)
|
||||
end ifdef
|
||||
switch z do
|
||||
case 0 then return k
|
||||
case 255 then return vlookup(k,keyvalues,1,2,k)
|
||||
case 254 then return vlookup(k,shiftkeys,1,2,k)
|
||||
end switch
|
||||
return 0
|
||||
end function
|
||||
|
||||
---------------------------------------------------------------------
|
||||
export function id(atom event)
|
||||
---------------------------------------------------------------------
|
||||
return peek4u(event)
|
||||
end function
|
||||
|
||||
----------------------------------------------------------------------
|
||||
export function state(atom event)
|
||||
----------------------------------------------------------------------
|
||||
ifdef BITS64 then
|
||||
return peek(event+24)
|
||||
end ifdef
|
||||
return peek(event+12)
|
||||
end function
|
||||
|
||||
----------------------------------------------------------------------
|
||||
export function hwcode(atom event)
|
||||
----------------------------------------------------------------------
|
||||
ifdef BITS64 then
|
||||
return peek({event+28,2})
|
||||
end ifdef
|
||||
return peek({event+16,2})
|
||||
end function
|
||||
|
||||
---------------------------------------------------------------------
|
||||
export function button(atom event) -- get mouse button clicked;
|
||||
---------------------------------------------------------------------
|
||||
ifdef BITS64 then
|
||||
return peek(event+52)
|
||||
end ifdef
|
||||
return peek(event+40)
|
||||
end function
|
||||
|
||||
--(32/64)struct GdkEventButton
|
||||
-- 0 0 GdkEventType type
|
||||
-- 4 8 GtkWindow *window
|
||||
-- 8 16 gint8 send_event
|
||||
-- 12 20 guint32 time
|
||||
-- 16 24 gdouble x
|
||||
-- 24 32 gdouble y
|
||||
-- 32 40 gdouble *axes
|
||||
-- 36 48 guint state
|
||||
-- 40 52 guint button
|
||||
-- 44 56 GdkDevice *device
|
||||
-- 48 64 gdouble x_root, y_root
|
||||
|
||||
---------------------------------------------------------------------
|
||||
export function window(atom event) -- get event window
|
||||
---------------------------------------------------------------------
|
||||
ifdef BITS64 then
|
||||
return peek8u(event + 8)
|
||||
end ifdef
|
||||
return peek4u(event + 4)
|
||||
end function
|
||||
|
||||
---------------------------------------------------------------------
|
||||
export function time(atom event) -- get event time
|
||||
---------------------------------------------------------------------
|
||||
ifdef BITS64 then
|
||||
return peek4u(event + 20)
|
||||
end ifdef
|
||||
return peek4u(event + 12)
|
||||
end function
|
||||
|
||||
|
||||
---------------------------------------------------------------------
|
||||
export function xy(atom event) -- get mouse button x y;
|
||||
---------------------------------------------------------------------
|
||||
ifdef BITS64 then
|
||||
return {
|
||||
float64_to_atom(peek({event + 24, 8})),
|
||||
float64_to_atom(peek({event + 32, 8}))}
|
||||
end ifdef
|
||||
return {
|
||||
float64_to_atom(peek({event + 16, 8})),
|
||||
float64_to_atom(peek({event + 24, 8}))}
|
||||
end function
|
||||
|
||||
---------------------------------------------------------------------
|
||||
export function clicks(atom event)
|
||||
---------------------------------------------------------------------
|
||||
atom ct = allocate(64)
|
||||
object result
|
||||
if gtk_func("gdk_event_get_click_count",{P,I},{event,ct}) then
|
||||
result = peek4u(ct)
|
||||
else
|
||||
result = -1
|
||||
end if
|
||||
free(ct)
|
||||
return result
|
||||
end function
|
||||
|
||||
---------------------------------------------------------------------
|
||||
export function scroll_dir(atom event)
|
||||
---------------------------------------------------------------------
|
||||
atom dir = allocate(64)
|
||||
object result
|
||||
if gtk_func("gdk_event_get_scroll_direction",{P,I},{event,dir}) then
|
||||
result = peek4u(dir)
|
||||
else
|
||||
result = -1
|
||||
end if
|
||||
free(dir)
|
||||
return result
|
||||
end function
|
||||
|
||||
------------------------------------------------------------------------
|
||||
-- following routine traps the enter key when Entry is activated,
|
||||
-- and uses it like the tab key - so it works like people expect.
|
||||
-- in Glade, connect each entry's 'activate' signal to
|
||||
-- trap_enter_key
|
||||
------------------------------------------------------------------------
|
||||
constant gsig = define_proc("g_signal_emit_by_name",{P,P,P})
|
||||
constant fsig = allocate_string("move-focus")
|
||||
------------------------------------------------------------------------
|
||||
global function trap_enter_key(atom ctl, atom event)
|
||||
-----------------------------------------------------------------------
|
||||
if classid(ctl) = GtkEntry then
|
||||
if event = 0 then
|
||||
c_proc(gsig,{ctl,allocate_string("move-focus"),0})
|
||||
return 1
|
||||
end if
|
||||
end if
|
||||
return 0
|
||||
end function
|
487
tools/WEE/EuGTK/GtkPrinter.e
Normal file
487
tools/WEE/EuGTK/GtkPrinter.e
Normal file
@@ -0,0 +1,487 @@
|
||||
------------------
|
||||
namespace printer
|
||||
------------------
|
||||
constant version = "4.9.4"
|
||||
|
||||
include GtkEngine.e
|
||||
include std/datetime.e
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- This version handles most common printing needs, but it will not yet respect
|
||||
-- 'marked up' a.k.a. 'rich' text, i.e. text with colors and styles such as
|
||||
-- set by test59. It just prints them as plain text.
|
||||
-- However, it DOES print text marked up with GTK's HTML subset, so you can use
|
||||
-- <b>, <i>, <u>, <span ... etc. in your printouts!
|
||||
--------------------------------------------------------------------------------
|
||||
-- The following exported variables can be modified before calling the
|
||||
-- print routines;
|
||||
|
||||
public object header = "[1]\n"
|
||||
|
||||
public object subheader = 0
|
||||
|
||||
public object footer = "<small>\n<i>Printed by EuGTK [8] on [9]'s computer</i></small>"
|
||||
|
||||
export integer
|
||||
n_pages = 0, -- number of pages to print (0=all)
|
||||
n_copies = 1,
|
||||
collate = FALSE,
|
||||
duplex = 0,
|
||||
number_up = 1,
|
||||
number_up_layout = 1,
|
||||
units = GTK_UNIT_INCH,
|
||||
use_line_numbers = TRUE,
|
||||
use_color = TRUE, -- print eu comments in red if true
|
||||
lines_per_page = 60,
|
||||
wrap_at = 0,
|
||||
track_status = TRUE,
|
||||
show_progress = TRUE, -- enable the built-in progressbar
|
||||
embed_page_setup = FALSE,
|
||||
orientation = 0,
|
||||
order = 0,
|
||||
confirm = FALSE,
|
||||
sourcecode = TRUE,
|
||||
use_full_page = FALSE, -- ignore margins
|
||||
has_selection = FALSE,
|
||||
support_selection = FALSE,
|
||||
quality = GTK_PRINT_QUALITY_DRAFT,
|
||||
action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG
|
||||
|
||||
export atom
|
||||
scale = 100,
|
||||
top_margin = 0.25, -- in inch units
|
||||
left_margin = 0.25,
|
||||
right_margin = 0.25,
|
||||
bottom_margin = 0.25,
|
||||
parent = 0,
|
||||
|
||||
signal_status_changed = call_back(routine_id("show_status")),
|
||||
signal_begin_print = call_back(routine_id("begin_print")),
|
||||
signal_draw_page = call_back(routine_id("draw_page")),
|
||||
signal_end_print = call_back(routine_id("end_print")),
|
||||
signal_request_page_setup = 0,
|
||||
signal_done = 0,
|
||||
signal_ready = 0,
|
||||
signal_got_page_size = 0
|
||||
|
||||
export object
|
||||
name = 0,
|
||||
font = "Ubuntu Mono 8",
|
||||
jobname = 0,
|
||||
settings_file = 0,
|
||||
setup_file = 0,
|
||||
export_file = 0,
|
||||
page_ranges = 0,
|
||||
page_set = GTK_PAGE_SET_ALL,
|
||||
custom_tab_hook = 0,
|
||||
custom_tab_label = 0,
|
||||
custom_tab_func = 0
|
||||
|
||||
ifdef WINDOWS then font = "Courier New 16" end ifdef
|
||||
|
||||
export object
|
||||
line_number_format = "[:4] []\n", -- controls line # format AND code line!
|
||||
paper_name = "na_letter", -- 8.5x11.0"
|
||||
tabs = " ", -- replace tab chars with 2 spaces
|
||||
file_name = 0,
|
||||
short_name = 0,
|
||||
page_title = 0,
|
||||
sub_title = 0
|
||||
|
||||
export atom
|
||||
progress = create(GtkProgressBar),
|
||||
settings = create(GtkPrintSettings)
|
||||
|
||||
--For use in header and footer;
|
||||
-- 1 = page title (for first page)
|
||||
-- 2 = sub title (for subsequent pages - leave null to use page title (1) on all pgs)
|
||||
-- 3 = file name
|
||||
-- 4 = short name (file name w/o path)
|
||||
-- 5 = current page number
|
||||
-- 6 = n_pages printed e.g. pg 1 of n
|
||||
-- 7 = n_copies requested
|
||||
-- 8 = today's date in date_format
|
||||
-- 9 = user name
|
||||
--10 = user's real name
|
||||
--11 = font name used for this print job
|
||||
--12 = file length
|
||||
--13 = file timestamp
|
||||
--14 = exported filename
|
||||
|
||||
-- use date and time formats in std/datetime.e;
|
||||
export sequence date_format = "%A, %B %d %Y %l:%M %p"
|
||||
|
||||
sequence user
|
||||
ifdef WINDOWS then
|
||||
user = "User"
|
||||
elsedef
|
||||
user = proper(getenv("USER"))
|
||||
end ifdef
|
||||
|
||||
-- for local use;
|
||||
atom fontdesc
|
||||
integer filesize = 0
|
||||
object timestamp = 0
|
||||
sequence text
|
||||
sequence today = datetime:format(datetime:now(),date_format)
|
||||
|
||||
------------------------------------------------------------------------
|
||||
export function PrintFile(object f=0, object x=0)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
if string(f) and string(x) then
|
||||
page_title = f
|
||||
file_name = canonical_path(x)
|
||||
text = read_file(file_name)
|
||||
text = process_text(text)
|
||||
timestamp = file_timestamp(file_name)
|
||||
filesize = file_length(file_name)
|
||||
short_name = filebase(file_name)
|
||||
setup_printer()
|
||||
return 1
|
||||
end if
|
||||
|
||||
if string(f) and atom(x) and x = 0 then
|
||||
f = canonical_path(f)
|
||||
file_name = f
|
||||
timestamp = file_timestamp(f)
|
||||
filesize = file_length(f)
|
||||
short_name = filebase(f)
|
||||
page_title = filename(f)
|
||||
text = read_file(f)
|
||||
text = process_text(text)
|
||||
setup_printer()
|
||||
return 1
|
||||
end if
|
||||
|
||||
if string(f) and atom(x) and x < 100 then
|
||||
page_title = f
|
||||
short_name = f
|
||||
file_name = f
|
||||
text = read_file(x)
|
||||
text = process_text(text)
|
||||
setup_printer()
|
||||
return 1
|
||||
end if
|
||||
|
||||
if atom(f) and atom(x) and x < 101 then
|
||||
text = read_file(x)
|
||||
text = process_text(text)
|
||||
if atom(file_name) then
|
||||
file_name = ""
|
||||
end if
|
||||
if atom(short_name) then
|
||||
short_name = ""
|
||||
end if
|
||||
if atom(page_title) then
|
||||
page_title = ""
|
||||
end if
|
||||
setup_printer()
|
||||
return 1
|
||||
end if
|
||||
|
||||
if atom(f) and atom(x) then
|
||||
x = unpack(x)
|
||||
x = canonical_path(x)
|
||||
file_name = x
|
||||
short_name = filebase(x)
|
||||
page_title = filename(x)
|
||||
text = read_file(x)
|
||||
text = process_text(text)
|
||||
setup_printer()
|
||||
return 1
|
||||
end if
|
||||
|
||||
return 1
|
||||
end function
|
||||
export constant print_file = call_back(routine_id("PrintFile"))
|
||||
|
||||
------------------------------------------------------------------------
|
||||
export function PrintText(object f=0, object x=0)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
if string(f) and string(x) then
|
||||
page_title = f
|
||||
text = process_text(x)
|
||||
setup_printer()
|
||||
return 1
|
||||
end if
|
||||
|
||||
if atom(f) and string(x) then
|
||||
text = process_text(x)
|
||||
setup_printer()
|
||||
return 1
|
||||
end if
|
||||
|
||||
if atom(f) and atom(x) then
|
||||
if atom(page_title) and page_title = 0 then
|
||||
page_title = ""
|
||||
end if
|
||||
text = unpack(x)
|
||||
text = process_text(text)
|
||||
setup_printer()
|
||||
return 1
|
||||
end if
|
||||
|
||||
return 0
|
||||
end function
|
||||
export constant print_text = call_back(routine_id("PrintText"))
|
||||
|
||||
integer status_code
|
||||
sequence status_string
|
||||
|
||||
-----------------------------------------------
|
||||
export function show_status(atom op)
|
||||
-----------------------------------------------
|
||||
atom
|
||||
fn1 = define_func("gtk_print_operation_get_status",{P},I),
|
||||
fn2 = define_func("gtk_print_operation_get_status_string",{P},S)
|
||||
|
||||
status_code = c_func(fn1,{op})
|
||||
status_string = peek_string(c_func(fn2,{op}))
|
||||
|
||||
ifdef PRINT then display("Status [] []",{status_code,status_string}) end ifdef
|
||||
|
||||
if show_progress then
|
||||
set(progress,"text",status_string)
|
||||
end if
|
||||
|
||||
ifdef DELAY then sleep(0.15) end ifdef
|
||||
|
||||
return 1
|
||||
end function
|
||||
|
||||
------------------------------------------------------
|
||||
export function begin_print(atom op, atom context)
|
||||
------------------------------------------------------
|
||||
ifdef PRINT then display("Begin printing [] pages ",length(text)) end ifdef
|
||||
|
||||
fontdesc = create(PangoFontDescription,font)
|
||||
-- Some settings may have been changed by the user in the
|
||||
-- setup dialog, so we should retrieve any we are interested
|
||||
-- in at this point, before printing starts;
|
||||
-- For example, modify the lines_per_page to fit different
|
||||
-- paper sizes and orientations, scale, etc.
|
||||
-- Figuring out how to do this is beyond my skill level :p
|
||||
-- I just set the options in my program which calls the
|
||||
-- print routine.
|
||||
|
||||
set(op,"n pages",n_pages)
|
||||
-- important, as a new value for n_pages is computed
|
||||
-- based on the length of the file being read, unless a set number
|
||||
-- has been provided from the calling program.
|
||||
|
||||
if show_progress then -- turn on the progress dialog in the calling program
|
||||
show_all(progress)
|
||||
end if
|
||||
|
||||
return 1
|
||||
end function
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
export function draw_page(atom op, atom context, integer pg, atom data)
|
||||
----------------------------------------------------------------------------
|
||||
atom fn6 = define_func("gtk_print_context_get_cairo_context",{P},P)
|
||||
|
||||
atom cr = c_func(fn6,{context})
|
||||
atom pl = create(PangoCairoLayout,cr)
|
||||
set(pl,"font description",fontdesc)
|
||||
|
||||
pg += 1
|
||||
if pg > length(text) then
|
||||
set(progress,"text","Printing complete")
|
||||
return 0
|
||||
end if
|
||||
|
||||
if show_progress then
|
||||
set(progress,"text",sprintf("Printing page %d",pg))
|
||||
set(progress,"fraction",pg/n_pages)
|
||||
end if
|
||||
|
||||
ifdef DELAY then sleep(0.25) end ifdef
|
||||
|
||||
object details = {
|
||||
page_title,sub_title,file_name,short_name,
|
||||
pg,n_pages,n_copies,
|
||||
today,user,real_name,font,filesize,timestamp,export_file
|
||||
}
|
||||
|
||||
object page
|
||||
|
||||
if atom(header) then header = "<b><u>[1]</u> page [5] of [6]</b>\n\n" end if
|
||||
|
||||
if pg = 1 or atom(subheader) then
|
||||
page = text:format(header,details)
|
||||
& flatten(text[pg])
|
||||
& text:format(footer,details)
|
||||
else
|
||||
page = text:format(subheader,details)
|
||||
& flatten(text[pg])
|
||||
& text:format(footer,details)
|
||||
end if
|
||||
|
||||
set(pl,"markup",page,length(page))
|
||||
set(pl,"update layout",cr)
|
||||
set(pl,"show layout",cr)
|
||||
|
||||
ifdef PRINT then printf(1,"Page %d\n",pg) end ifdef
|
||||
|
||||
return 1
|
||||
end function
|
||||
|
||||
------------------------------------------------------------------------
|
||||
function process_text(object txt)
|
||||
------------------------------------------------------------------------
|
||||
txt = split(txt,'\n')
|
||||
integer comment
|
||||
object a,b
|
||||
object test
|
||||
|
||||
|
||||
for i = 1 to length(txt) do -- replace chars which will confuse markup
|
||||
|
||||
txt[i] = join(split(txt[i],'&'),"&")
|
||||
txt[i] = join(split(txt[i],"&amp;"),"&")
|
||||
|
||||
if sourcecode then
|
||||
txt[i] = join(split(txt[i],'<'),"<")
|
||||
txt[i] = join(split(txt[i],'>'),">")
|
||||
end if
|
||||
|
||||
if use_color then
|
||||
comment = match("--",txt[i])
|
||||
if comment then
|
||||
comment -=1
|
||||
txt[i] = txt[i][1..comment] & "<span color='red'>" & txt[i][comment+1..$] & "</span>"
|
||||
end if
|
||||
end if
|
||||
|
||||
if use_line_numbers then
|
||||
txt[i] = text:format(line_number_format,{i,txt[i]})
|
||||
else
|
||||
txt[i] &= '\n'
|
||||
end if
|
||||
|
||||
end for
|
||||
|
||||
txt = breakup(txt,lines_per_page)
|
||||
if n_pages = 0 then -- no selection
|
||||
n_pages = length(txt)
|
||||
end if
|
||||
|
||||
return txt
|
||||
end function
|
||||
|
||||
------------------------------------------------------------------------
|
||||
export function end_print()
|
||||
------------------------------------------------------------------------
|
||||
status_string = "Printing complete"
|
||||
ifdef PRINT then display(status_string) end ifdef
|
||||
return 1
|
||||
end function
|
||||
|
||||
---------------------------------------------------------------
|
||||
export function setup_printer()
|
||||
---------------------------------------------------------------
|
||||
atom _size = create(GtkPaperSize,paper_name)
|
||||
atom err = allocate(16) err = 0
|
||||
object results = 0
|
||||
|
||||
atom fn7 = define_func("gtk_print_operation_run",{P,I,P,P},I)
|
||||
atom fn8 = define_func("gtk_print_run_page_setup_dialog",{P,P,P},P)
|
||||
|
||||
set(settings,"paper size",_size,units)
|
||||
set(settings,"n copies",n_copies)
|
||||
set(settings,"collate",collate)
|
||||
set(settings,"duplex",duplex)
|
||||
set(settings,"reverse",order)
|
||||
set(settings,"scale",scale)
|
||||
set(settings,"quality",quality)
|
||||
set(settings,"number up",number_up)
|
||||
set(settings,"number up layout",number_up_layout)
|
||||
|
||||
if string(name) then
|
||||
set(settings,"printer",name)
|
||||
end if
|
||||
|
||||
atom setup = create(GtkPageSetup)
|
||||
set(setup,"paper size",_size)
|
||||
set(setup,"orientation",orientation)
|
||||
set(setup,"left margin",left_margin,units)
|
||||
set(setup,"right margin",right_margin,units)
|
||||
set(setup,"top margin",top_margin,units)
|
||||
set(setup,"bottom margin",bottom_margin,units)
|
||||
|
||||
atom printop = create(GtkPrintOperation)
|
||||
set(printop,"print settings",settings)
|
||||
set(printop,"default page setup",setup)
|
||||
set(printop,"show progress",show_progress)
|
||||
set(printop,"track print status",track_status)
|
||||
set(printop,"embed page setup",embed_page_setup)
|
||||
set(printop,"support selection",support_selection)
|
||||
set(printop,"has selection",has_selection)
|
||||
set(printop,"use full page",use_full_page)
|
||||
|
||||
if action = GTK_PRINT_OPERATION_ACTION_EXPORT then
|
||||
export_file = canonical_path(export_file)
|
||||
set(printop,"export filename",export_file)
|
||||
end if
|
||||
|
||||
if string(jobname) then
|
||||
set(printop,"job name",jobname)
|
||||
end if
|
||||
|
||||
if custom_tab_hook != 0 then
|
||||
set(printop,"custom tab label",custom_tab_label)
|
||||
connect(printop,"create-custom-widget",custom_tab_func,printop)
|
||||
connect(printop,"custom-widget-apply",custom_tab_hook)
|
||||
end if
|
||||
|
||||
connect(printop,"status-changed",signal_status_changed)
|
||||
connect(printop,"begin-print",signal_begin_print)
|
||||
connect(printop,"draw-page",signal_draw_page)
|
||||
connect(printop,"end-print",signal_end_print)
|
||||
connect(printop,"request-page-setup",signal_request_page_setup)
|
||||
connect(printop,"done",signal_done)
|
||||
connect(printop,"ready",signal_ready)
|
||||
connect(printop,"got-page-size",signal_got_page_size)
|
||||
|
||||
c_func(fn7,{printop,action,parent,err}) -- start the print process;
|
||||
|
||||
if string(settings_file) then
|
||||
get(settings,"to file",settings_file)
|
||||
end if
|
||||
if string(setup_file) then
|
||||
get(setup,"to file",setup_file)
|
||||
end if
|
||||
|
||||
object jobname = get(printop,"job name")
|
||||
if confirm then
|
||||
if action = GTK_PRINT_OPERATION_ACTION_EXPORT then
|
||||
if Question(0,"PDF Written",
|
||||
sprintf("%s\n<small>Folder: %s</small>",
|
||||
{filename(export_file),pathname(export_file)}),
|
||||
sprintf("%s\nStatus: %d\n%s\nClick Yes to view",{jobname,status_code,status_string})
|
||||
,,,"cups") then
|
||||
show_uri(export_file)
|
||||
end if
|
||||
else
|
||||
Info(0,"Print Job",jobname,
|
||||
sprintf("Status: %d %s",{status_code,status_string})
|
||||
,,"cups")
|
||||
end if
|
||||
end if
|
||||
|
||||
page_title = 0
|
||||
n_pages = 0
|
||||
n_copies = 1
|
||||
action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG
|
||||
|
||||
return 1
|
||||
end function
|
||||
|
||||
header = "<b><u>[1]</u></b>\n\n"
|
||||
|
||||
-------------------------
|
||||
-- © 2015 by Irv Mullins
|
||||
-------------------------
|
4
tools/WEE/EuGTK/README.txt
Normal file
4
tools/WEE/EuGTK/README.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
GTK Library for Euphoria 4.0
|
||||
by Irv Mullins
|
||||
|
||||
https://sites.google.com/site/euphoriagtk/Home
|
17
tools/WEE/EuGTK/license.txt
Normal file
17
tools/WEE/EuGTK/license.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
LGPL ~ GNU Lesser General Public License version 3.0
|
||||
|
||||
This library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU Lesser General
|
||||
Public License as published by the Free Software Foundation;
|
||||
either version 2 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Pl, Suite 330, Boston, MA 02111-1307 USA
|
22
tools/WEE/LICENSE
Normal file
22
tools/WEE/LICENSE
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 peberlein
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
21
tools/WEE/README.md
Normal file
21
tools/WEE/README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# WEE
|
||||
A small code-aware editor for Euphoria programming
|
||||
|
||||
### Featuring
|
||||
* [Scintilla](http://www.scintilla.org/) editor control with syntax highlighting
|
||||
* subroutines list
|
||||
* automatic if/while/for/procedure/function expansion
|
||||
* code identifier completion
|
||||
* jump to subroutine declaration
|
||||
* ex.err monitoring
|
||||
* show subroutine arguments
|
||||
|
||||
Supports Windows
|
||||
|
||||
Supports Linux and Mac OS using [EuGTK](https://sites.google.com/site/euphoriagtk/Home)
|
||||
|
||||
Requires [Euphoria 4.1.0 Beta 2](http://openeuphoria.org/wiki/view/DownloadEuphoria.wc) or later.
|
||||
|
||||
### How to Get It
|
||||
|
||||
Create a folder called "Wee" and download [updater.ex](https://github.com/peberlein/WEE/raw/master/updater.ex). Run "eui updater.ex" to download/update the files for your platform. Run "eui wee" to run the editor, or compile/bind/shroud it for convenience.
|
66
tools/WEE/manifest.ex
Normal file
66
tools/WEE/manifest.ex
Normal file
@@ -0,0 +1,66 @@
|
||||
include std/pretty.e
|
||||
include std/io.e
|
||||
include std/hash.e
|
||||
include std/os.e
|
||||
include std/pipeio.e
|
||||
|
||||
|
||||
sequence files
|
||||
files = {
|
||||
-- platform independent
|
||||
{"wee.exw", 0, 0, 0},
|
||||
{"scintilla.e", 0, 0, 0},
|
||||
{"parser.e", 0, 0, 0},
|
||||
{"updater.ex", 0, 0, 0},
|
||||
{"weeicon.e", 0, 0, 0},
|
||||
-- windows
|
||||
{"ui_win.e", 0, 0, 0, WINDOWS},
|
||||
{"window.ew", 0, 0, 0, WINDOWS},
|
||||
-- GTK
|
||||
{"ui_gtk.e", 0, 0, 0, LINUX, OSX},
|
||||
{"EuGTK/GtkEngine.e", 0, 0, 0, LINUX, OSX},
|
||||
{"EuGTK/GtkEnums.e", 0, 0, 0, LINUX, OSX},
|
||||
{"EuGTK/GtkPrinter.e", 0, 0, 0, LINUX, OSX},
|
||||
{"EuGTK/GtkEvents.e", 0, 0, 0, LINUX, OSX},
|
||||
{"EuGTK/README.txt", 0, 0, 0, LINUX, OSX},
|
||||
{"EuGTK/license.txt", 0, 0, 0, LINUX, OSX},
|
||||
-- scintilla
|
||||
{"scintilla/SciLexer.dll", 0, 0, 32, WINDOWS},
|
||||
{"scintilla/SciLexer64.dll", 0, 0, 64, WINDOWS},
|
||||
{"scintilla/scintilla32.so", 0, 0, 32, LINUX},
|
||||
{"scintilla/scintilla64.so", 0, 0, 64, LINUX},
|
||||
{"scintilla/scintillaOSX.dylib", 0, 0, 64, OSX},
|
||||
{"scintilla/scintilla32armhf.so", 0, 0, 32, LINUX},
|
||||
{"scintilla/License.txt", 0, 0, 0}
|
||||
}
|
||||
|
||||
object file, p
|
||||
|
||||
-- returns
|
||||
function read_until_eof(object pipe)
|
||||
sequence result = {}
|
||||
object o = pipeio:read(pipe, 1024)
|
||||
while sequence(o) and length(o) do
|
||||
result &= o
|
||||
o = pipeio:read(pipe, 1024)
|
||||
end while
|
||||
return result
|
||||
end function
|
||||
|
||||
for i = 1 to length(files) do
|
||||
files[i][2] = hash(read_file(files[i][1]), HSIEH30)
|
||||
-- git log -n 1 --format=oneline -- ui_gtk.e
|
||||
p = pipeio:exec("git log -n1 --format=oneline -- "&files[i][1], pipeio:create())
|
||||
files[i][3] = pipeio:read(p[pipeio:STDOUT], 10)
|
||||
pipeio:kill(p)
|
||||
|
||||
p = pipeio:exec("git show "&files[i][3]&":"&files[i][1], pipeio:create())
|
||||
object h = hash(read_until_eof(p[pipeio:STDOUT]), HSIEH30)
|
||||
pipeio:kill(p)
|
||||
|
||||
printf(1, "%s %s %d %d\n", {files[i][1], files[i][3], files[i][2], h})
|
||||
files[i][2] = h
|
||||
end for
|
||||
|
||||
--display(files)
|
||||
? write_file("manifest.json", pretty_sprint(files, {2}))
|
150
tools/WEE/manifest.json
Normal file
150
tools/WEE/manifest.json
Normal file
@@ -0,0 +1,150 @@
|
||||
{
|
||||
{
|
||||
"wee.exw",
|
||||
334537086,
|
||||
"0dcf6d4cb0",
|
||||
0
|
||||
},
|
||||
{
|
||||
"scintilla.e",
|
||||
13846666,
|
||||
"e3cc5860ac",
|
||||
0
|
||||
},
|
||||
{
|
||||
"parser.e",
|
||||
215958451,
|
||||
"87365ad72b",
|
||||
0
|
||||
},
|
||||
{
|
||||
"updater.ex",
|
||||
273638869,
|
||||
"befd7e9c4a",
|
||||
0
|
||||
},
|
||||
{
|
||||
"weeicon.e",
|
||||
39797371,
|
||||
"fdc3db69d4",
|
||||
0
|
||||
},
|
||||
{
|
||||
"ui_win.e",
|
||||
740860035,
|
||||
"839c798be8",
|
||||
0,
|
||||
2
|
||||
},
|
||||
{
|
||||
"window.ew",
|
||||
904400105,
|
||||
"87365ad72b",
|
||||
0,
|
||||
2
|
||||
},
|
||||
{
|
||||
"ui_gtk.e",
|
||||
59538677,
|
||||
"839c798be8",
|
||||
0,
|
||||
3,
|
||||
4
|
||||
},
|
||||
{
|
||||
"EuGTK/GtkEngine.e",
|
||||
132693288,
|
||||
"4df40ce0cd",
|
||||
0,
|
||||
3,
|
||||
4
|
||||
},
|
||||
{
|
||||
"EuGTK/GtkEnums.e",
|
||||
202551058,
|
||||
"506cdc498b",
|
||||
0,
|
||||
3,
|
||||
4
|
||||
},
|
||||
{
|
||||
"EuGTK/GtkPrinter.e",
|
||||
443615540,
|
||||
"506cdc498b",
|
||||
0,
|
||||
3,
|
||||
4
|
||||
},
|
||||
{
|
||||
"EuGTK/GtkEvents.e",
|
||||
1050187785,
|
||||
"506cdc498b",
|
||||
0,
|
||||
3,
|
||||
4
|
||||
},
|
||||
{
|
||||
"EuGTK/README.txt",
|
||||
332011652,
|
||||
"04aa6ff6c9",
|
||||
0,
|
||||
3,
|
||||
4
|
||||
},
|
||||
{
|
||||
"EuGTK/license.txt",
|
||||
70721840,
|
||||
"506cdc498b",
|
||||
0,
|
||||
3,
|
||||
4
|
||||
},
|
||||
{
|
||||
"scintilla/SciLexer.dll",
|
||||
376057439,
|
||||
"b6035dbac0",
|
||||
32,
|
||||
2
|
||||
},
|
||||
{
|
||||
"scintilla/SciLexer64.dll",
|
||||
971949613,
|
||||
"683bd7ddbf",
|
||||
64,
|
||||
2
|
||||
},
|
||||
{
|
||||
"scintilla/scintilla32.so",
|
||||
794231462,
|
||||
"b6035dbac0",
|
||||
32,
|
||||
3
|
||||
},
|
||||
{
|
||||
"scintilla/scintilla64.so",
|
||||
778289070,
|
||||
"b6035dbac0",
|
||||
64,
|
||||
3
|
||||
},
|
||||
{
|
||||
"scintilla/scintillaOSX.dylib",
|
||||
510448282,
|
||||
"b6035dbac0",
|
||||
64,
|
||||
4
|
||||
},
|
||||
{
|
||||
"scintilla/scintilla32armhf.so",
|
||||
572289041,
|
||||
"e3cc5860ac",
|
||||
32,
|
||||
3
|
||||
},
|
||||
{
|
||||
"scintilla/License.txt",
|
||||
662502963,
|
||||
"b6035dbac0",
|
||||
0
|
||||
}
|
||||
}
|
BIN
tools/WEE/mongoose-wee.ico
Normal file
BIN
tools/WEE/mongoose-wee.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
2959
tools/WEE/parser.e
Normal file
2959
tools/WEE/parser.e
Normal file
File diff suppressed because it is too large
Load Diff
2802
tools/WEE/scintilla.e
Normal file
2802
tools/WEE/scintilla.e
Normal file
File diff suppressed because it is too large
Load Diff
20
tools/WEE/scintilla/License.txt
Normal file
20
tools/WEE/scintilla/License.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
License for Scintilla and SciTE
|
||||
|
||||
Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation.
|
||||
|
||||
NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY
|
||||
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
|
||||
OR PERFORMANCE OF THIS SOFTWARE.
|
BIN
tools/WEE/scintilla/SciLexer.dll
Normal file
BIN
tools/WEE/scintilla/SciLexer.dll
Normal file
Binary file not shown.
BIN
tools/WEE/scintilla/SciLexer64.dll
Normal file
BIN
tools/WEE/scintilla/SciLexer64.dll
Normal file
Binary file not shown.
110
tools/WEE/scintilla/gtk_makefile
Normal file
110
tools/WEE/scintilla/gtk_makefile
Normal file
@@ -0,0 +1,110 @@
|
||||
# Make file for Scintilla on Linux or compatible OS
|
||||
# Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
|
||||
# The License.txt file describes the conditions under which this software may be distributed.
|
||||
# This makefile assumes GCC 4.3 is used and changes will be needed to use other compilers.
|
||||
# GNU make does not like \r\n line endings so should be saved to CVS in binary form.
|
||||
# Builds for GTK+ 2 and no longer supports GTK+ 1.
|
||||
# Also works with ming32-make on Windows.
|
||||
|
||||
.SUFFIXES: .cxx .c .o .h .a
|
||||
ifdef CLANG
|
||||
CXX = clang++ -Wno-deprecated-register
|
||||
CC = clang
|
||||
# Can choose aspect to sanitize: address and undefined can simply change SANITIZE but for
|
||||
# thread also need to create Position Independent Executable -> search online documentation
|
||||
SANITIZE = address
|
||||
#SANITIZE = undefined
|
||||
endif
|
||||
RANLIB = touch
|
||||
|
||||
ifdef GTK3
|
||||
GTKVERSION=gtk+-3.0
|
||||
else
|
||||
GTKVERSION=gtk+-2.0
|
||||
endif
|
||||
|
||||
# Environment variable windir always defined on Win32
|
||||
|
||||
ifndef windir
|
||||
ifeq ($(shell uname),Darwin)
|
||||
RANLIB = ranlib
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef windir
|
||||
DEL = del /q
|
||||
COMPLIB=..\bin\scintilla.a
|
||||
else
|
||||
DEL = rm -f
|
||||
COMPLIB=../bin/scintilla.a
|
||||
SOLIB=../bin/scintilla.so
|
||||
endif
|
||||
|
||||
vpath %.h ../src ../include ../lexlib
|
||||
vpath %.cxx ../src ../lexlib ../lexers
|
||||
|
||||
INCLUDEDIRS=-I ../include -I ../src -I ../lexlib
|
||||
ifdef CHECK_DEPRECATED
|
||||
DEPRECATED=-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DDISABLE_GDK_FONT
|
||||
endif
|
||||
CXXBASEFLAGS=-Wall -pedantic -DGTK -DSCI_LEXER $(INCLUDEDIRS) $(DEPRECATED) -fPIC
|
||||
|
||||
ifdef NOTHREADS
|
||||
THREADFLAGS=-DG_THREADS_IMPL_NONE
|
||||
else
|
||||
THREADFLAGS=
|
||||
endif
|
||||
|
||||
ifdef CXX11_REGEX
|
||||
REFLAGS=-DCXX11_REGEX
|
||||
endif
|
||||
|
||||
ifdef DEBUG
|
||||
ifdef CLANG
|
||||
CTFLAGS=-DDEBUG -g -fsanitize=$(SANITIZE) $(CXXBASEFLAGS) $(THREADFLAGS)
|
||||
else
|
||||
CTFLAGS=-DDEBUG -g $(CXXBASEFLAGS) $(THREADFLAGS)
|
||||
endif
|
||||
else
|
||||
CTFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS:=$(CTFLAGS)
|
||||
CXXTFLAGS:=--std=c++0x $(CTFLAGS) $(REFLAGS)
|
||||
|
||||
CONFIGFLAGS:=$(shell pkg-config --cflags $(GTKVERSION))
|
||||
MARSHALLER=scintilla-marshal.o
|
||||
|
||||
.cxx.o:
|
||||
$(CXX) $(CONFIGFLAGS) $(CXXTFLAGS) $(CXXFLAGS) -c $<
|
||||
.c.o:
|
||||
$(CC) $(CONFIGFLAGS) $(CFLAGS) -w -c $<
|
||||
|
||||
LEXOBJS:=$(addsuffix .o,$(basename $(notdir $(wildcard ../lexers/Lex*.cxx))))
|
||||
|
||||
all: $(COMPLIB) $(SOLIB)
|
||||
|
||||
clean:
|
||||
$(DEL) *.o $(COMPLIB) *.plist
|
||||
|
||||
analyze:
|
||||
clang --analyze $(CONFIGFLAGS) $(CXXTFLAGS) $(CXXFLAGS) *.cxx ../src/*.cxx ../lexlib/*.cxx ../lexers/*.cxx
|
||||
|
||||
deps:
|
||||
$(CXX) -MM $(CONFIGFLAGS) $(CXXTFLAGS) *.cxx ../src/*.cxx ../lexlib/*.cxx ../lexers/*.cxx | sed -e 's/\/usr.* //' | grep [a-zA-Z] >deps.mak
|
||||
|
||||
COMPLIBS=Accessor.o CharacterSet.o LexerBase.o LexerModule.o LexerSimple.o StyleContext.o WordList.o \
|
||||
CharClassify.o Decoration.o Document.o PerLine.o Catalogue.o CallTip.o CaseConvert.o CaseFolder.o \
|
||||
ScintillaBase.o ContractionState.o EditModel.o Editor.o EditView.o ExternalLexer.o MarginView.o \
|
||||
PropSetSimple.o PlatGTK.o \
|
||||
KeyMap.o LineMarker.o PositionCache.o ScintillaGTK.o CellBuffer.o CharacterCategory.o ViewStyle.o \
|
||||
RESearch.o RunStyles.o Selection.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \
|
||||
$(MARSHALLER) $(LEXOBJS)
|
||||
$(COMPLIB): $(COMPLIBS)
|
||||
$(AR) rc $@ $^
|
||||
$(RANLIB) $@
|
||||
$(SOLIB): $(COMPLIBS)
|
||||
$(CC) $(CFLAGS) -shared -o $@ $^ -lm -lstdc++ `pkg-config --libs $(GTKVERSION) gthread-2.0 gmodule-2.0`
|
||||
|
||||
# Automatically generate header dependencies with "make deps"
|
||||
include deps.mak
|
BIN
tools/WEE/scintilla/scintilla32.so
Executable file
BIN
tools/WEE/scintilla/scintilla32.so
Executable file
Binary file not shown.
BIN
tools/WEE/scintilla/scintilla32armhf.so
Executable file
BIN
tools/WEE/scintilla/scintilla32armhf.so
Executable file
Binary file not shown.
BIN
tools/WEE/scintilla/scintilla64.so
Executable file
BIN
tools/WEE/scintilla/scintilla64.so
Executable file
Binary file not shown.
BIN
tools/WEE/scintilla/scintillaOSX.dylib
Executable file
BIN
tools/WEE/scintilla/scintillaOSX.dylib
Executable file
Binary file not shown.
1504
tools/WEE/ui_gtk.e
Normal file
1504
tools/WEE/ui_gtk.e
Normal file
File diff suppressed because it is too large
Load Diff
1866
tools/WEE/ui_win.e
Normal file
1866
tools/WEE/ui_win.e
Normal file
File diff suppressed because it is too large
Load Diff
106
tools/WEE/updater.ex
Normal file
106
tools/WEE/updater.ex
Normal file
@@ -0,0 +1,106 @@
|
||||
-- WEE source code updater
|
||||
|
||||
include std/console.e
|
||||
include std/net/http.e
|
||||
include std/io.e
|
||||
include std/get.e
|
||||
include std/filesys.e
|
||||
include std/hash.e
|
||||
|
||||
puts(1, "=== WEE Source Code Updater ===\n"&
|
||||
"This will overwrite any local changes to the source files.\n"&
|
||||
"Press a key to continue, or 'q' to quit.\n")
|
||||
if wait_key() = 'q' then
|
||||
abort(0)
|
||||
end if
|
||||
|
||||
constant
|
||||
repo = "peberlein/WEE/",
|
||||
base_url = "http://cdn.rawgit.com/" & repo -- & "commit/filename"
|
||||
|
||||
-- this needs to be .json since rawgit.com has a whitelist of extensions
|
||||
-- otherwise it will just redirect to https://raw.githubusercontent.com
|
||||
-- and http_get doesn't support https: protocol
|
||||
constant
|
||||
manifest = http_get("http://rawgit.com/"& repo &"master/manifest.json")
|
||||
|
||||
procedure fail(sequence fmt, object args={})
|
||||
printf(1, fmt, args)
|
||||
puts(1, "\nPress any key to exit, then try updating again.\n")
|
||||
wait_key()
|
||||
abort(1)
|
||||
end procedure
|
||||
|
||||
if atom(manifest) or not equal(manifest[1][1][2], "200") then
|
||||
display(manifest)
|
||||
fail("Failed to download manifest.json\n")
|
||||
end if
|
||||
|
||||
-- manifest format
|
||||
-- {
|
||||
-- {"pathname", hash, "commit-tag", platform-bits, platforms...}
|
||||
-- }
|
||||
|
||||
sequence files, name, commit_tag
|
||||
files = value(manifest[2])
|
||||
--display(files)
|
||||
if files[1] != 0 then
|
||||
fail("Failed to parse manifest\n")
|
||||
end if
|
||||
files = files[2]
|
||||
|
||||
ifdef BITS64 then
|
||||
constant PLATFORM_BITS = 64
|
||||
elsedef
|
||||
constant PLATFORM_BITS = 32
|
||||
end ifdef
|
||||
|
||||
integer platform_bits
|
||||
sequence platforms, subdir
|
||||
|
||||
object result, hashcode
|
||||
|
||||
for i = 1 to length(files) do
|
||||
if length(files[i]) < 4 then
|
||||
fail("Manifest file has invalid format.\n")
|
||||
end if
|
||||
|
||||
name = files[i][1]
|
||||
hashcode = files[i][2]
|
||||
commit_tag = files[i][3]
|
||||
platform_bits = files[i][4]
|
||||
platforms = files[i][5..$]
|
||||
|
||||
if length(platforms) and not find(platform(), platforms) then
|
||||
-- file not used on this platform
|
||||
|
||||
elsif platform_bits != 0 and platform_bits != PLATFORM_BITS then
|
||||
-- file not compatible with 32/64-bit platform
|
||||
|
||||
elsif equal(hashcode, hash(read_file(name), HSIEH30)) then
|
||||
-- file hash is ok
|
||||
printf(1, "%s is up-to-date.\n", {name})
|
||||
|
||||
else
|
||||
printf(1, "Updating %s...\n", {name})
|
||||
result = http_get(base_url & commit_tag & "/" & name)
|
||||
if atom(result) or not equal(result[1][1][2], "200") then
|
||||
display(result)
|
||||
fail("Failed to download %s\n", {name})
|
||||
elsif not equal(hashcode, hash(result[2], HSIEH30)) then
|
||||
fail("Failed to validate %s\n", {name})
|
||||
else
|
||||
subdir = dirname(name)
|
||||
if length(subdir) and atom(dir(subdir)) then
|
||||
printf(1, "Creating directory %s\n", {subdir})
|
||||
create_directory(subdir)
|
||||
end if
|
||||
if write_file(name, result[2]) = -1 then
|
||||
printf(1, "Failed to write_file %s\n", {name})
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end for
|
||||
|
||||
puts(1, "Done. Press any key to exit.\n")
|
||||
wait_key()
|
BIN
tools/WEE/wee
Executable file
BIN
tools/WEE/wee
Executable file
Binary file not shown.
2879
tools/WEE/wee.exw
Normal file
2879
tools/WEE/wee.exw
Normal file
File diff suppressed because it is too large
Load Diff
BIN
tools/WEE/wee.ico
Normal file
BIN
tools/WEE/wee.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
507
tools/WEE/weeicon.e
Normal file
507
tools/WEE/weeicon.e
Normal file
@@ -0,0 +1,507 @@
|
||||
-- wee icons in XPM format
|
||||
|
||||
export constant wee_xpm = {
|
||||
"32 32 60 1",
|
||||
" c None",
|
||||
". c #FF6600",
|
||||
"+ c #FFFFFF",
|
||||
"@ c #FED8BF",
|
||||
"# c #FED3B6",
|
||||
"$ c #FEEADD",
|
||||
"% c #FED3B7",
|
||||
"& c #FE6601",
|
||||
"* c #FEA56B",
|
||||
"= c #FEE5D5",
|
||||
"- c #FEF9F6",
|
||||
"; c #FEEADE",
|
||||
"> c #FEA76D",
|
||||
", c #FE8738",
|
||||
"' c #FEE9DC",
|
||||
") c #FE6C0C",
|
||||
"! c #FEFAF8",
|
||||
"~ c #FE7A23",
|
||||
"{ c #FE6B0A",
|
||||
"] c #FEF5F0",
|
||||
"^ c #FE7114",
|
||||
"/ c #FEA469",
|
||||
"( c #FE6B09",
|
||||
"_ c #FE9651",
|
||||
": c #FEE7D8",
|
||||
"< c #FE8230",
|
||||
"[ c #FE9854",
|
||||
"} c #FEA468",
|
||||
"| c #FE9B5A",
|
||||
"1 c #FED7BD",
|
||||
"2 c #FEE6D6",
|
||||
"3 c #FED9C0",
|
||||
"4 c #FEAE7A",
|
||||
"5 c #FEB584",
|
||||
"6 c #FEC7A3",
|
||||
"7 c #FECFB0",
|
||||
"8 c #FECEAE",
|
||||
"9 c #FED1B3",
|
||||
"0 c #FEA56A",
|
||||
"a c #FEF8F5",
|
||||
"b c #FEF2EB",
|
||||
"c c #FE771D",
|
||||
"d c #FEFDFD",
|
||||
"e c #FEE8DA",
|
||||
"f c #FEF3EC",
|
||||
"g c #FE7820",
|
||||
"h c #FEF6F1",
|
||||
"i c #FEF9F7",
|
||||
"j c #FE7419",
|
||||
"k c #FE6D0D",
|
||||
"l c #FEDEC9",
|
||||
"m c #FECBA9",
|
||||
"n c #FEDAC3",
|
||||
"o c #FEA870",
|
||||
"p c #FEB787",
|
||||
"q c #FEDAC2",
|
||||
"r c #FE9E5E",
|
||||
"s c #FEE4D4",
|
||||
"t c #FEF2EA",
|
||||
"u c #FE7418",
|
||||
" ......... ",
|
||||
" .............. ",
|
||||
" .................. ",
|
||||
" .................... ",
|
||||
" ...................... ",
|
||||
" ........................ ",
|
||||
" .......................... ",
|
||||
" ............................ ",
|
||||
" ............................ ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
"............................... ",
|
||||
"................................",
|
||||
"...+++@.#$.%++&*=-;>..&*=-;>....",
|
||||
"...,+'.)!+~{]^>+/(>+_.>+/(>+_...",
|
||||
"....:+<[++}|1.2+(.{+3.2+(.{+3...",
|
||||
"....4+567+890.a+++++b.a+++++b...",
|
||||
"....cdefghhij.2+k.....2+k.......",
|
||||
".....1+l.m+n..o+pk)>q.o+pk)>q...",
|
||||
".....r+4.|+o..&>s-tmu.&>s-tmu...",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" ............................ ",
|
||||
" ............................ ",
|
||||
" .......................... ",
|
||||
" ........................ ",
|
||||
" ...................... ",
|
||||
" .................... ",
|
||||
" .................. ",
|
||||
" .............. ",
|
||||
" ........ "}
|
||||
|
||||
export constant
|
||||
a_xpm = `/* XPM */
|
||||
"16 16 28 1",
|
||||
" c None",
|
||||
". c #3300CC",
|
||||
"+ c #FFFFFF",
|
||||
"@ c #FBFBFD",
|
||||
"# c #E6E1F8",
|
||||
"$ c #AD99EA",
|
||||
"% c #4011CE",
|
||||
"& c #7553DB",
|
||||
"* c #3807CC",
|
||||
"= c #8061DE",
|
||||
"- c #B3A1EB",
|
||||
"; c #3503CC",
|
||||
"> c #EBE7F9",
|
||||
", c #4A1DD1",
|
||||
"' c #B9A8ED",
|
||||
") c #FDFDFD",
|
||||
"! c #CBBEF1",
|
||||
"~ c #947AE3",
|
||||
"{ c #3A0ACD",
|
||||
"] c #F6F4FC",
|
||||
"^ c #3A09CD",
|
||||
"/ c #DAD2F5",
|
||||
"( c #7958DD",
|
||||
"_ c #3908CC",
|
||||
": c #8E72E2",
|
||||
"< c #5F38D6",
|
||||
"[ c #DAD1F5",
|
||||
"} c #8162DF",
|
||||
" ...... ",
|
||||
" .......... ",
|
||||
" ............ ",
|
||||
" .............. ",
|
||||
" ....++@#$%.... ",
|
||||
".....+&*=+-.....",
|
||||
"........;+>.....",
|
||||
"....,'>)+++.....",
|
||||
"....!+~{.++.....",
|
||||
"....]+^.;++.....",
|
||||
"..../+(_:++.....",
|
||||
" ...<[]/}+++... ",
|
||||
" .............. ",
|
||||
" ............ ",
|
||||
" .......... ",
|
||||
" ...... "};`,
|
||||
c_xpm = `/* XPM */
|
||||
static char * c_xpm[] = {
|
||||
"16 16 33 1",
|
||||
" c None",
|
||||
". c #3399CC",
|
||||
"+ c #6EB6DA",
|
||||
"@ c #D1E7F3",
|
||||
"# c #F7FAFC",
|
||||
"$ c #F2F8FB",
|
||||
"% c #C3E0EF",
|
||||
"& c #6AB4D9",
|
||||
"* c #FDFDFD",
|
||||
"= c #BFDFEE",
|
||||
"- c #46A2D0",
|
||||
"; c #42A0CF",
|
||||
"> c #BBDDED",
|
||||
", c #FFFFFF",
|
||||
"' c #D0E7F2",
|
||||
") c #55A9D3",
|
||||
"! c #4AA4D1",
|
||||
"~ c #F6FAFC",
|
||||
"{ c #3A9CCD",
|
||||
"] c #D2E8F3",
|
||||
"^ c #56AAD4",
|
||||
"/ c #4BA4D1",
|
||||
"( c #E1EFF6",
|
||||
"_ c #72B8DB",
|
||||
": c #C1DFEF",
|
||||
"< c #43A0CF",
|
||||
"[ c #93C8E3",
|
||||
"} c #73B8DB",
|
||||
"| c #D4E9F3",
|
||||
"1 c #F8FBFC",
|
||||
"2 c #EBF4F9",
|
||||
"3 c #A4D1E8",
|
||||
"4 c #3599CC",
|
||||
" ...... ",
|
||||
" .......... ",
|
||||
" ............ ",
|
||||
" .............. ",
|
||||
" ....+@#$%&.... ",
|
||||
"....+*=-;>,.....",
|
||||
"....',)..!,.....",
|
||||
"....~,{.........",
|
||||
"....~,{.........",
|
||||
"....],^../(.....",
|
||||
"...._,:-<=[.....",
|
||||
" ....}|1234.... ",
|
||||
" .............. ",
|
||||
" ............ ",
|
||||
" .......... ",
|
||||
" ...... "};`,
|
||||
e_xpm = `/* XPM */
|
||||
static char * e_xpm[] = {
|
||||
"16 16 37 1",
|
||||
" c None",
|
||||
". c #CC0099",
|
||||
"+ c #D844B3",
|
||||
"@ c #F1C0E5",
|
||||
"# c #FBF3F9",
|
||||
"$ c #FCF6FA",
|
||||
"% c #F3C8E8",
|
||||
"& c #DA4EB7",
|
||||
"* c #D945B4",
|
||||
"= c #FDFCFD",
|
||||
"- c #E684CD",
|
||||
"; c #CE0E9E",
|
||||
"> c #CE0F9E",
|
||||
", c #E688CF",
|
||||
"' c #FDFDFD",
|
||||
") c #D73BB0",
|
||||
"! c #F2C3E6",
|
||||
"~ c #FFFFFF",
|
||||
"{ c #CD0C9D",
|
||||
"] c #F0B8E2",
|
||||
"^ c #FCF5FA",
|
||||
"/ c #F9E9F5",
|
||||
"( c #CD0B9C",
|
||||
"_ c #F2C5E7",
|
||||
": c #D637AE",
|
||||
"< c #D42DAA",
|
||||
"[ c #F5D2EC",
|
||||
"} c #DA4AB6",
|
||||
"| c #F3C7E8",
|
||||
"1 c #D32BA9",
|
||||
"2 c #CC089B",
|
||||
"3 c #D534AD",
|
||||
"4 c #F4D0EB",
|
||||
"5 c #DE5EBE",
|
||||
"6 c #D948B5",
|
||||
"7 c #F4CFEB",
|
||||
"8 c #DE60BF",
|
||||
" ...... ",
|
||||
" .......... ",
|
||||
" ............ ",
|
||||
" .............. ",
|
||||
" ....+@#$%&.... ",
|
||||
"....*=-;>,')....",
|
||||
"....!~{..;~]....",
|
||||
"....^~~~~~~/....",
|
||||
"....^~(.........",
|
||||
"...._~:...<[....",
|
||||
"....}'|12345....",
|
||||
" ....6@##78.... ",
|
||||
" .............. ",
|
||||
" ............ ",
|
||||
" .......... ",
|
||||
" ...... "};`,
|
||||
f_xpm = `/* XPM */
|
||||
static char * f_xpm[] = {
|
||||
"16 16 11 1",
|
||||
" c None",
|
||||
". c #0044FF",
|
||||
"+ c #2A62FE",
|
||||
"@ c #BDCEFE",
|
||||
"# c #F2F5FE",
|
||||
"$ c #FFFFFF",
|
||||
"% c #CBD8FE",
|
||||
"& c #3A6EFE",
|
||||
"* c #366BFE",
|
||||
"= c #FAFBFE",
|
||||
"- c #0044FE",
|
||||
" ...... ",
|
||||
" .......... ",
|
||||
" ............ ",
|
||||
" .....+@#$$.... ",
|
||||
" .....%$&*$.... ",
|
||||
"......=$-.......",
|
||||
".....$$$$$......",
|
||||
"......$$........",
|
||||
"......$$........",
|
||||
"......$$........",
|
||||
"......$$........",
|
||||
" .....$$....... ",
|
||||
" .....$$....... ",
|
||||
" ...$$$$..... ",
|
||||
" .......... ",
|
||||
" ...... "};`,
|
||||
i_xpm = `/* XPM */
|
||||
static char * i_xpm[] = {
|
||||
"16 16 6 1",
|
||||
" c None",
|
||||
". c #CC0033",
|
||||
"+ c #F2C4CF",
|
||||
"@ c #F2C3CF",
|
||||
"# c #F3C6D1",
|
||||
"$ c #FFFFFF",
|
||||
" ...... ",
|
||||
" .......... ",
|
||||
" .....+@..... ",
|
||||
" ......#+...... ",
|
||||
" .............. ",
|
||||
"......$$$.......",
|
||||
".......$$.......",
|
||||
".......$$.......",
|
||||
".......$$.......",
|
||||
".......$$.......",
|
||||
".......$$.......",
|
||||
" ......$$...... ",
|
||||
" .....$$$$..... ",
|
||||
" ............ ",
|
||||
" .......... ",
|
||||
" ...... "};`,
|
||||
n_xpm = `/* XPM */
|
||||
static char * n_xpm[] = {
|
||||
"16 16 13 1",
|
||||
" c None",
|
||||
". c #CCCCCC",
|
||||
"+ c #C9C9C9",
|
||||
"@ c #CBCBCB",
|
||||
"# c #CACACA",
|
||||
"$ c #E9E9E9",
|
||||
"% c #FFFFFF",
|
||||
"& c #E4E4E4",
|
||||
"* c #EEEEEE",
|
||||
"= c #DFDFDF",
|
||||
"- c #CDCDCD",
|
||||
"; c #FEFEFE",
|
||||
"> c #D7D7D7",
|
||||
" ...... ",
|
||||
" .......... ",
|
||||
" ............ ",
|
||||
" .............. ",
|
||||
" ...+++@++..... ",
|
||||
"...#$%%&*%=.....",
|
||||
"....+%%-+%;+....",
|
||||
"....+%%++%%+....",
|
||||
"....+%%++%%+....",
|
||||
"....+%%++%%+....",
|
||||
"...#$%%$>%%$....",
|
||||
" ...++++@+++... ",
|
||||
" .............. ",
|
||||
" ............ ",
|
||||
" .......... ",
|
||||
" ...... "};
|
||||
`,
|
||||
o_xpm = `/* XPM */
|
||||
static char * o_xpm[] = {
|
||||
"16 16 20 1",
|
||||
" c None",
|
||||
". c #00CC99",
|
||||
"+ c #45D9B4",
|
||||
"@ c #C2F2E6",
|
||||
"# c #F5FCFA",
|
||||
"$ c #FCFDFD",
|
||||
"% c #A8EDDB",
|
||||
"& c #16CFA1",
|
||||
"* c #14CFA0",
|
||||
"= c #A3ECD9",
|
||||
"- c #C3F2E6",
|
||||
"; c #FFFFFF",
|
||||
"> c #23D2A6",
|
||||
", c #22D2A6",
|
||||
"' c #04CC9A",
|
||||
") c #03CC99",
|
||||
"! c #A6ECDB",
|
||||
"~ c #15CFA0",
|
||||
"{ c #A5ECDA",
|
||||
"] c #44D8B3",
|
||||
" ...... ",
|
||||
" .......... ",
|
||||
" ............ ",
|
||||
" .............. ",
|
||||
" ....+@##@+.... ",
|
||||
"....+$%&*=$+....",
|
||||
"....-;>..,;@....",
|
||||
"....#;'..);#....",
|
||||
"....#;)..';#....",
|
||||
"....@;>..>;@....",
|
||||
"....+$!~*{$]....",
|
||||
" ....+-##-+.... ",
|
||||
" .............. ",
|
||||
" ............ ",
|
||||
" .......... ",
|
||||
" ...... "};`,
|
||||
p_xpm = `/* XPM */
|
||||
static char * p_xpm[] = {
|
||||
"16 16 25 1",
|
||||
" c None",
|
||||
". c #FF6600",
|
||||
"+ c #FFFFFF",
|
||||
"@ c #FEA66C",
|
||||
"# c #FEEDE3",
|
||||
"$ c #FEFAF8",
|
||||
"% c #FEE3D1",
|
||||
"& c #FE9854",
|
||||
"* c #FECAA8",
|
||||
"= c #FE7216",
|
||||
"- c #FE7215",
|
||||
"; c #FE8D42",
|
||||
"> c #FE7A22",
|
||||
", c #FE7B24",
|
||||
"' c #FED8BF",
|
||||
") c #FE6703",
|
||||
"! c #FE6804",
|
||||
"~ c #FEF3EC",
|
||||
"{ c #FEC9A6",
|
||||
"] c #FECAA7",
|
||||
"^ c #FE8E43",
|
||||
"/ c #FEEEE4",
|
||||
"( c #FEFBF9",
|
||||
"_ c #FEE3D2",
|
||||
": c #FE9A57",
|
||||
" ...... ",
|
||||
" .......... ",
|
||||
" ............ ",
|
||||
" ...+++@#$%&... ",
|
||||
" ....++*=-*+;.. ",
|
||||
".....++>..,+'...",
|
||||
".....++)..!+~...",
|
||||
".....++)..!+~...",
|
||||
".....++>..,+'...",
|
||||
".....++{--]+^...",
|
||||
".....++@/(_:....",
|
||||
" ....++........ ",
|
||||
" ....++........ ",
|
||||
" ..++++...... ",
|
||||
" .......... ",
|
||||
" ...... "};`,
|
||||
s_xpm = `/* XPM */
|
||||
static char * s_xpm[] = {
|
||||
"16 16 34 1",
|
||||
" c None",
|
||||
". c #33CC00",
|
||||
"+ c #4BD11F",
|
||||
"@ c #B6ECA4",
|
||||
"# c #E8F8E3",
|
||||
"$ c #FAFDF9",
|
||||
"% c #FFFFFF",
|
||||
"& c #D2F3C7",
|
||||
"* c #7BDD5B",
|
||||
"= c #38CC07",
|
||||
"- c #4AD11D",
|
||||
"; c #C0EEB1",
|
||||
"> c #F7FCF6",
|
||||
", c #6AD945",
|
||||
"' c #35CC03",
|
||||
") c #CAF1BD",
|
||||
"! c #F9FCF8",
|
||||
"~ c #E0F6D9",
|
||||
"{ c #A4E78D",
|
||||
"] c #41CE12",
|
||||
"^ c #44CF16",
|
||||
"/ c #EBF9E7",
|
||||
"( c #CBF1BE",
|
||||
"_ c #4ED222",
|
||||
": c #3DCD0D",
|
||||
"< c #77DC55",
|
||||
"[ c #F6FCF4",
|
||||
"} c #C8F0BB",
|
||||
"| c #37CC06",
|
||||
"1 c #78DC57",
|
||||
"2 c #D3F3C9",
|
||||
"3 c #FCFDFC",
|
||||
"4 c #ECF9E8",
|
||||
"5 c #BCEDAC",
|
||||
" ...... ",
|
||||
" .......... ",
|
||||
" ............ ",
|
||||
" .............. ",
|
||||
" ....+@#$%%%... ",
|
||||
".....&%*=-;%....",
|
||||
".....>%,'.-%....",
|
||||
".....)%%!~{]....",
|
||||
".....^@/%%%(....",
|
||||
".....%_.:<%[....",
|
||||
".....%}_|1%2....",
|
||||
" ....%%%345+... ",
|
||||
" .............. ",
|
||||
" ............ ",
|
||||
" .......... ",
|
||||
" ...... "};`,
|
||||
t_xpm = `/* XPM */
|
||||
static char * t_xpm[] = {
|
||||
"16 16 11 1",
|
||||
" c None",
|
||||
". c #CC9900",
|
||||
"+ c #FFFFFF",
|
||||
"@ c #F9F4E6",
|
||||
"# c #D2A622",
|
||||
"$ c #D5AD34",
|
||||
"% c #DEBF60",
|
||||
"& c #F8F2E1",
|
||||
"* c #FDFCF9",
|
||||
"= c #F8F3E3",
|
||||
"- c #DEBE5E",
|
||||
" ...... ",
|
||||
" .......... ",
|
||||
" ............ ",
|
||||
" .....++....... ",
|
||||
" .....++....... ",
|
||||
".....+++++......",
|
||||
"......++........",
|
||||
"......++........",
|
||||
"......++........",
|
||||
"......++........",
|
||||
"......++........",
|
||||
" .....@+#$@.... ",
|
||||
" .....%&*=-.... ",
|
||||
" ............ ",
|
||||
" .......... ",
|
||||
" ...... "};`
|
||||
|
2341
tools/WEE/window.ew
Normal file
2341
tools/WEE/window.ew
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user