[1877] | 1 | /* |
---|
| 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
| 10 | |
---|
| 11 | This program is distributed in the hope that it will be useful, |
---|
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 14 | GNU General Public License for more details. |
---|
| 15 | |
---|
| 16 | You should have received a copy of the GNU General Public License |
---|
| 17 | along with this program; if not, write to the Free Software Foundation, |
---|
| 18 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | ### File Specific: |
---|
| 22 | main-programmer: Benjamin Grauer |
---|
| 23 | co-programmer: |
---|
| 24 | */ |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | #include "orxonox_console_log.h" |
---|
| 28 | |
---|
| 29 | GtkWidget* OrxonoxConsoleLog::createLog() |
---|
| 30 | { |
---|
[1880] | 31 | frame = gtk_frame_new ("Console Log:"); |
---|
| 32 | { |
---|
| 33 | scrollframe = gtk_scrolled_window_new (NULL, NULL); |
---|
| 34 | logtext = new char; |
---|
| 35 | |
---|
| 36 | gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollframe), |
---|
| 37 | GTK_POLICY_AUTOMATIC, |
---|
| 38 | GTK_POLICY_AUTOMATIC); |
---|
| 39 | |
---|
| 40 | gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrollframe), |
---|
| 41 | GTK_SHADOW_IN); |
---|
| 42 | gtk_container_set_border_width (GTK_CONTAINER(scrollframe), 5); |
---|
| 43 | |
---|
[1882] | 44 | logView = gtk_text_view_new(); |
---|
| 45 | gtk_text_view_set_editable(GTK_TEXT_VIEW(logView), FALSE); |
---|
| 46 | log = gtk_text_view_get_buffer (GTK_TEXT_VIEW (logView)); |
---|
| 47 | gtk_container_add(GTK_CONTAINER(scrollframe), logView); |
---|
[1880] | 48 | gtk_container_add(GTK_CONTAINER(frame),scrollframe); |
---|
[1908] | 49 | gtk_text_buffer_set_text (log, "Orxonox Console started.\n", -1); |
---|
[1882] | 50 | |
---|
[1880] | 51 | } |
---|
| 52 | return (frame); |
---|
| 53 | } |
---|
[1878] | 54 | |
---|
[1880] | 55 | void OrxonoxConsoleLog::appendText(char* append) |
---|
| 56 | { |
---|
[1908] | 57 | GtkTextIter iter; |
---|
[1890] | 58 | if (verbose>=1) |
---|
[1907] | 59 | printf ("appending: %s\n", append); |
---|
| 60 | strcat (append,"\n"); |
---|
[1908] | 61 | gtk_text_buffer_get_start_iter (log, &iter); |
---|
| 62 | gtk_text_buffer_place_cursor (log, &iter); |
---|
[1907] | 63 | gtk_text_buffer_insert_at_cursor (log, append, -1); |
---|
[1882] | 64 | return; |
---|
[1880] | 65 | } |
---|
[1878] | 66 | |
---|
[1880] | 67 | void OrxonoxConsoleLog::clear() |
---|
| 68 | { |
---|
| 69 | sprintf(logtext, ""); |
---|
| 70 | return; |
---|
[1877] | 71 | } |
---|