Blender  V2.93
console_ops.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include <ctype.h> /* #ispunct */
22 #include <stdlib.h>
23 #include <string.h>
24 #include <sys/stat.h>
25 
26 #include "MEM_guardedalloc.h"
27 
28 #include "DNA_userdef_types.h"
29 
30 #include "BLI_dynstr.h"
31 #include "BLI_listbase.h"
32 #include "BLI_math.h"
33 #include "BLI_string.h"
34 #include "BLI_string_cursor_utf8.h"
35 #include "BLI_string_utf8.h"
36 #include "BLI_utildefines.h"
37 
38 #include "BKE_context.h"
39 
40 #include "WM_api.h"
41 #include "WM_types.h"
42 
43 #include "ED_screen.h"
44 #include "UI_view2d.h"
45 
46 #include "RNA_access.h"
47 #include "RNA_define.h"
48 
49 #include "console_intern.h"
50 
51 /* so when we type - the view scrolls to the bottom */
52 static void console_scroll_bottom(ARegion *region)
53 {
54  View2D *v2d = &region->v2d;
55  v2d->cur.ymin = 0.0;
56  v2d->cur.ymax = (float)v2d->winy;
57 }
58 
60 {
61  View2D *v2d = &region->v2d;
62 
63  UI_view2d_totRect_set(v2d, region->winx - 1, console_textview_height(sc, region));
64 }
65 
66 static void console_select_offset(SpaceConsole *sc, const int offset)
67 {
68  sc->sel_start += offset;
69  sc->sel_end += offset;
70 }
71 
73 {
74  BLI_remlink(&sc->history, cl);
75  MEM_freeN(cl->line);
76  MEM_freeN(cl);
77 }
79 {
80  BLI_remlink(&sc->scrollback, cl);
81  MEM_freeN(cl->line);
82  MEM_freeN(cl);
83 }
84 
86 {
87  int tot;
88 
89  for (tot = BLI_listbase_count(&sc->scrollback); tot > U.scrollback; tot--) {
91  }
92 }
93 
94 static ConsoleLine *console_history_find(SpaceConsole *sc, const char *str, ConsoleLine *cl_ignore)
95 {
96  ConsoleLine *cl;
97 
98  for (cl = sc->history.last; cl; cl = cl->prev) {
99  if (cl == cl_ignore) {
100  continue;
101  }
102 
103  if (STREQ(str, cl->line)) {
104  return cl;
105  }
106  }
107 
108  return NULL;
109 }
110 
111 /* return 0 if no change made, clamps the range */
112 static bool console_line_cursor_set(ConsoleLine *cl, int cursor)
113 {
114  int cursor_new;
115 
116  if (cursor < 0) {
117  cursor_new = 0;
118  }
119  else if (cursor > cl->len) {
120  cursor_new = cl->len;
121  }
122  else {
123  cursor_new = cursor;
124  }
125 
126  if (cursor_new == cl->cursor) {
127  return false;
128  }
129 
130  cl->cursor = cursor_new;
131  return true;
132 }
133 
134 #if 0 /* XXX unused */
135 static void console_lb_debug__internal(ListBase *lb)
136 {
137  ConsoleLine *cl;
138 
139  printf("%d: ", BLI_listbase_count(lb));
140  for (cl = lb->first; cl; cl = cl->next) {
141  printf("<%s> ", cl->line);
142  }
143  printf("\n");
144 }
145 
146 static void console_history_debug(const bContext *C)
147 {
149 
150  console_lb_debug__internal(&sc->history);
151 }
152 #endif
153 
155 {
156  ConsoleLine *ci = MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add");
157 
158  if (from) {
159  BLI_assert(strlen(from->line) == from->len);
160  ci->line = BLI_strdupn(from->line, from->len);
161  ci->len = ci->len_alloc = from->len;
162  ci->cursor = from->cursor;
163  ci->type = from->type;
164  }
165  else {
166  ci->line = MEM_callocN(64, "console-in-line");
167  ci->len_alloc = 64;
168  ci->len = 0;
169  }
170 
171  BLI_addtail(lb, ci);
172  return ci;
173 }
174 
176 {
177  return console_lb_add__internal(&sc->history, from);
178 }
179 
180 #if 0 /* may use later ? */
181 static ConsoleLine *console_scrollback_add(const bContext *C, ConsoleLine *from)
182 {
184 
186 }
187 #endif
188 
190 {
191  ConsoleLine *ci = MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add");
192  if (own) {
193  ci->line = str;
194  }
195  else {
196  ci->line = BLI_strdup(str);
197  }
198 
199  ci->len = ci->len_alloc = strlen(str);
200 
201  BLI_addtail(lb, ci);
202  return ci;
203 }
205 {
206  return console_lb_add_str__internal(&sc->history, str, own);
207 }
209 {
211  console_select_offset(sc, ci->len + 1);
212  return ci;
213 }
214 
216 {
218  ConsoleLine *ci = sc->history.last;
219  if (ci == NULL) {
220  ci = console_history_add(sc, NULL);
221  }
222 
223  return ci;
224 }
225 
227 {
228  /* resize the buffer if needed */
229  if (len >= ci->len_alloc) {
230  /* new length */
231 #ifndef NDEBUG
232  int new_len = len + 1;
233 #else
234  int new_len = (len + 1) * 2;
235 #endif
236  ci->line = MEM_recallocN_id(ci->line, new_len, "console line");
237  ci->len_alloc = new_len;
238  }
239 }
240 
241 static int console_line_insert(ConsoleLine *ci, char *str)
242 {
243  int len = strlen(str);
244 
245  if (len > 0 && str[len - 1] == '\n') { /* stop new lines being pasted at the end of lines */
246  str[len - 1] = '\0';
247  len--;
248  }
249 
250  if (len == 0) {
251  return 0;
252  }
253 
255 
256  memmove(ci->line + ci->cursor + len, ci->line + ci->cursor, (ci->len - ci->cursor) + 1);
257  memcpy(ci->line + ci->cursor, str, len);
258 
259  ci->len += len;
260  ci->cursor += len;
261 
262  return len;
263 }
264 
271  SpaceConsole *sc, const int pos, ConsoleLine **r_cl, int *r_cl_offset, int *r_col)
272 {
273  ConsoleLine *cl;
274  int offset = 0;
275 
276  for (cl = sc->scrollback.last; cl; cl = cl->prev) {
277  offset += cl->len + 1;
278  if (offset >= pos) {
279  break;
280  }
281  }
282 
283  if (cl) {
284  offset -= 1;
285  *r_cl = cl;
286  *r_cl_offset = offset;
287  *r_col = offset - pos;
288  return true;
289  }
290 
291  *r_cl = NULL;
292  *r_cl_offset = -1;
293  *r_col = -1;
294  return false;
295 }
296 
297 /* static funcs for text editing */
298 
299 /* similar to the text editor, with some not used. keep compatible */
301  {LINE_BEGIN, "LINE_BEGIN", 0, "Line Begin", ""},
302  {LINE_END, "LINE_END", 0, "Line End", ""},
303  {PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
304  {NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""},
305  {PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
306  {NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
307  {0, NULL, 0, NULL, NULL},
308 };
309 
311 {
313 
314  int type = RNA_enum_get(op->ptr, "type");
315  bool done = false;
316  int pos;
317 
318  switch (type) {
319  case LINE_BEGIN:
320  pos = ci->cursor;
322  done = console_line_cursor_set(ci, pos);
323  break;
324  case LINE_END:
325  pos = ci->cursor;
327  done = console_line_cursor_set(ci, pos);
328  break;
329  case PREV_CHAR:
330  pos = ci->cursor;
332  done = console_line_cursor_set(ci, pos);
333  break;
334  case NEXT_CHAR:
335  pos = ci->cursor;
337  done = console_line_cursor_set(ci, pos);
338  break;
339 
340  /* - if the character is a delimiter then skip delimiters (including white space)
341  * - when jump over the word */
342  case PREV_WORD:
343  pos = ci->cursor;
345  done = console_line_cursor_set(ci, pos);
346  break;
347  case NEXT_WORD:
348  pos = ci->cursor;
350  done = console_line_cursor_set(ci, pos);
351  break;
352  }
353 
354  if (done) {
356  ARegion *region = CTX_wm_region(C);
357 
359  console_scroll_bottom(region);
360  }
361 
362  return OPERATOR_FINISHED;
363 }
364 
366 {
367  /* identifiers */
368  ot->name = "Move Cursor";
369  ot->description = "Move cursor position";
370  ot->idname = "CONSOLE_OT_move";
371 
372  /* api callbacks */
375 
376  /* properties */
377  RNA_def_enum(
378  ot->srna, "type", console_move_type_items, LINE_BEGIN, "Type", "Where to move cursor to");
379 }
380 
381 #define TAB_LENGTH 4
383 {
385  ARegion *region = CTX_wm_region(C);
387  char *str = RNA_string_get_alloc(op->ptr, "text", NULL, 0);
388  int len;
389 
390  if (str[0] == '\t' && str[1] == '\0') {
391  len = TAB_LENGTH;
392  MEM_freeN(str);
393  str = MEM_mallocN(len + 1, "insert_exec");
394  memset(str, ' ', len);
395  str[len] = '\0';
396  }
397 
398  len = console_line_insert(ci, str);
399 
400  MEM_freeN(str);
401 
402  if (len == 0) {
403  return OPERATOR_CANCELLED;
404  }
405 
407 
408  console_textview_update_rect(sc, region);
410 
411  console_scroll_bottom(region);
412 
413  return OPERATOR_FINISHED;
414 }
415 
416 static int console_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event)
417 {
418  /* Note, the "text" property is always set from key-map,
419  * so we can't use #RNA_struct_property_is_set, check the length instead. */
420  if (!RNA_string_length(op->ptr, "text")) {
421  /* if alt/ctrl/super are pressed pass through except for utf8 character event
422  * (when input method are used for utf8 inputs, the user may assign key event
423  * including alt/ctrl/super like ctrl+m to commit utf8 string. in such case,
424  * the modifiers in the utf8 character event make no sense.) */
425  if ((event->ctrl || event->oskey) && !event->utf8_buf[0]) {
426  return OPERATOR_PASS_THROUGH;
427  }
428 
429  char str[BLI_UTF8_MAX + 1];
430  size_t len;
431 
432  if (event->utf8_buf[0]) {
434  memcpy(str, event->utf8_buf, len);
435  }
436  else {
437  /* in theory, ghost can set value to extended ascii here */
439  }
440  str[len] = '\0';
441  RNA_string_set(op->ptr, "text", str);
442  }
443  return console_insert_exec(C, op);
444 }
445 
447 {
448  PropertyRNA *prop;
449 
450  /* identifiers */
451  ot->name = "Insert";
452  ot->description = "Insert text at cursor position";
453  ot->idname = "CONSOLE_OT_insert";
454 
455  /* api callbacks */
459 
460  /* properties */
461  prop = RNA_def_string(
462  ot->srna, "text", NULL, 0, "Text", "Text to insert at the cursor position");
464 }
465 
466 /* -------------------------------------------------------------------- */
471 {
473  bool text_before_cursor = ci->cursor != 0 && !ELEM(ci->line[ci->cursor - 1], ' ', '\t');
474  if (text_before_cursor) {
475  WM_operator_name_call(C, "CONSOLE_OT_autocomplete", WM_OP_INVOKE_DEFAULT, NULL);
476  }
477  else {
478  WM_operator_name_call(C, "CONSOLE_OT_indent", WM_OP_EXEC_DEFAULT, NULL);
479  }
480  return OPERATOR_FINISHED;
481 }
482 
484 {
485  /* identifiers */
486  ot->name = "Indent or Autocomplete";
487  ot->idname = "CONSOLE_OT_indent_or_autocomplete";
488  ot->description = "Indent selected text or autocomplete";
489 
490  /* api callbacks */
493 
494  /* flags */
495  ot->flag = 0;
496 }
497 
500 /* -------------------------------------------------------------------- */
505 {
507  ARegion *region = CTX_wm_region(C);
509  int spaces;
510  int len;
511 
512  for (spaces = 0; spaces < ci->len; spaces++) {
513  if (ci->line[spaces] != ' ') {
514  break;
515  }
516  }
517 
518  len = TAB_LENGTH - spaces % TAB_LENGTH;
519 
521 
522  memmove(ci->line + len, ci->line, ci->len + 1);
523  memset(ci->line, ' ', len);
524  ci->len += len;
525  BLI_assert(ci->len >= 0);
528 
529  console_textview_update_rect(sc, region);
531 
532  console_scroll_bottom(region);
533 
534  return OPERATOR_FINISHED;
535 }
536 
538 {
539  /* identifiers */
540  ot->name = "Indent";
541  ot->description = "Add 4 spaces at line beginning";
542  ot->idname = "CONSOLE_OT_indent";
543 
544  /* api callbacks */
547 }
548 
552 {
554  ARegion *region = CTX_wm_region(C);
556  int spaces;
557  int len;
558 
559  for (spaces = 0; spaces < ci->len; spaces++) {
560  if (ci->line[spaces] != ' ') {
561  break;
562  }
563  }
564 
565  if (spaces == 0) {
566  return OPERATOR_CANCELLED;
567  }
568 
569  len = spaces % TAB_LENGTH;
570  if (len == 0) {
571  len = TAB_LENGTH;
572  }
573 
575 
576  memmove(ci->line, ci->line + len, (ci->len - len) + 1);
577  ci->len -= len;
578  BLI_assert(ci->len >= 0);
579 
582 
583  console_textview_update_rect(sc, region);
585 
586  console_scroll_bottom(region);
587 
588  return OPERATOR_FINISHED;
589 }
590 
592 {
593  /* identifiers */
594  ot->name = "Unindent";
595  ot->description = "Delete 4 spaces from line beginning";
596  ot->idname = "CONSOLE_OT_unindent";
597 
598  /* api callbacks */
601 }
602 
604  {DEL_NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""},
605  {DEL_PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
606  {DEL_NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
607  {DEL_PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
608  {0, NULL, 0, NULL, NULL},
609 };
610 
612 {
614  ARegion *region = CTX_wm_region(C);
616  int pos;
617  int stride;
618 
619  const short type = RNA_enum_get(op->ptr, "type");
620  bool done = false;
621 
622  if (ci->len == 0) {
623  return OPERATOR_CANCELLED;
624  }
625 
626  switch (type) {
627  case DEL_NEXT_CHAR:
628  case DEL_NEXT_WORD:
629  if (ci->cursor < ci->len) {
630  pos = ci->cursor;
632  ci->len,
633  &pos,
636  true);
637  stride = pos - ci->cursor;
638  if (stride) {
639  memmove(ci->line + ci->cursor,
640  ci->line + ci->cursor + stride,
641  (ci->len - (ci->cursor + stride)) + 1);
642  ci->len -= stride;
643  BLI_assert(ci->len >= 0);
644  done = true;
645  }
646  }
647  break;
648  case DEL_PREV_CHAR:
649  case DEL_PREV_WORD:
650  if (ci->cursor > 0) {
651  pos = ci->cursor;
653  ci->len,
654  &pos,
657  true);
658  stride = ci->cursor - pos;
659  if (stride) {
660  ci->cursor -= stride; /* same as above */
661  memmove(ci->line + ci->cursor,
662  ci->line + ci->cursor + stride,
663  (ci->len - (ci->cursor + stride)) + 1);
664  ci->len -= stride;
665  BLI_assert(ci->len >= 0);
666  done = true;
667  }
668  }
669  break;
670  }
671 
672  if (!done) {
673  return OPERATOR_CANCELLED;
674  }
675 
677 
678  console_textview_update_rect(sc, region);
680 
681  console_scroll_bottom(region);
682 
683  return OPERATOR_FINISHED;
684 }
685 
687 {
688  /* identifiers */
689  ot->name = "Delete";
690  ot->description = "Delete text by cursor position";
691  ot->idname = "CONSOLE_OT_delete";
692 
693  /* api callbacks */
696 
697  /* properties */
699  "type",
702  "Type",
703  "Which part of the text to delete");
704 }
705 
707 {
709  ARegion *region = CTX_wm_region(C);
711 
712  if (ci->len == 0) {
713  return OPERATOR_CANCELLED;
714  }
715 
716  console_history_add(sc, ci);
718  console_select_offset(sc, -ci->len);
719 
720  console_textview_update_rect(sc, region);
721 
723 
724  console_scroll_bottom(region);
725 
726  return OPERATOR_FINISHED;
727 }
728 
730 {
731  /* identifiers */
732  ot->name = "Clear Line";
733  ot->description = "Clear the line and store in history";
734  ot->idname = "CONSOLE_OT_clear_line";
735 
736  /* api callbacks */
739 }
740 
741 /* the python exec operator uses this */
743 {
745  ARegion *region = CTX_wm_region(C);
746 
747  const bool scrollback = RNA_boolean_get(op->ptr, "scrollback");
748  const bool history = RNA_boolean_get(op->ptr, "history");
749 
750  /*ConsoleLine *ci = */ console_history_verify(C);
751 
752  if (scrollback) { /* Last item in history. */
753  while (sc->scrollback.first) {
755  }
756  }
757 
758  if (history) {
759  while (sc->history.first) {
761  }
763  }
764 
765  console_textview_update_rect(sc, region);
767 
768  return OPERATOR_FINISHED;
769 }
770 
772 {
773  /* identifiers */
774  ot->name = "Clear All";
775  ot->description = "Clear text by type";
776  ot->idname = "CONSOLE_OT_clear";
777 
778  /* api callbacks */
781 
782  /* properties */
783  RNA_def_boolean(ot->srna, "scrollback", 1, "Scrollback", "Clear the scrollback history");
784  RNA_def_boolean(ot->srna, "history", 0, "History", "Clear the command history");
785 }
786 
787 /* the python exec operator uses this */
789 {
791  ARegion *region = CTX_wm_region(C);
792 
793  /* TODO - stupid, just prevents crashes when no command line */
795  const bool reverse = RNA_boolean_get(op->ptr, "reverse"); /* assumes down, reverse is up */
796  int prev_len = ci->len;
797 
798  /* keep a copy of the line above so when history is cycled
799  * this is the only function that needs to know about the double-up */
800  if (ci->prev) {
801  ConsoleLine *ci_prev = (ConsoleLine *)ci->prev;
802 
803  if (STREQ(ci->line, ci_prev->line)) {
804  console_history_free(sc, ci_prev);
805  }
806  }
807 
808  if (reverse) { /* last item in history */
809  ci = sc->history.last;
810  BLI_remlink(&sc->history, ci);
811  BLI_addhead(&sc->history, ci);
812  }
813  else {
814  ci = sc->history.first;
815  BLI_remlink(&sc->history, ci);
816  BLI_addtail(&sc->history, ci);
817  }
818 
819  { /* add a duplicate of the new arg and remove all other instances */
820  ConsoleLine *cl;
821  while ((cl = console_history_find(sc, ci->line, ci))) {
822  console_history_free(sc, cl);
823  }
824 
826  }
827 
828  ci = sc->history.last;
829  console_select_offset(sc, ci->len - prev_len);
830 
831  /* could be wrapped so update scroll rect */
832  console_textview_update_rect(sc, region);
834 
835  console_scroll_bottom(region);
836 
837  return OPERATOR_FINISHED;
838 }
839 
841 {
842  /* identifiers */
843  ot->name = "History Cycle";
844  ot->description = "Cycle through history";
845  ot->idname = "CONSOLE_OT_history_cycle";
846 
847  /* api callbacks */
850 
851  /* properties */
852  RNA_def_boolean(ot->srna, "reverse", 0, "Reverse", "Reverse cycle history");
853 }
854 
855 /* the python exec operator uses this */
857 {
859  ARegion *region = CTX_wm_region(C);
862  /* own this text in the new line, don't free */
863  char *str = RNA_string_get_alloc(op->ptr, "text", NULL, 0);
864  int cursor = RNA_int_get(op->ptr, "current_character");
865  const bool rem_dupes = RNA_boolean_get(op->ptr, "remove_duplicates");
866  int prev_len = ci->len;
867 
868  if (rem_dupes) {
869  ConsoleLine *cl;
870 
871  while ((cl = console_history_find(sc, ci->line, ci))) {
872  console_history_free(sc, cl);
873  }
874 
875  if (STREQ(str, ci->line)) {
876  MEM_freeN(str);
877  return OPERATOR_FINISHED;
878  }
879  }
880 
881  ci = console_history_add_str(sc, str, 1); /* own the string */
882  console_select_offset(sc, ci->len - prev_len);
883  console_line_cursor_set(ci, cursor);
884 
886 
887  /* when calling render modally this can be NULL when calling:
888  * bpy.ops.render.render('INVOKE_DEFAULT') */
889  if (region) {
890  console_scroll_bottom(region);
891  }
892 
893  return OPERATOR_FINISHED;
894 }
895 
897 {
898  /* identifiers */
899  ot->name = "History Append";
900  ot->description = "Append history at cursor position";
901  ot->idname = "CONSOLE_OT_history_append";
902 
903  /* api callbacks */
906 
907  /* properties */
908  RNA_def_string(ot->srna, "text", NULL, 0, "Text", "Text to insert at the cursor position");
909  RNA_def_int(
910  ot->srna, "current_character", 0, 0, INT_MAX, "Cursor", "The index of the cursor", 0, 10000);
912  "remove_duplicates",
913  0,
914  "Remove Duplicates",
915  "Remove duplicate items in the history");
916 }
917 
918 /* the python exec operator uses this */
920 {
922  ARegion *region = CTX_wm_region(C);
923  ConsoleLine *ci;
924 
925  /* own this text in the new line, don't free */
926  char *str = RNA_string_get_alloc(op->ptr, "text", NULL, 0);
927  int type = RNA_enum_get(op->ptr, "type");
928 
930 
931  ci = console_scrollback_add_str(sc, str, 1); /* own the string */
932  ci->type = type;
933 
935 
936  /* 'region' can be null depending on the operator that runs
937  * rendering with invoke default for eg causes this */
938  if (region) {
939  console_textview_update_rect(sc, region);
940  }
941 
943 
944  return OPERATOR_FINISHED;
945 }
946 
948 {
949  /* defined in DNA_space_types.h */
950  static const EnumPropertyItem console_line_type_items[] = {
951  {CONSOLE_LINE_OUTPUT, "OUTPUT", 0, "Output", ""},
952  {CONSOLE_LINE_INPUT, "INPUT", 0, "Input", ""},
953  {CONSOLE_LINE_INFO, "INFO", 0, "Information", ""},
954  {CONSOLE_LINE_ERROR, "ERROR", 0, "Error", ""},
955  {0, NULL, 0, NULL, NULL},
956  };
957 
958  /* identifiers */
959  ot->name = "Scrollback Append";
960  ot->description = "Append scrollback text by type";
961  ot->idname = "CONSOLE_OT_scrollback_append";
962 
963  /* api callbacks */
966 
967  /* properties */
968  RNA_def_string(ot->srna, "text", NULL, 0, "Text", "Text to insert at the cursor position");
970  "type",
971  console_line_type_items,
973  "Type",
974  "Console output type");
975 }
976 
978 {
980 
981  DynStr *buf_dyn;
982  char *buf_str;
983 
984  ConsoleLine *cl;
985  int sel[2];
986  int offset = 0;
987 
988  ConsoleLine cl_dummy = {NULL};
989 
990  if (sc->sel_start == sc->sel_end) {
991  return OPERATOR_CANCELLED;
992  }
993 
994  console_scrollback_prompt_begin(sc, &cl_dummy);
995 
996  for (cl = sc->scrollback.first; cl; cl = cl->next) {
997  offset += cl->len + 1;
998  }
999 
1000  if (offset == 0) {
1001  console_scrollback_prompt_end(sc, &cl_dummy);
1002  return OPERATOR_CANCELLED;
1003  }
1004 
1005  buf_dyn = BLI_dynstr_new();
1006  offset -= 1;
1007  sel[0] = offset - sc->sel_end;
1008  sel[1] = offset - sc->sel_start;
1009 
1010  for (cl = sc->scrollback.first; cl; cl = cl->next) {
1011  if (sel[0] <= cl->len && sel[1] >= 0) {
1012  int sta = max_ii(sel[0], 0);
1013  int end = min_ii(sel[1], cl->len);
1014 
1015  if (BLI_dynstr_get_len(buf_dyn)) {
1016  BLI_dynstr_append(buf_dyn, "\n");
1017  }
1018 
1019  BLI_dynstr_nappend(buf_dyn, cl->line + sta, end - sta);
1020  }
1021 
1022  sel[0] -= cl->len + 1;
1023  sel[1] -= cl->len + 1;
1024  }
1025 
1026  buf_str = BLI_dynstr_get_cstring(buf_dyn);
1027 
1028  BLI_dynstr_free(buf_dyn);
1029  WM_clipboard_text_set(buf_str, 0);
1030 
1031  MEM_freeN(buf_str);
1032 
1033  console_scrollback_prompt_end(sc, &cl_dummy);
1034 
1035  return OPERATOR_FINISHED;
1036 }
1037 
1039 {
1040  /* identifiers */
1041  ot->name = "Copy to Clipboard";
1042  ot->description = "Copy selected text to clipboard";
1043  ot->idname = "CONSOLE_OT_copy";
1044 
1045  /* api callbacks */
1048 
1049  /* properties */
1050 }
1051 
1053 {
1055  ARegion *region = CTX_wm_region(C);
1057  int buf_len;
1058 
1059  char *buf_str = WM_clipboard_text_get(false, &buf_len);
1060  char *buf_step, *buf_next;
1061 
1062  if (buf_str == NULL) {
1063  return OPERATOR_CANCELLED;
1064  }
1065 
1066  buf_step = buf_str;
1067 
1068  while ((buf_next = buf_step) && buf_next[0] != '\0') {
1069  buf_step = strchr(buf_next, '\n');
1070  if (buf_step) {
1071  *buf_step = '\0';
1072  buf_step++;
1073  }
1074 
1075  if (buf_next != buf_str) {
1076  WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, NULL);
1077  ci = console_history_verify(C);
1078  }
1079 
1080  console_select_offset(sc, console_line_insert(ci, buf_next));
1081  }
1082 
1083  MEM_freeN(buf_str);
1084 
1085  console_textview_update_rect(sc, region);
1087 
1088  console_scroll_bottom(region);
1089 
1090  return OPERATOR_FINISHED;
1091 }
1092 
1094 {
1095  /* identifiers */
1096  ot->name = "Paste from Clipboard";
1097  ot->description = "Paste text from clipboard";
1098  ot->idname = "CONSOLE_OT_paste";
1099 
1100  /* api callbacks */
1103 
1104  /* properties */
1105 }
1106 
1107 typedef struct SetConsoleCursor {
1108  int sel_old[2];
1111 
1112 /* TODO, cursor placement without selection */
1114  SpaceConsole *sc, ARegion *region, SetConsoleCursor *scu, const int mval[2], int UNUSED(sel))
1115 {
1116  int pos;
1117  pos = console_char_pick(sc, region, mval);
1118 
1119  if (scu->sel_init == INT_MAX) {
1120  scu->sel_init = pos;
1121  sc->sel_start = sc->sel_end = pos;
1122  return;
1123  }
1124 
1125  if (pos < scu->sel_init) {
1126  sc->sel_start = pos;
1127  sc->sel_end = scu->sel_init;
1128  }
1129  else if (pos > sc->sel_start) {
1130  sc->sel_start = scu->sel_init;
1131  sc->sel_end = pos;
1132  }
1133  else {
1134  sc->sel_start = sc->sel_end = pos;
1135  }
1136 }
1137 
1138 static void console_modal_select_apply(bContext *C, wmOperator *op, const wmEvent *event)
1139 {
1141  ARegion *region = CTX_wm_region(C);
1142  SetConsoleCursor *scu = op->customdata;
1143  int mval[2];
1144  int sel_prev[2];
1145 
1146  mval[0] = event->mval[0];
1147  mval[1] = event->mval[1];
1148 
1149  sel_prev[0] = sc->sel_start;
1150  sel_prev[1] = sc->sel_end;
1151 
1152  console_cursor_set_to_pos(sc, region, scu, mval, true);
1153 
1154  /* only redraw if the selection changed */
1155  if (sel_prev[0] != sc->sel_start || sel_prev[1] != sc->sel_end) {
1157  }
1158 }
1159 
1161 {
1162  // SpaceConsole *sc = CTX_wm_space_console(C);
1163  SetConsoleCursor *scu = op->customdata;
1164 
1165 #if 0
1166  if (txt_has_sel(text)) {
1167  buffer = txt_sel_to_buf(text);
1169  MEM_freeN(buffer);
1170  }
1171 #endif
1172 
1173  MEM_freeN(scu);
1174 }
1175 
1177 {
1179  // ARegion *region = CTX_wm_region(C);
1180  SetConsoleCursor *scu;
1181 
1182  op->customdata = MEM_callocN(sizeof(SetConsoleCursor), "SetConsoleCursor");
1183  scu = op->customdata;
1184 
1185  scu->sel_old[0] = sc->sel_start;
1186  scu->sel_old[1] = sc->sel_end;
1187 
1188  scu->sel_init = INT_MAX;
1189 
1191 
1192  console_modal_select_apply(C, op, event);
1193 
1194  return OPERATOR_RUNNING_MODAL;
1195 }
1196 
1197 static int console_modal_select(bContext *C, wmOperator *op, const wmEvent *event)
1198 {
1199  switch (event->type) {
1200  case LEFTMOUSE:
1201  case MIDDLEMOUSE:
1202  case RIGHTMOUSE:
1203  if (event->val == KM_RELEASE) {
1205  return OPERATOR_FINISHED;
1206  }
1207  break;
1208  case MOUSEMOVE:
1209  console_modal_select_apply(C, op, event);
1210  break;
1211  }
1212 
1213  return OPERATOR_RUNNING_MODAL;
1214 }
1215 
1217 {
1219 }
1220 
1222 {
1223  /* identifiers */
1224  ot->name = "Set Selection";
1225  ot->idname = "CONSOLE_OT_select_set";
1226  ot->description = "Set the console selection";
1227 
1228  /* api callbacks */
1233 }
1234 
1236 {
1238  ARegion *region = CTX_wm_region(C);
1239 
1240  ConsoleLine cl_dummy = {NULL};
1241  ConsoleLine *cl;
1242  int ret = OPERATOR_CANCELLED;
1243  int pos, offset, n;
1244 
1245  pos = console_char_pick(sc, region, event->mval);
1246 
1247  console_scrollback_prompt_begin(sc, &cl_dummy);
1248 
1249  if (console_line_column_from_index(sc, pos, &cl, &offset, &n)) {
1250  int sel[2] = {n, n};
1251 
1253 
1255 
1256  sel[0] = offset - sel[0];
1257  sel[1] = offset - sel[1];
1258 
1259  if ((sel[0] != sc->sel_start) || (sel[1] != sc->sel_end)) {
1260  sc->sel_start = sel[0];
1261  sc->sel_end = sel[1];
1264  }
1265  }
1266 
1267  console_scrollback_prompt_end(sc, &cl_dummy);
1268  return ret;
1269 }
1270 
1272 {
1273  /* identifiers */
1274  ot->name = "Select Word";
1275  ot->description = "Select word at cursor position";
1276  ot->idname = "CONSOLE_OT_select_word";
1277 
1278  /* api callbacks */
1281 }
typedef float(TangentPoint)[2]
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:714
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:725
struct SpaceConsole * CTX_wm_space_console(const bContext *C)
Definition: context.c:791
char * txt_sel_to_buf(struct Text *text, int *r_buf_strlen)
Definition: text.c:1555
bool txt_has_sel(struct Text *text)
Definition: text.c:1242
#define BLI_assert(a)
Definition: BLI_assert.h:58
A dynamically sized string ADT.
DynStr * BLI_dynstr_new(void) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition: BLI_dynstr.c:71
void BLI_dynstr_nappend(DynStr *__restrict ds, const char *cstr, int len) ATTR_NONNULL()
Definition: BLI_dynstr.c:133
int BLI_dynstr_get_len(DynStr *ds) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: BLI_dynstr.c:286
void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL()
Definition: BLI_dynstr.c:358
char * BLI_dynstr_get_cstring(DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: BLI_dynstr.c:323
void BLI_dynstr_append(DynStr *__restrict ds, const char *cstr) ATTR_NONNULL()
Definition: BLI_dynstr.c:107
void BLI_addhead(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:87
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:110
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:133
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
char * BLI_strdupn(const char *str, const size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: string.c:54
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
Definition: string.c:70
void BLI_str_cursor_step_utf8(const char *str, size_t maxlen, int *pos, eStrCursorJumpDirection direction, eStrCursorJumpType jump, bool use_init_step)
@ STRCUR_DIR_NEXT
@ STRCUR_DIR_PREV
@ STRCUR_JUMP_ALL
@ STRCUR_JUMP_NONE
@ STRCUR_JUMP_DELIM
int BLI_str_utf8_size_safe(const char *p) ATTR_NONNULL()
Definition: string_utf8.c:508
#define BLI_UTF8_MAX
size_t BLI_str_utf8_from_unicode(unsigned int c, char *outbuf)
Definition: string_utf8.c:641
#define UNUSED(x)
#define ELEM(...)
#define STREQ(a, b)
@ CONSOLE_LINE_INFO
@ CONSOLE_LINE_ERROR
@ CONSOLE_LINE_INPUT
@ CONSOLE_LINE_OUTPUT
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
@ OPERATOR_PASS_THROUGH
void ED_area_tag_redraw(ScrArea *area)
Definition: area.c:745
bool ED_operator_console_active(struct bContext *C)
Definition: screen_ops.c:344
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei stride
Read Guarded memory(de)allocation.
@ PROP_SKIP_SAVE
Definition: RNA_types.h:204
#define C
Definition: RandGen.cpp:39
void UI_view2d_totRect_set(struct View2D *v2d, int width, int height)
Definition: view2d.c:1052
@ WM_OP_INVOKE_DEFAULT
Definition: WM_types.h:197
@ WM_OP_EXEC_DEFAULT
Definition: WM_types.h:204
#define KM_RELEASE
Definition: WM_types.h:243
#define NEXT_CHAR(fmt)
unsigned int U
Definition: btGjkEpa3.h:78
void console_scrollback_prompt_end(SpaceConsole *sc, ConsoleLine *cl_dummy)
Definition: console_draw.c:84
int console_textview_height(SpaceConsole *sc, const ARegion *region)
Definition: console_draw.c:245
void console_scrollback_prompt_begin(SpaceConsole *sc, ConsoleLine *cl_dummy)
Definition: console_draw.c:70
int console_char_pick(SpaceConsole *sc, const ARegion *region, const int mval[2])
Definition: console_draw.c:251
static int console_selectword_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
Definition: console_ops.c:1235
static bool console_line_cursor_set(ConsoleLine *cl, int cursor)
Definition: console_ops.c:112
static int console_copy_exec(bContext *C, wmOperator *UNUSED(op))
Definition: console_ops.c:977
static int console_line_insert(ConsoleLine *ci, char *str)
Definition: console_ops.c:241
static void console_modal_select_apply(bContext *C, wmOperator *op, const wmEvent *event)
Definition: console_ops.c:1138
static void console_cursor_set_exit(bContext *UNUSED(C), wmOperator *op)
Definition: console_ops.c:1160
static void console_modal_select_cancel(bContext *C, wmOperator *op)
Definition: console_ops.c:1216
static void console_line_verify_length(ConsoleLine *ci, int len)
Definition: console_ops.c:226
static ConsoleLine * console_lb_add__internal(ListBase *lb, ConsoleLine *from)
Definition: console_ops.c:154
static int console_clear_line_exec(bContext *C, wmOperator *UNUSED(op))
Definition: console_ops.c:706
ConsoleLine * console_history_add_str(SpaceConsole *sc, char *str, bool own)
Definition: console_ops.c:204
static int console_indent_or_autocomplete_exec(bContext *C, wmOperator *UNUSED(op))
Definition: console_ops.c:470
static void console_cursor_set_to_pos(SpaceConsole *sc, ARegion *region, SetConsoleCursor *scu, const int mval[2], int UNUSED(sel))
Definition: console_ops.c:1113
static int console_unindent_exec(bContext *C, wmOperator *UNUSED(op))
Definition: console_ops.c:551
void CONSOLE_OT_copy(wmOperatorType *ot)
Definition: console_ops.c:1038
void CONSOLE_OT_clear(wmOperatorType *ot)
Definition: console_ops.c:771
static const EnumPropertyItem console_move_type_items[]
Definition: console_ops.c:300
static const EnumPropertyItem console_delete_type_items[]
Definition: console_ops.c:603
static bool console_line_column_from_index(SpaceConsole *sc, const int pos, ConsoleLine **r_cl, int *r_cl_offset, int *r_col)
Definition: console_ops.c:270
void console_textview_update_rect(SpaceConsole *sc, ARegion *region)
Definition: console_ops.c:59
#define TAB_LENGTH
Definition: console_ops.c:381
void CONSOLE_OT_select_word(wmOperatorType *ot)
Definition: console_ops.c:1271
void CONSOLE_OT_delete(wmOperatorType *ot)
Definition: console_ops.c:686
void CONSOLE_OT_indent(wmOperatorType *ot)
Definition: console_ops.c:537
void CONSOLE_OT_select_set(wmOperatorType *ot)
Definition: console_ops.c:1221
static int console_history_append_exec(bContext *C, wmOperator *op)
Definition: console_ops.c:856
static void console_scrollback_limit(SpaceConsole *sc)
Definition: console_ops.c:85
static int console_history_cycle_exec(bContext *C, wmOperator *op)
Definition: console_ops.c:788
static int console_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: console_ops.c:416
struct SetConsoleCursor SetConsoleCursor
static int console_scrollback_append_exec(bContext *C, wmOperator *op)
Definition: console_ops.c:919
static int console_move_exec(bContext *C, wmOperator *op)
Definition: console_ops.c:310
void CONSOLE_OT_indent_or_autocomplete(wmOperatorType *ot)
Definition: console_ops.c:483
void CONSOLE_OT_move(wmOperatorType *ot)
Definition: console_ops.c:365
static int console_modal_select(bContext *C, wmOperator *op, const wmEvent *event)
Definition: console_ops.c:1197
static void console_scroll_bottom(ARegion *region)
Definition: console_ops.c:52
void console_history_free(SpaceConsole *sc, ConsoleLine *cl)
Definition: console_ops.c:72
void console_scrollback_free(SpaceConsole *sc, ConsoleLine *cl)
Definition: console_ops.c:78
void CONSOLE_OT_clear_line(wmOperatorType *ot)
Definition: console_ops.c:729
static int console_insert_exec(bContext *C, wmOperator *op)
Definition: console_ops.c:382
void CONSOLE_OT_scrollback_append(wmOperatorType *ot)
Definition: console_ops.c:947
static int console_paste_exec(bContext *C, wmOperator *UNUSED(op))
Definition: console_ops.c:1052
void CONSOLE_OT_insert(wmOperatorType *ot)
Definition: console_ops.c:446
ConsoleLine * console_scrollback_add_str(SpaceConsole *sc, char *str, bool own)
Definition: console_ops.c:208
static ConsoleLine * console_lb_add_str__internal(ListBase *lb, char *str, bool own)
Definition: console_ops.c:189
void CONSOLE_OT_history_cycle(wmOperatorType *ot)
Definition: console_ops.c:840
void CONSOLE_OT_unindent(wmOperatorType *ot)
Definition: console_ops.c:591
static int console_delete_exec(bContext *C, wmOperator *op)
Definition: console_ops.c:611
void CONSOLE_OT_history_append(wmOperatorType *ot)
Definition: console_ops.c:896
static ConsoleLine * console_history_add(SpaceConsole *sc, ConsoleLine *from)
Definition: console_ops.c:175
static int console_clear_exec(bContext *C, wmOperator *op)
Definition: console_ops.c:742
void CONSOLE_OT_paste(wmOperatorType *ot)
Definition: console_ops.c:1093
static int console_modal_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: console_ops.c:1176
ConsoleLine * console_history_verify(const bContext *C)
Definition: console_ops.c:215
static int console_indent_exec(bContext *C, wmOperator *UNUSED(op))
Definition: console_ops.c:504
static ConsoleLine * console_history_find(SpaceConsole *sc, const char *str, ConsoleLine *cl_ignore)
Definition: console_ops.c:94
static void console_select_offset(SpaceConsole *sc, const int offset)
Definition: console_ops.c:66
@ DEL_PREV_WORD
Definition: curve_intern.h:39
@ DEL_PREV_CHAR
Definition: curve_intern.h:37
@ DEL_NEXT_WORD
Definition: curve_intern.h:38
@ DEL_NEXT_CHAR
Definition: curve_intern.h:36
@ LINE_BEGIN
Definition: curve_intern.h:46
@ PREV_WORD
Definition: curve_intern.h:50
@ PREV_CHAR
Definition: curve_intern.h:48
@ LINE_END
Definition: curve_intern.h:47
@ NEXT_WORD
Definition: curve_intern.h:51
StackEntry * from
#define str(s)
uint pos
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_recallocN_id)(void *vmemh, size_t len, const char *str)
Definition: mallocn.c:44
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
static void area(int d1, int d2, int e1, int e2, float weights[2])
return ret
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
Definition: rna_access.c:6550
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6308
int RNA_string_length(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6539
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6261
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6402
char * RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen)
Definition: rna_access.c:6527
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3481
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3675
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1512
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3585
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3771
struct ConsoleLine * next
struct ConsoleLine * prev
void * last
Definition: DNA_listBase.h:47
void * first
Definition: DNA_listBase.h:47
ListBase scrollback
short winy
float ymax
Definition: DNA_vec_types.h:86
float ymin
Definition: DNA_vec_types.h:86
short ctrl
Definition: WM_types.h:618
short val
Definition: WM_types.h:579
short oskey
Definition: WM_types.h:618
char utf8_buf[6]
Definition: WM_types.h:589
int mval[2]
Definition: WM_types.h:583
short type
Definition: WM_types.h:577
char ascii
Definition: WM_types.h:591
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:752
const char * name
Definition: WM_types.h:721
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:768
const char * idname
Definition: WM_types.h:723
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:776
void(* cancel)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:760
struct StructRNA * srna
Definition: WM_types.h:802
const char * description
Definition: WM_types.h:726
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:736
struct PointerRNA * ptr
uint len
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
int WM_operator_name_call(bContext *C, const char *opstring, short context, PointerRNA *properties)
@ RIGHTMOUSE
@ MOUSEMOVE
@ LEFTMOUSE
@ MIDDLEMOUSE
wmOperatorType * ot
Definition: wm_files.c:3156
void WM_clipboard_text_set(const char *buf, bool selection)
Definition: wm_window.c:1778
char * WM_clipboard_text_get(bool selection, int *r_len)
Definition: wm_window.c:1765