Exemple #1
0
qw_op_t qw_edit_op(qw_edit_t *e, qw_event_t *ev)
{
    qw_op_t r = QW_OP_NOP;
    qw_core_t *c = ev->c;

    switch (ev->o) {
    case QW_OP_LEFT:
        op_left(e);
        break;

    case QW_OP_RIGHT:
        op_right(e);
        break;

    case QW_OP_UP:
        op_up(e, ev->f);
        break;

    case QW_OP_DOWN:
        op_down(e, ev->f);
        break;

    case QW_OP_PGUP:
        op_pgup(e, ev->f);
        break;

    case QW_OP_PGDN:
        op_pgdn(e, ev->f);
        break;

    case QW_OP_BOL:
        op_bol(e);
        break;

    case QW_OP_EOL:
        op_eol(e);
        break;

    case QW_OP_BOR:
        op_bor(e, ev->f);
        break;

    case QW_OP_EOR:
        op_eor(e, ev->f);
        break;

    case QW_OP_BOF:
        op_bof(e);
        break;

    case QW_OP_EOF:
        op_eof(e);
        break;

    case QW_OP_CHAR:
        op_char(e, ev->w);
        break;

    case QW_OP_DEL:
        op_del(e);
        break;

    case QW_OP_BACKSPACE:
        op_backspace(e);
        break;

    case QW_OP_NEWLINE:
        op_char(e, L'\n');
        break;

    case QW_OP_TAB:
        op_tab(e, ev->f, c);
        break;

    case QW_OP_HARD_TAB:
        op_char(e, L'\t');
        break;

    case QW_OP_DEL_ROW:
        op_del_row(e, ev->f);
        break;

    case QW_OP_UNDO:
        op_undo(e);
        break;

    case QW_OP_MARK:
        op_mark(e);
        break;

    case QW_OP_UNMARK:
        op_unmark(e);
        break;

    case QW_OP_COPY:
        op_copy(e, c);
        op_unmark(e);

        break;

    case QW_OP_PASTE:
        op_paste(e, c);
        break;

    case QW_OP_CUT:
        op_cut(e, c);
        break;

    case QW_OP_SAVE:
        op_save(e);
        break;

    case QW_OP_SHOW_CODES:
        ev->f->l = L" \xb6"[!!(ev->f->l == L' ')];
        break;

    case QW_OP_SEARCH:
        op_search(e, c);
        break;

    case QW_OP_CLOSE:
        r = QW_OP_DESTROY;
        break;

    case QW_OP_DESTROY:
        r = QW_OP_DESTROY;
        break;

    case QW_OP_NOP:
    case QW_OP_COUNT:
        break;
    }

    return r;
}
Exemple #2
0
SEXP Muste_Command(SEXP para) // RS EDT 19.9.2012
{
extern int muste_lopetus;
extern int muste_window_existing;
extern int op_load();
extern void op_theme();
extern int g;
extern char *parm[];
extern char *word[];
extern char orig_setup[], current_setup[];
extern int sur_dump();
extern char sur_session[];
char *kojo, *txtparm;
//Rprintf("\nMuste_Command: %s",CHAR(STRING_ELT(para,0)));

kojo=(char *)CHAR(STRING_ELT(para,0));
if (strcmp(kojo,"LoadEdt")==0)
	{
	sur_dump(sur_session);	
	g=2;
	parm[1]=(char *)CHAR(STRING_ELT(para,1));
	op_load();
	disp();
	return(para);
	}

if (strcmp(kojo,"Restore")==0)
	{
	muste_emergency_stop=1;
	return(para);
	}

if (strcmp(kojo,"DumpEdt")==0)
	{
	extern int sur_dump();
	sur_dump();
	return(para);
	}

if (strcmp(kojo,"SaveEdt")==0)
	{
	extern int muste_save_firstline();
	int i;
	i=muste_save_firstline();
	if (i<0) muste_set_R_int(".muste$saverror",1);
	return(para);
	}

if (strcmp(kojo,"SaveEdtName")==0)
	{
	extern int muste_save_firstline_name();
	word[1]=(char *)CHAR(STRING_ELT(para,1));
	muste_save_firstline_name(word[1]);
	return(para);
	}

if (strcmp(kojo,"RemovePlotWindows")==0)
	{
	extern int op_gplot();
	g=3; parm[1]="/DEL"; parm[2]="ALL";
	op_gplot();
	return(para);
	}	
	
	
if (strcmp(kojo,"GetSaveName")==0)
	{	
	edread(str1,1);
    g=splitq(str1+1,parm,2);
    if (g>1) 
    	{
    	if (strcmp(parm[0],"SAVE")==0) muste_set_R_string(".muste$savename",parm[1]);
    	}
    return(para);
    }	

if (strcmp(kojo,"Theme")==0)
	{
	g=2;
	word[1]=(char *)CHAR(STRING_ELT(para,1));
	op_theme();
	disp();
	return(para);
	}	

if (strcmp(kojo,"Cut")==0)
	{
	extern int muste_cutselection();
	extern int muste_selection;
	int i;

	sur_dump(sur_session);	
	i=atoi((char *)CHAR(STRING_ELT(para,1)));
	if (i<10 && muste_selection)
		{	
		muste_cutselection(i);
		}
	else if (i>10) muste_cutselection(i);
	return(para);
	}	

if (strcmp(kojo,"Undo")==0)
	{
	extern int op_undo();
	op_undo();
	return(para);
	}	

if (strcmp(kojo,"Redo")==0)
	{
	extern int op_redo();
	op_redo();
	return(para);
	}

if (strcmp(kojo,"Require")==0)
	{
	txtparm=(char *)CHAR(STRING_ELT(para,1));
	if (strcmp(txtparm,"tcltk")==0)
	    {
        muste_evalr("require(tcltk)");
	    }
	else // RS 29.8.2013
	    {
	    muste_requirepackage(txtparm);
	    }
	return(para);
	}
	
if (strcmp(kojo,"Apufile")==0)
	{
	word[1]=(char *)CHAR(STRING_ELT(para,1));
	strcpy(orig_setup,word[1]);
	strcpy(current_setup,word[1]);
	return(para);
	}	

/*
if (strcmp(kojo,"HookLast")==0)
    {
//    sprintf(cmd,".Last.sys <- function() { cat('collection is invoked...') }");
sprintf(cmd,"qq <- q"); 
    muste_evalr(cmd);
sprintf(cmd,"quit <- q <- function(save = \"default\", status = 0, runLast = TRUE) { if (exists(\"editor\",where=.muste)) muste:::.muste.end(); else qq(save,status,runLast); }");
    muste_evalr(cmd);
    return(para);
    }
*/
if (strcmp(kojo,"Exit")==0)
	{
	muste_lopetus=TRUE;
	muste_window_existing=FALSE;
	}
	
return(para);
}