OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
editview.c
Go to the documentation of this file.
1 /*
2  * mape - C4 Landscape.txt editor
3  *
4  * Copyright (c) 2005-2009, Armin Burgmeier
5  *
6  * Distributed under the terms of the ISC license; see accompanying file
7  * "COPYING" for details.
8  *
9  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
10  * See accompanying file "TRADEMARK" for details.
11  *
12  * To redistribute this file separately, substitute the full license texts
13  * for the above references.
14  */
15 
16 #include <stdlib.h>
17 #include <gtksourceview/gtksourceview.h>
18 #include <gtksourceview/gtksourcebuffer.h>
19 #include "mape/mapgen.h"
20 #include "mape/random.h"
21 #include "mape/preferences.h"
22 #include "mape/mattexview.h"
23 #include "mape/editview.h"
24 #include "mape/statusbar.h"
25 #include "mape/preview.h"
26 
27 typedef struct _ThreadData ThreadData;
28 struct _ThreadData {
30  gchar* source;
32  gchar* file_path;
35  guint map_width;
36  guint map_height;
37  gdouble map_zoom;
38  gint64 start_time;
39 };
40 
41 typedef struct _ThreadResult ThreadResult;
42 struct _ThreadResult {
44  GdkPixbuf* pixbuf;
45  GError* error;
46  guint idle_id;
47  gint64 start_time;
48 };
49 
50 static void mape_edit_view_set_filename(MapeEditView* view,
51  const gchar* filename)
52 {
53  MapeMapgenType new_type;
54  GtkSourceBuffer* buf;
55 
56  gchar* basename;
57  gchar* utf8_file;
58  gchar* utf8_file_casefold;
59  gchar* utf8_landscape_txt_casefold;
60 
61  const gchar* lang_name;
62  const gchar* lang_filename;
63  GtkSourceLanguage* lang;
64  GtkSourceStyleScheme* style;
65  GtkWidget* error_dialog;
66 
67  buf = GTK_SOURCE_BUFFER(
68  gtk_text_view_get_buffer(GTK_TEXT_VIEW(view->view) )
69  );
70 
71  if (view->file_path != filename)
72  {
73  if(filename != NULL)
74  {
75  view->file_path = g_strdup(filename);
76  }
77  else
78  {
79  view->file_path = NULL;
80  }
81  }
82 
83  if(filename != NULL)
84  {
85  basename = g_path_get_basename(filename);
86 
87  /* Determine document type */
88  utf8_file = g_filename_to_utf8(
89  basename,
90  -1,
91  NULL,
92  NULL,
93  NULL
94  );
95 
96  g_free(basename);
97 
98  if(utf8_file != NULL)
99  {
100  utf8_file_casefold = g_utf8_casefold(utf8_file, -1);
101  utf8_landscape_txt_casefold = g_utf8_casefold("landscape.txt", -1);
102  g_free(utf8_file);
103 
104  if(g_utf8_collate(utf8_file_casefold, utf8_landscape_txt_casefold) == 0)
105  new_type = MAPE_MAPGEN_LANDSCAPE_TXT;
106  else
107  new_type = MAPE_MAPGEN_MAP_C;
108  g_free(utf8_file_casefold);
109  g_free(utf8_landscape_txt_casefold);
110  }
111  }
112  else
113  {
114  new_type = MAPE_MAPGEN_MAP_C;
115  }
116 
117  if(new_type != view->type)
118  {
119  view->type = new_type;
120  switch(view->type)
121  {
123  lang_name = "c4landscape";
124  lang_filename = "Landscape.txt";
125  break;
126  case MAPE_MAPGEN_MAP_C:
127  lang_name = "c4mapscript";
128  lang_filename = "Map.c";
129  break;
130  default:
131  lang_name = NULL;
132  g_assert_not_reached();
133  break;
134  }
135 
136  /* Set language according to document type */
137  lang = gtk_source_language_manager_get_language(
138  view->lang_manager,
139  lang_name
140  );
141 
142  style = gtk_source_style_scheme_manager_get_scheme(
143  view->style_manager,
144  "mape"
145  );
146 
147  if(lang == NULL || style == NULL)
148  {
149  /* TODO: Show location where we search in */
150  error_dialog = gtk_message_dialog_new(
151  NULL,
152  GTK_DIALOG_MODAL,
153  GTK_MESSAGE_ERROR,
154  GTK_BUTTONS_OK,
155  "Syntax Highlighting Not Available"
156  );
157 
158  gtk_message_dialog_format_secondary_text(
159  GTK_MESSAGE_DIALOG(error_dialog),
160  "The syntax highlighting file for %s files "
161  "could not be located. Perhaps mape has not "
162  "been properly installed. Syntax "
163  "highlighting is disabled.",
164  lang_filename
165  );
166 
167  gtk_window_set_title(GTK_WINDOW(error_dialog), "Mape");
168 
169  gtk_dialog_run(GTK_DIALOG(error_dialog) );
170  gtk_widget_destroy(error_dialog);
171  }
172  else
173  {
174  gtk_source_buffer_set_language(buf, lang);
175  gtk_source_buffer_set_style_scheme(buf, style);
176  }
177  }
178 }
179 
180 static void
181 mape_edit_view_thread_result_destroy_func(gpointer data)
182 {
183  ThreadResult* result = (ThreadResult*)data;
184  if(result->pixbuf != NULL) g_object_unref(G_OBJECT(result->pixbuf));
185  if(result->error != NULL) g_error_free(result->error);
186  /* Don't need to g_source_remove(result->idle_id) since this is
187  * only called when the idle handler is removed anyway. */
188 }
189 
190 static void mape_edit_view_cb_changed(GtkTextBuffer* buffer,
191  gpointer user_data)
192 {
193  mape_edit_view_reload((MapeEditView*)user_data);
194 }
195 
196 static void mape_edit_view_cb_update(GtkWidget* widget,
197  GdkEvent* event,
198  gpointer user_data)
199 {
200  mape_edit_view_reload((MapeEditView*)user_data);
201 }
202 
203 static GdkPixbuf* mape_edit_view_render_map(const gchar* source,
204  MapeMapgenType type,
205  const gchar* file_path,
206  MapeMaterialMap* mat_map,
207  MapeTextureMap* tex_map,
208  guint map_width,
209  guint map_height,
210  gdouble map_zoom,
211  GError** error)
212 {
213  GdkPixbuf* pixbuf;
214  gchar* basename;
215  gchar* dirname;
216  gchar* scriptname;
217  const gchar* filename;
218 
219  guint zoom_width;
220  guint zoom_height;
221  GdkPixbuf* zoombuf;
222 
223  if(mat_map == NULL || tex_map == NULL)
224  {
225  g_set_error(
226  error,
227  g_quark_from_static_string("MAPE_EDIT_VIEW_ERROR"),
229  "Material.ocg is not loaded"
230  );
231 
232  return NULL;
233  }
234 
235  if(file_path != NULL)
236  {
237  basename = g_path_get_basename(file_path);
238  filename = basename;
239 
240  dirname = g_path_get_dirname(file_path);
241  scriptname = g_build_filename(dirname, "Script.c", NULL);
242  g_free(dirname);
243  }
244  else
245  {
246  basename = NULL;
247  scriptname = NULL;
248  switch(type)
249  {
251  filename = "Landscape.txt";
252  break;
253  case MAPE_MAPGEN_MAP_C:
254  filename = "Map.c";
255  break;
256  default:
257  filename = NULL;
258  g_assert_not_reached();
259  break;
260  }
261  }
262 
263  pixbuf = mape_mapgen_render(
264  filename,
265  source,
266  type,
267  scriptname,
268  mat_map,
269  tex_map,
270  map_width,
271  map_height,
272  error
273  );
274 
275  /* Zoom image to output size */
276  if(pixbuf != NULL)
277  {
278  map_width = gdk_pixbuf_get_width(pixbuf);
279  map_height = gdk_pixbuf_get_height(pixbuf);
280 
281  zoom_width = (guint)(map_width * map_zoom + 0.5);
282  zoom_height = (guint)(map_height * map_zoom + 0.5);
283  if(map_width != zoom_width || map_height != zoom_height)
284  {
285  zoombuf = gdk_pixbuf_scale_simple(
286  pixbuf,
287  zoom_width,
288  zoom_height,
289  GDK_INTERP_BILINEAR
290  );
291 
292  g_object_unref(pixbuf);
293  pixbuf = zoombuf;
294  }
295  }
296 
297  g_free(basename);
298  return pixbuf;
299 }
300 
301 static gboolean
302 mape_edit_view_thread_result(gpointer data_)
303 {
304  ThreadResult* result;
305  MapeEditView* view;
306 
307  gint64 now;
308  gchar* time_text;
309 
310  result = (ThreadResult*)data_;
311  view = result->view;
312 
313  if(result->pixbuf == NULL)
314  {
315  g_assert(result->error != NULL);
316 
318  view->statusbar,
319  result->error->message
320  );
321  }
322  else
323  {
324  now = g_get_monotonic_time();
325  g_assert(now >= result->start_time);
326 
327  time_text = g_strdup_printf(
328  "Landscape rendered successfully (%.2fs)",
329  (now - result->start_time) / 1000000.
330  );
331 
332  mape_statusbar_set_compile(view->statusbar, time_text);
333  g_free(time_text);
334  }
335 
336  mape_pre_view_update(view->pre_view, result->pixbuf);
337 
338  /* Finish thread */
339  g_thread_join(view->render_thread);
340  view->render_thread = NULL;
341 
342  /* Do we have to render again (someone changed
343  the source while rendering)? */
344  if(view->rerender == TRUE)
345  mape_edit_view_reload(view);
346 
347  return FALSE;
348 }
349 
350 static gpointer mape_edit_view_thread_entry(gpointer data_)
351 {
352  ThreadData* data;
353  ThreadResult* result;
354  GError* error = NULL;
355  GdkPixbuf* res_buf;
356 
357  data = (ThreadData*)data_;
358 
359  res_buf = mape_edit_view_render_map(
360  data->source,
361  data->type,
362  data->file_path,
363  data->mat_map,
364  data->tex_map,
365  data->map_width,
366  data->map_height,
367  data->map_zoom,
368  &error
369  );
370 
371  result = g_slice_new(ThreadResult);
372  result->view = data->view;
373  result->pixbuf = res_buf;
374  result->error = error;
375  result->start_time = data->start_time;
376 
377  g_free(data->source);
378  g_free(data->file_path);
379  g_slice_free(ThreadData, data);
380 
381  result->idle_id = g_idle_add_full(
382  G_PRIORITY_DEFAULT_IDLE,
383  mape_edit_view_thread_result,
384  result,
385  mape_edit_view_thread_result_destroy_func
386  );
387 
388  /* Note that you can only use this securly with g_thread_join,
389  * otherwise the idle handler might already have been run */
390  return result;
391 }
392 
394  MapeStatusbar* statusbar,
395  GError** error)
396 {
397  MapeEditView* view;
398  GtkSourceBuffer* buf;
399  GPtrArray* search_dirs;
400  const gchar* const* data_dirs;
401  const gchar* const* dir;
402 
403  view = malloc(sizeof(MapeEditView) );
404  view->pre_view = pre_view;
405  view->statusbar = statusbar;
406  view->file_path = NULL;
407  view->encoding = "UTF-8";
408  view->type = MAPE_MAPGEN_NONE;
409  view->render_thread = NULL;
410  view->rerender = FALSE;
411  view->fixed_seed = FALSE;
412 
413  view->view = gtk_source_view_new();
414  buf = GTK_SOURCE_BUFFER(
415  gtk_text_view_get_buffer(GTK_TEXT_VIEW(view->view) )
416  );
417 
418  g_signal_connect_after(
419  G_OBJECT(buf),
420  "changed",
421  G_CALLBACK(mape_edit_view_cb_changed),
422  view
423  );
424 
425  g_signal_connect(
426  G_OBJECT(pre_view->event_box),
427  "button-press-event",
428  G_CALLBACK(mape_edit_view_cb_update),
429  view
430  );
431 
432  view->font_desc = pango_font_description_new();
433  pango_font_description_set_family(view->font_desc, "monospace");
434  gtk_widget_modify_font(view->view, view->font_desc);
435 
436  search_dirs = g_ptr_array_new();
437 #ifdef G_OS_WIN32
438  g_ptr_array_add(
439  search_dirs,
440  g_win32_get_package_installation_subdirectory(NULL, NULL, "mape-syntax")
441  );
442 #endif
443 
444  g_ptr_array_add(
445  search_dirs,
446  g_build_filename(g_get_home_dir(), ".mape-syntax", NULL)
447  );
448 
449  g_ptr_array_add(
450  search_dirs,
451  g_strdup("./mape-syntax")
452  );
453 
454  g_ptr_array_add(
455  search_dirs,
456  g_strdup("./src/mape/mape-syntax")
457  );
458 
459  data_dirs = g_get_system_data_dirs();
460  for(dir = data_dirs; *dir != NULL; ++ dir)
461  g_ptr_array_add(search_dirs, g_build_filename(*dir, "mape", NULL));
462  g_ptr_array_add(search_dirs, NULL);
463 
464  view->lang_manager = gtk_source_language_manager_new();
465  gtk_source_language_manager_set_search_path(
466  view->lang_manager,
467  (gchar**)search_dirs->pdata
468  );
469 
470  view->style_manager = gtk_source_style_scheme_manager_new();
471  gtk_source_style_scheme_manager_set_search_path(
472  view->style_manager,
473  (gchar**)search_dirs->pdata
474  );
475 
476  g_ptr_array_foreach(search_dirs, (GFunc)g_free, NULL);
477  g_ptr_array_free(search_dirs, TRUE);
478 
479  mape_edit_view_set_filename(view, NULL);
480 
481  gtk_widget_show(view->view);
482 
483  view->window = gtk_scrolled_window_new(NULL, NULL);
484 
485  gtk_scrolled_window_set_policy(
486  GTK_SCROLLED_WINDOW(view->window),
487  GTK_POLICY_AUTOMATIC,
488  GTK_POLICY_AUTOMATIC
489  );
490 
491  gtk_scrolled_window_set_shadow_type(
492  GTK_SCROLLED_WINDOW(view->window),
493  GTK_SHADOW_IN
494  );
495 
496  gtk_container_add(
497  GTK_CONTAINER(view->window),
498  view->view
499  );
500 
501  gtk_widget_show(view->window);
502  return view;
503 }
504 
506 {
507  gpointer data;
508 
509  /* Wait for render thread to finish */
510  if(view->render_thread != NULL)
511  {
512  data = g_thread_join(view->render_thread);
513  view->render_thread = NULL;
514 
515  /* Don't let idle handler run since edit_view is about to be destroyed */
516  g_assert(((ThreadResult*)data)->idle_id != 0);
517  g_source_remove(((ThreadResult*)data)->idle_id);
518  }
519 
520  g_object_unref(G_OBJECT(view->lang_manager) );
521  g_object_unref(G_OBJECT(view->style_manager));
522  g_free(view->file_path);
523  free(view);
524 }
525 
527 {
528  g_free(view->file_path);
529  view->file_path = NULL;
530 
531  /* TODO: Undoable action dingsen */
532  /* (statische mape_edit_view_set_contents-Call?) */
533  gtk_text_buffer_set_text(
534  gtk_text_view_get_buffer(GTK_TEXT_VIEW(view->view)),
535  "",
536  0
537  );
538 
539  gtk_text_buffer_set_modified(
540  gtk_text_view_get_buffer(GTK_TEXT_VIEW(view->view)),
541  FALSE
542  );
543 }
544 
546  const gchar* filename,
547  GError** error)
548 {
549  gboolean result;
550  gchar* contents;
551  gchar* conv;
552  gchar* utf8_file;
553  gsize length;
554 
555  result = g_file_get_contents(filename, &contents, &length, error);
556  if(result == FALSE) return FALSE;
557 
558  /* Assume UTF-8 */
559  result = g_utf8_validate(contents, length, NULL);
560 
561  if(result == FALSE)
562  {
563  /* No UTF-8, try LATIN1 */
564  conv = g_convert(
565  contents,
566  -1,
567  "UTF-8",
568  "LATIN1",
569  NULL,
570  NULL,
571  NULL
572  );
573 
574  g_free(contents);
575  if(conv == NULL)
576  {
577  utf8_file = g_filename_to_utf8(
578  filename,
579  -1,
580  NULL,
581  NULL,
582  NULL
583  );
584 
585  if(utf8_file == NULL)
586  utf8_file = g_strdup("<unknown file name>");
587 
588  g_set_error(
589  error,
590  g_quark_from_static_string(
591  "MAPE_EDIT_VIEW_ERROR"
592  ),
594  "Could not read file %s: Either the encoding "
595  "is unknown or it is a binary file",
596  utf8_file
597  );
598 
599  g_free(utf8_file);
600  return FALSE;
601  }
602 
603  /* Conversion succeeded */
604  contents = conv;
605  view->encoding = "LATIN1";
606  }
607  else
608  {
609  view->encoding = "UTF-8";
610  }
611 
612  mape_edit_view_set_filename(view, filename);
613 
614  /* TODO: Undoable action dingsen */
615  /* (statische mape_edit_view_set_contents-Call?) */
616  gtk_text_buffer_set_text(
617  gtk_text_view_get_buffer(GTK_TEXT_VIEW(view->view)),
618  contents,
619  length
620  );
621 
622  g_free(contents);
623 
624  gtk_text_buffer_set_modified(
625  gtk_text_view_get_buffer(GTK_TEXT_VIEW(view->view)),
626  FALSE
627  );
628 
629  return TRUE;
630 }
631 
633  const gchar* filename,
634  GError** error)
635 {
636  GtkTextBuffer* buffer;
637  GtkTextIter begin;
638  GtkTextIter end;
639  gchar* source;
640  gchar* conv;
641  gboolean result;
642 
643  buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view->view) );
644  gtk_text_buffer_get_start_iter(buffer, &begin);
645  gtk_text_buffer_get_end_iter(buffer, &end);
646  source = gtk_text_buffer_get_text(buffer, &begin, &end, TRUE);
647 
648  conv = g_convert(
649  source,
650  -1,
651  view->encoding,
652  "UTF-8",
653  NULL,
654  NULL,
655  error
656  );
657 
658  g_free(source);
659  if(conv == NULL) return FALSE;
660 
661  result = g_file_set_contents(filename, conv, -1, error);
662  g_free(conv);
663  if(result == FALSE) return FALSE;
664 
665  gtk_text_buffer_set_modified(
666  gtk_text_view_get_buffer(GTK_TEXT_VIEW(view->view)),
667  FALSE
668  );
669 
670  mape_edit_view_set_filename(view, filename);
671 
672  /* Rerender with new file path --
673  * different Script.c lookup for algo=script overlays */
674  mape_edit_view_reload(view);
675 
676  return TRUE;
677 }
678 
680 {
681  return gtk_text_buffer_get_modified(
682  gtk_text_view_get_buffer(GTK_TEXT_VIEW(view->view))
683  );
684 }
685 
687 {
688  gtk_source_buffer_undo(
689  GTK_SOURCE_BUFFER(
690  gtk_text_view_get_buffer(GTK_TEXT_VIEW(edit_view->view))
691  )
692  );
693 }
694 
696 {
697  gtk_source_buffer_redo(
698  GTK_SOURCE_BUFFER(
699  gtk_text_view_get_buffer(GTK_TEXT_VIEW(edit_view->view))
700  )
701  );
702 }
703 
705  MapePreferences* preferences)
706 {
707  GtkSourceView* view;
708  GtkSourceBuffer* buffer;
709  GtkWrapMode wrap_mode;
710 
711  view = GTK_SOURCE_VIEW(edit_view->view);
712  buffer = GTK_SOURCE_BUFFER(
713  gtk_text_view_get_buffer(GTK_TEXT_VIEW(view))
714  );
715 
716  gtk_source_view_set_tab_width(
717  view,
718  preferences->tab_width
719  );
720 
721  gtk_source_view_set_insert_spaces_instead_of_tabs(
722  view,
723  preferences->tab_to_spaces
724  );
725 
726  gtk_source_view_set_auto_indent(
727  view,
728  preferences->auto_indentation
729  );
730 
731  wrap_mode = GTK_WRAP_CHAR;
732  if(preferences->text_wrapping == FALSE)
733  wrap_mode = GTK_WRAP_NONE;
734  gtk_text_view_set_wrap_mode(
735  GTK_TEXT_VIEW(view),
736  wrap_mode
737  );
738 
739  gtk_source_view_set_show_line_numbers(
740  view,
741  preferences->line_numbers
742  );
743 
744  gtk_source_view_set_highlight_current_line(
745  view,
746  preferences->highlight_line
747  );
748 
749  gtk_source_buffer_set_highlight_matching_brackets(
750  buffer,
751  preferences->bracket_matching
752  );
753 
754  edit_view->fixed_seed = preferences->fixed_seed;
755  edit_view->random_seed = preferences->random_seed;
756  edit_view->map_width = preferences->map_width;
757  edit_view->map_height = preferences->map_height;
758  edit_view->map_zoom = preferences->map_zoom;
759 
760  /* Rerender with new random settings */
761  mape_edit_view_reload(edit_view);
762 }
763 
765 {
766  GError* error = NULL;
767  ThreadData* data;
768  GtkTextBuffer* buffer;
769  GtkTextIter begin;
770  GtkTextIter end;
771 
772  if(edit_view->render_thread == NULL)
773  {
774  data = g_slice_new(ThreadData);
775 
776  buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(edit_view->view) );
777  gtk_text_buffer_get_start_iter(buffer, &begin);
778  gtk_text_buffer_get_end_iter(buffer, &end);
779 
780  /* TODO: We need to ref view so that it is guaranteed to be alive in the
781  * thread result handler */
782  data->view = edit_view;
783  data->source = gtk_text_buffer_get_text(buffer, &begin, &end, TRUE);
784  data->type = edit_view->type;
785  data->file_path = g_strdup(edit_view->file_path);
786 
787  /* TODO: We need to ref these so noone can delete them while the thread
788  * uses them. */
789  data->mat_map = edit_view->pre_view->mat_tex->mat_map,
790  data->tex_map = edit_view->pre_view->mat_tex->tex_map,
791 
792  data->map_width = edit_view->map_width;
793  data->map_height = edit_view->map_height;
794  data->map_zoom = edit_view->map_zoom;
795  data->start_time = g_get_monotonic_time();
796 
797  if(edit_view->fixed_seed == TRUE)
798  mape_random_seed(edit_view->random_seed);
799 
801  edit_view->statusbar,
802  "Rendering map..."
803  );
804 
805  edit_view->rerender = FALSE;
806 
807  edit_view->render_thread = g_thread_create(
808  mape_edit_view_thread_entry,
809  data,
810  TRUE,
811  &error
812  );
813 
814  if(edit_view->render_thread == NULL)
815  {
817  edit_view->statusbar,
818  error->message
819  );
820 
821  g_free(data->source);
822  g_slice_free(ThreadData, data);
823 
824  g_error_free(error);
825  }
826  }
827  else
828  {
829  /* Rerender when thread finished */
830  edit_view->rerender = TRUE;
831  }
832 }
833 
enum _MapeMapgenType MapeMapgenType
MapeEditView * view
Definition: editview.c:43
unsigned int map_width
Definition: editview.h:48
gboolean line_numbers
Definition: preferences.h:27
guint map_height
Definition: editview.c:36
gboolean mape_edit_view_get_modified(MapeEditView *view)
Definition: editview.c:679
MapeMapgenType type
Definition: editview.h:36
unsigned int tab_width
Definition: preferences.h:23
gboolean highlight_line
Definition: preferences.h:28
gchar * file_path
Definition: editview.c:32
gint64 start_time
Definition: editview.c:47
double map_zoom
Definition: editview.h:50
gboolean tab_to_spaces
Definition: preferences.h:24
MapeTextureMap * tex_map
Definition: mattexview.h:33
GThread * render_thread
Definition: editview.h:52
PangoFontDescription * font_desc
Definition: editview.h:40
guint map_width
Definition: editview.c:35
void mape_edit_view_reload(MapeEditView *edit_view)
Definition: editview.c:764
GdkPixbuf * mape_mapgen_render(const gchar *filename, const gchar *source, MapeMapgenType type, const gchar *script_path, MapeMaterialMap *material_map, MapeTextureMap *texture_map, guint width, guint height, GError **error)
Definition: mapgen.c:227
GtkWidget * window
Definition: editview.h:32
gboolean mape_edit_view_save(MapeEditView *view, const gchar *filename, GError **error)
Definition: editview.c:632
MapeTextureMap * tex_map
Definition: editview.c:34
unsigned int map_height
Definition: editview.h:49
GError * error
Definition: editview.c:45
guint idle_id
Definition: editview.c:46
void mape_edit_view_undo(MapeEditView *edit_view)
Definition: editview.c:686
MapeEditView * mape_edit_view_new(MapePreView *pre_view, MapeStatusbar *statusbar, GError **error)
Definition: editview.c:393
MapeMatTexView * mat_tex
Definition: preview.h:34
void mape_edit_view_apply_preferences(MapeEditView *edit_view, MapePreferences *preferences)
Definition: editview.c:704
void mape_edit_view_redo(MapeEditView *edit_view)
Definition: editview.c:695
void mape_statusbar_set_compile(MapeStatusbar *bar, const gchar *text)
Definition: statusbar.c:47
gboolean auto_indentation
Definition: preferences.h:25
GtkWidget * view
Definition: editview.h:33
MapeMaterialMap * mat_map
Definition: mattexview.h:32
gboolean fixed_seed
Definition: editview.h:45
gboolean rerender
Definition: editview.h:53
gdouble map_zoom
Definition: editview.c:37
gboolean mape_edit_view_open(MapeEditView *view, const gchar *filename, GError **error)
Definition: editview.c:545
gint64 start_time
Definition: editview.c:38
const gchar * encoding
Definition: editview.h:35
void mape_pre_view_update(MapePreView *view, GdkPixbuf *pixbuf)
Definition: preview.c:52
MapeEditView * view
Definition: editview.c:29
gchar * file_path
Definition: editview.h:34
gboolean text_wrapping
Definition: preferences.h:26
unsigned int random_seed
Definition: preferences.h:31
MapeMaterialMap * mat_map
Definition: editview.c:33
MapeMapgenType type
Definition: editview.c:31
GtkSourceLanguageManager * lang_manager
Definition: editview.h:38
MapeStatusbar * statusbar
Definition: editview.h:43
gboolean bracket_matching
Definition: preferences.h:29
void mape_edit_view_clear(MapeEditView *view)
Definition: editview.c:526
void mape_random_seed(unsigned int seed)
Definition: random.c:42
void mape_edit_view_destroy(MapeEditView *view)
Definition: editview.c:505
unsigned int map_width
Definition: preferences.h:32
unsigned int random_seed
Definition: editview.h:46
gboolean fixed_seed
Definition: preferences.h:30
MapePreView * pre_view
Definition: editview.h:42
unsigned int map_height
Definition: preferences.h:33
GdkPixbuf * pixbuf
Definition: editview.c:44
gchar * source
Definition: editview.c:30
GtkWidget * event_box
Definition: preview.h:30
GtkSourceStyleSchemeManager * style_manager
Definition: editview.h:39