예제 #1
0
void TextEditor::_edit_option(int p_op) {
	TextEdit *tx = code_editor->get_text_edit();

	switch (p_op) {
		case EDIT_UNDO: {

			tx->undo();
			tx->call_deferred("grab_focus");
		} break;
		case EDIT_REDO: {

			tx->redo();
			tx->call_deferred("grab_focus");
		} break;
		case EDIT_CUT: {

			tx->cut();
			tx->call_deferred("grab_focus");
		} break;
		case EDIT_COPY: {

			tx->copy();
			tx->call_deferred("grab_focus");
		} break;
		case EDIT_PASTE: {

			tx->paste();
			tx->call_deferred("grab_focus");
		} break;
		case EDIT_SELECT_ALL: {

			tx->select_all();
			tx->call_deferred("grab_focus");
		} break;
		case EDIT_MOVE_LINE_UP: {

			code_editor->move_lines_up();
		} break;
		case EDIT_MOVE_LINE_DOWN: {

			code_editor->move_lines_down();
		} break;
		case EDIT_INDENT_LEFT: {

			tx->indent_left();
		} break;
		case EDIT_INDENT_RIGHT: {

			tx->indent_right();
		} break;
		case EDIT_DELETE_LINE: {

			code_editor->delete_lines();
		} break;
		case EDIT_CLONE_DOWN: {

			code_editor->clone_lines_down();
		} break;
		case EDIT_TOGGLE_FOLD_LINE: {

			tx->toggle_fold_line(tx->cursor_get_line());
			tx->update();
		} break;
		case EDIT_FOLD_ALL_LINES: {

			tx->fold_all_lines();
			tx->update();
		} break;
		case EDIT_UNFOLD_ALL_LINES: {

			tx->unhide_all_lines();
			tx->update();
		} break;
		case EDIT_TRIM_TRAILING_WHITESAPCE: {

			trim_trailing_whitespace();
		} break;
		case EDIT_CONVERT_INDENT_TO_SPACES: {

			convert_indent_to_spaces();
		} break;
		case EDIT_CONVERT_INDENT_TO_TABS: {

			convert_indent_to_tabs();
		} break;
		case EDIT_TO_UPPERCASE: {

			_convert_case(CodeTextEditor::UPPER);
		} break;
		case EDIT_TO_LOWERCASE: {

			_convert_case(CodeTextEditor::LOWER);
		} break;
		case EDIT_CAPITALIZE: {

			_convert_case(CodeTextEditor::CAPITALIZE);
		} break;
		case SEARCH_FIND: {

			code_editor->get_find_replace_bar()->popup_search();
		} break;
		case SEARCH_FIND_NEXT: {

			code_editor->get_find_replace_bar()->search_next();
		} break;
		case SEARCH_FIND_PREV: {

			code_editor->get_find_replace_bar()->search_prev();
		} break;
		case SEARCH_REPLACE: {

			code_editor->get_find_replace_bar()->popup_replace();
		} break;
		case SEARCH_GOTO_LINE: {

			goto_line_dialog->popup_find_line(tx);
		} break;
	}
}
예제 #2
0
void FrostEdit::on_actionCut_triggered() {
	TextEdit* edit = toTextEdit(mCurrentTabWidget->currentWidget());
	if(edit != nullptr)
		edit->cut();
}