252 posts
Location
The Netherlands
Posted 29 December 2013 - 04:13 PM
Hello everyone. Today I decided to make a text editing program. After a couple of hours of coding, I came up with the unoptimized, auto-updating, poorly commented mess that is WRD
I have created this program mostly for fun and because I wanted to try making a program with a graphical user interface.
FeaturesSpoiler
- Per-line editing and selecting
- Use the arrow keys to switch between lines
- Use control to select the current line
- Copy/cut/paste
- Printing
- Searching (supports patterns!)
- Right-click menu for quick access to copy/cut/paste
- GUI
- Themes
- You can create your own themes; see below.
- Auto-update: will notify you if there's an update on startup
PicturesVersion 1.0Spoiler
No screenshots as nothing has really changed visually. Version 0.95Spoiler
The editor
About
Saving a file
Themes and more :D/> DownloadSpoiler
pastebin get BSyiFV58 wrd
BSyiFV58 Change log1.0 (not released yet)- Support for user-created themes
- More themes
- Partially fixed code readability
- Added (limited) delete key functionality
- Added the option to open from command line
- Added scrolling to text input dialogs (so you can open files with long names :P/>)
Previous versionsSpoiler
0.95- More development
- First release
0.1 - 0.9 How to create themes (currently not available)Spoiler
- Run WRD with the '-t' command-line parameter.
wrd -t
- This will create a file called 'theme_template'. Copy this file and name it whatever you want.
- Now edit the copied file. (*)
- Save the file.
- Run wrd.
- Click 'file > load theme'.
- Type the file name.
- The theme should be loaded!
(*) Note that:- The colors must be defined using the names from the colors (or colours) API, without the 'colors.' part. Example: m_back=gray
- The lines starting with 'm_' define the menu colors.
- The line with 'p_' is the program background.
- The lines with 'w_' define the colors used in the writing area
Bugs/unintended featuresSpoiler
No idea how to fix // will probably be fixed- Very long, unoptimized and uncommented code partially fixed in version 1.0
- You can only type 15 lines (will implement scrolling later)
When you have two or more lines, and you type on the second line, you can not remove the first line fixed in version 1.0
Tell me if/when you find any bugs. Things that will be addedSpoiler
No idea how (help please?) // will probably be added- Free editing (instead of per-line editing)
- Scrolling
More themes done in version 1.0User-created themes done in version 1.0- Download and edit files
- More comments partially done in version 1.0
Command-line arguments (open a file directly) done in version 1.0- Custom paper size
- Suggestions?
Thanks for reading!
Edited on 20 January 2014 - 07:30 AM
1114 posts
Location
UK
Posted 30 December 2013 - 06:53 AM
With a bit of work, this could be brilliant!
767 posts
Posted 30 December 2013 - 08:40 AM
for the scrolling part,
you can make a function which draws all the important things on the screen
( eg. the header and the footer ),
then you use term.scroll(1) or whatever,
and call the function which redraws the header and footer…
example:
local termSize={term.getSize()}
local screenDATA={
["footer"]={
y=termSize[2];
x=1;
bCol=colors.lightBlue;
tCol=colors.white
};
}
function refreshScreen() -- the function which redraws the important things
local pos={term.getCursorPos()}
-- footer --
term.setCursorPos(screenDATA["footer"].x,screenDATA["footer"].y)
term.setBackgroundColor(screenDATA["footer"].bCol)
term.setTextColor(screenDATA["footer"].tCol)
term.clearLine()
term.write("Hello")
term.setBackgroundColor(colors.black)
term.setTextColor(colors.yellow)
term.setCursorPos(pos[1],pos[2])
end
function cursor_Handle() -- handle everything ( where the cursor position is and then scroll etc. )
while true do
refreshScreen() --- just so the "edit" program wont overlap this footer.
position_tbl={term.getCursorPos()} -- returns position_tbl[1] = x, position_tbl[2]= y
if position_tbl[2] >= screenDATA["footer"].y then -- heres the most important part when scrolling with custom footers and headers.
term.scroll(1) -- first, scroll
refreshScreen() -- then redraw
local pos={term.getCursorPos()} -- then set the cursor position to be sure nothing will be wrong
term.setCursorPos(pos[1],pos[2]-1)
end
sleep(0) -- erm? yeah just a basic sleep function to prevent the "Too long without yielding" error
end
end
function func()
shell.run("edit textEdit")
end
parallel.waitForAny(func,cursor_Handle) -- run the editor AND our created function called handler
Edited on 30 December 2013 - 07:44 AM
3 posts
Posted 30 December 2013 - 03:58 PM
so cool!
252 posts
Location
The Netherlands
Posted 31 December 2013 - 06:23 AM
With a bit of work, this could be brilliant!
Thanks! Could you tell me what 'bit of work' is needed?
Spoiler
for the scrolling part,
you can make a function which draws all the important things on the screen
( eg. the header and the footer ),
then you use term.scroll(1) or whatever,
and call the function which redraws the header and footer…
example:
local termSize={term.getSize()}
local screenDATA={
["footer"]={
y=termSize[2];
x=1;
bCol=colors.lightBlue;
tCol=colors.white
};
}
function refreshScreen() -- the function which redraws the important things
local pos={term.getCursorPos()}
-- footer --
term.setCursorPos(screenDATA["footer"].x,screenDATA["footer"].y)
term.setBackgroundColor(screenDATA["footer"].bCol)
term.setTextColor(screenDATA["footer"].tCol)
term.clearLine()
term.write("Hello")
term.setBackgroundColor(colors.black)
term.setTextColor(colors.yellow)
term.setCursorPos(pos[1],pos[2])
end
function cursor_Handle() -- handle everything ( where the cursor position is and then scroll etc. )
while true do
refreshScreen() --- just so the "edit" program wont overlap this footer.
position_tbl={term.getCursorPos()} -- returns position_tbl[1] = x, position_tbl[2]= y
if position_tbl[2] >= screenDATA["footer"].y then -- heres the most important part when scrolling with custom footers and headers.
term.scroll(1) -- first, scroll
refreshScreen() -- then redraw
local pos={term.getCursorPos()} -- then set the cursor position to be sure nothing will be wrong
term.setCursorPos(pos[1],pos[2]-1)
end
sleep(0) -- erm? yeah just a basic sleep function to prevent the "Too long without yielding" error
end
end
function func()
shell.run("edit textEdit")
end
parallel.waitForAny(func,cursor_Handle) -- run the editor AND our created function called handler
I don't quite understand what you mean, but I'll try to do something with term.scroll, if that works. Thanks for the tip!
so cool!
Such thanks
Wow
2151 posts
Location
Auckland, New Zealand
Posted 01 January 2014 - 09:28 PM
Looks good. The lack of capitalized first characters annoys me no end, however. While it may be intentional, it does come across as a lack of attention to detail.
135 posts
Posted 18 January 2014 - 01:30 PM
It appears that wrd -t doesn't create a theme file
88 posts
Posted 18 January 2014 - 04:38 PM
Suggestion: A way to change the paper size, so I can have one paper size which covers the entire page and one which is limited to give me enough room for printing on paper. It would also be cool if you could define your own paper sizes much like themes.
252 posts
Location
The Netherlands
Posted 18 January 2014 - 06:09 PM
Looks good. The lack of capitalized first characters annoys me no end, however. While it may be intentional, it does come across as a lack of attention to detail.
The capitalization thing was intentional, but I see why it annoys you. Will be fixed. Thanks!
It appears that wrd -t doesn't create a theme file
That's because the version on Pastebin hasn't been updated yet. I'm still working on the update. Guess I shouldn't have added the theme part to the post. Thanks for notifying me though!
Suggestion: A way to change the paper size, so I can have one paper size which covers the entire page and one which is limited to give me enough room for printing on paper. It would also be cool if you could define your own paper sizes much like themes.
That's a good idea, I'll add an option to change paper size. Thanks!
I've had lots of tests lately, but WRD will be updated
*soon*!
Edited on 02 February 2014 - 05:21 AM
135 posts
Posted 19 January 2014 - 08:22 AM
YAY! It's really good. Keep up the good work
88 posts
Posted 30 January 2014 - 05:13 PM
OOC: Is there any ETA on a new update?