_Bool messages_mup(MESSAGES *m){ if(m->iover != MSG_IDX_MAX) { MESSAGE *msg = m->data->data[m->iover]; if(msg->msg_type == MSG_TYPE_TEXT){ if(m->urlover != STRING_IDX_MAX && m->urlmdown) { char_t url[m->urllen + 1]; memcpy(url, msg->msg + m->urlover, m->urllen * sizeof(char_t)); url[m->urllen] = 0; openurl(url); m->urlmdown = 0; } } } //temporary, change this if(m->select) { char_t *lel = malloc(65536); //TODO: De-hardcode this value. setselection(lel, messages_selection(m, lel, 65536, 0)); free(lel); m->select = 0; } m->idown = MSG_IDX_MAX; return 0; }
_Bool edit_mup(EDIT *edit) { if(edit->multiline) { if(scroll_mup(edit->scroll)) { return 1; } } if(edit_select && edit == active_edit) { setselection(edit->data + edit_sel.start, edit_sel.length); edit_select = 0; } return 0; }
void paste(keveditor * myeditor) { ZZTworld * myworld = myeditor->myworld; int done = 0; int x = 0, y = 0; selection pasteselection; if (myeditor->copyBlock == NULL) return; /* Initialize valid pasting region selection */ initselection(&pasteselection, ZZT_BOARD_X_SIZE, ZZT_BOARD_Y_SIZE); if (myeditor->selectmode) { /* Only paste within the selected region */ copyselection(pasteselection, myeditor->selCurrent); } else { /* Paste everywhere */ setselection(pasteselection); } /* Don't paste over the player */ unselectpos(pasteselection, myworld->boards[zztBoardGetCurrent(myworld)].plx, myworld->boards[zztBoardGetCurrent(myworld)].ply); while (!done) { int key; ZZTblock * previewBlock; /* Merge the current board and copyBlock onto the previewBlock */ previewBlock = zztBlockDuplicate(zztBoardGetBlock(myeditor->myworld)); pasteblock(previewBlock, myeditor->copyBlock, pasteselection, myeditor->copySelection, x, y); /* Draw the preview */ drawblock(myeditor->mydisplay, previewBlock, 0, 0); key = myeditor->mydisplay->getch(); movebykeystroke(key, &x, &y, -myeditor->copyBlock->width, -myeditor->copyBlock->height, myeditor->copyBlock->width, myeditor->copyBlock->height, myeditor->mydisplay); if (key == ' ' || key == DKEY_ENTER) { pasteblock(zztBoardGetBlock(myeditor->myworld), myeditor->copyBlock, pasteselection, myeditor->copySelection, x, y); /* Set the paramcount for the board */ zztBoardSetParamcount(myeditor->myworld, zztBoardGetBlock(myeditor->myworld)->paramcount); done = 1; } if (key == DKEY_ESC) done = 1; zztBlockFree(previewBlock); } deleteselection(&pasteselection); myeditor->clearselectflag = 1; myeditor->updateflags |= UD_BOARD | UD_OBJCOUNT; }