1. ed.ex with wxEuphoria file_selector

Virtually all of this code was lifted from the wxide source code:

---------------------- 
include wxeud.e  <------- placed at the top of ed.ex's include files 
---------------------- 
 
procedure new_file()  
    sequence answer 
 
--for wx_file_selector................. 
    sequence cwd, win_size, win_pos 
    win_size = {-1,-1} 
    win_pos  = {-1,-1} 
 
    atom main    -- for wx_file_selector 
    main = create( wxFrame, {0, -1, "wxIDE", win_pos[1], win_pos[2], win_size[1], win_size[2], 
	wx_or_all( {wxDEFAULT_FRAME_STYLE, wxNO_FULL_REPAINT_ON_RESIZE}) }) 
------------------------------------------- 
	if modified and last_use() then 
		while TRUE do 
		    set_top_line("") 
		    printf(SCREEN, "save changes to %s? ", {file_name}) 
		    answer = key_gets("yn", {}) 
		    if find('y', answer) then 
			save_file(file_name) 
			exit 
		    elsif find('n', answer) then 
			exit 
		    end if 
		end while 
	end if 
	save_state() 
 
	cwd = current_dir() 
	answer = file_selector( main, "Select a file to open", 
	    {cwd,"","", "All Files (*.*)|*.*;*|Euphoria Files|*.e;*.ex;*.exw;*.exu;*.ew;*.eu;*.wxe|" & 
	    "Source Code/Scripts|"},wxOPEN + wxFILE_MUST_EXIST) 
		 
	if length(answer) != 0 then 
	    file_name = answer 
	    stop = TRUE 
	end if 
end procedure 

What I have actually done is kept ed.ex's original new_file procedure and added the above code as wx_new_file which is called by ESC + "N". Sometimes I find it easier to use ed.ex's file_history to load files.

Kenneth Rhodes

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu