callbacks.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*************************************************************************
  2. * Copyright (c) 2011 AT&T Intellectual Property
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * https://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors: Details at https://graphviz.org
  9. *************************************************************************/
  10. #define _CRT_SECURE_NO_DEPRECATE 1
  11. #include "config.h"
  12. #include <gtk/gtk.h>
  13. #include "callbacks.h"
  14. #include "viewport.h"
  15. #include "selectionfuncs.h"
  16. //Menu Items
  17. void save_as_graph_clicked(GtkWidget *widget, void *user_data) {
  18. (void)widget;
  19. (void)user_data;
  20. GtkWidget *dialog;
  21. dialog = gtk_file_chooser_dialog_new("Save File",
  22. NULL,
  23. GTK_FILE_CHOOSER_ACTION_SAVE,
  24. GTK_STOCK_CANCEL,
  25. GTK_RESPONSE_CANCEL,
  26. GTK_STOCK_SAVE,
  27. GTK_RESPONSE_ACCEPT, NULL);
  28. gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER
  29. (dialog), TRUE);
  30. if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
  31. char *filename;
  32. filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
  33. save_graph_with_file_name(view->g[view->activeGraph], filename);
  34. g_free(filename);
  35. }
  36. gtk_widget_destroy(dialog);
  37. }
  38. void remove_graph_clicked(GtkWidget *widget, void *user_data) {
  39. (void)widget;
  40. (void)user_data;
  41. g_print("remove graph button fired\n");
  42. }
  43. static void btn_clicked(GtkWidget * widget, gvk_layout layout)
  44. {
  45. (void)widget;
  46. (void)layout;
  47. }
  48. void btn_dot_clicked(GtkWidget *widget, void *user_data) {
  49. (void)user_data;
  50. btn_clicked(widget, GVK_DOT);
  51. }
  52. void btn_neato_clicked(GtkWidget *widget, void *user_data) {
  53. (void)user_data;
  54. btn_clicked(widget, GVK_NEATO);
  55. }
  56. void btn_twopi_clicked(GtkWidget *widget, void *user_data) {
  57. (void)user_data;
  58. btn_clicked(widget, GVK_TWOPI);
  59. }
  60. void btn_circo_clicked(GtkWidget *widget, void *user_data) {
  61. (void)user_data;
  62. btn_clicked(widget, GVK_CIRCO);
  63. }
  64. void btn_fdp_clicked(GtkWidget *widget, void *user_data) {
  65. (void)user_data;
  66. btn_clicked(widget, GVK_FDP);
  67. }
  68. /*console output widgets*/
  69. _BB void on_clearconsolebtn_clicked(GtkWidget *widget, void *user_data) {
  70. (void)widget;
  71. (void)user_data;
  72. gtk_text_buffer_set_text(gtk_text_view_get_buffer
  73. ((GtkTextView *)
  74. glade_xml_get_widget(xml, "mainconsole")),
  75. "", 0);
  76. }
  77. _BB void on_hideconsolebtn_clicked(GtkWidget *widget, void *user_data) {
  78. (void)widget;
  79. (void)user_data;
  80. gtk_widget_hide(glade_xml_get_widget(xml, "vbox13"));
  81. }
  82. _BB void on_consoledecbtn_clicked(GtkWidget *widget, void *user_data) {
  83. (void)widget;
  84. (void)user_data;
  85. int w, h;
  86. gtk_widget_get_size_request((GtkWidget*)
  87. glade_xml_get_widget(xml,
  88. "scrolledwindow7"),
  89. &w, &h);
  90. w -= 5;
  91. gtk_widget_set_size_request(((GtkWidget*)
  92. glade_xml_get_widget(xml,
  93. "scrolledwindow7")),
  94. w, 0);
  95. }
  96. _BB void on_consoleincbtn_clicked(GtkWidget *widget, void *user_data) {
  97. (void)widget;
  98. (void)user_data;
  99. int w, h;
  100. gtk_widget_get_size_request((GtkWidget*)
  101. glade_xml_get_widget(xml,
  102. "scrolledwindow7"),
  103. &w, &h);
  104. w += 5;
  105. gtk_widget_set_size_request(((GtkWidget*)
  106. glade_xml_get_widget(xml,
  107. "scrolledwindow7")),
  108. w, 0);
  109. }