summaryrefslogtreecommitdiff
path: root/src/interface.c
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2011-04-04 17:43:20 (GMT)
committer Simon <simon@hardwired.org.uk>2011-04-06 12:08:59 (GMT)
commit1bc97fcc370c6d8197482b3cc1df6413e0bcd765 (patch)
treeaa1f4ee21648ab1eb11d4031fcdb9b4bb9357b46 /src/interface.c
parent7663192174079598c8a28ac08b355d056567927a (diff)
downloadpowder-1bc97fcc370c6d8197482b3cc1df6413e0bcd765.zip
powder-1bc97fcc370c6d8197482b3cc1df6413e0bcd765.tar.gz
copy and paste functions for text boxes.
Diffstat (limited to 'src/interface.c')
-rw-r--r--src/interface.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/interface.c b/src/interface.c
index 17043e9..1e8f44b 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -68,7 +68,7 @@ int zoom_wx=0, zoom_wy=0;
unsigned char ZFACTOR = 256/ZSIZE_D;
unsigned char ZSIZE = ZSIZE_D;
-void menu_count(void)// never used
+void menu_count(void)//puts the number of elements in each section into .itemcount
{
int i=0;
msections[SC_WALL].itemcount = UI_WALLCOUNT-4;
@@ -388,6 +388,22 @@ void ui_edit_process(int mx, int my, int mb, ui_edit *ed)
}
break;
default:
+ if(sdl_mod & (KMOD_CTRL) && sdl_key=='c')//copy
+ {
+ clipboard_push_text(ed->str);
+ break;
+ }
+ else if(sdl_mod & (KMOD_CTRL) && sdl_key=='v')//paste
+ {
+ char *paste = "foo"; //clipboard_pull_text();
+ int pl = strlen(paste);
+ if ((textwidth(str)+textwidth(paste) > ed->w-14 && !ed->multiline) || (float)(((textwidth(str)+textwidth(paste))/(ed->w-14)*12) > ed->h && ed->multiline))
+ break;
+ memmove(ed->str+ed->cursor+pl, ed->str+ed->cursor, l+pl-ed->cursor);
+ memcpy(ed->str+ed->cursor,paste,pl);
+ ed->cursor += pl;
+ break;
+ }
#ifdef RAWINPUT
if (sdl_key>=SDLK_SPACE && sdl_key<=SDLK_z && l<255)
{