Code: Select all
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'< main program generated by utility GTK+tobac2 V2.2.0 >
'< Hauptprogramm erzeugt von >
'< Generated at / Generierung am 2010-09-06, 01:24 >
' ---------------------------------------------------------------------
'< Program info: >
CONST PROG_NAME = "Scribble" ' >
CONST PROG_DESC = "Zeichenprogramm" ' >
CONST PROG_VERS = "0.0" ' >
CONST PROG_YEAR = "2010" ' >
CONST PROG_AUTH = "TJF" ' >
CONST PROG_MAIL = "Thomas.Freiherr@gmx.net" ' >
CONST PROG_WEBS = "members.aon.at/tjf" ' >
'< >
'< Description / Beschreibung: >
'< Beispiel DrawArea, einfaches Zeichenprogramm >
'< >
'< License / Lizenz: >
'< >
'< Redistribution and use in source and binary forms, with or >
'< without modification, are permitted provided that the following >
'< conditions are met: >
'< >
'< * Redistributions of source code must retain the above >
'< copyright notice, this list of conditions and the following >
'< disclaimer. >
'< >
'< * Redistributions in binary form must reproduce the above >
'< copyright notice, this list of conditions and the following >
'< disclaimer in the documentation and/or other materials provided >
'< with the distribution. >
'< >
'< * Neither the name of the author nor the names of its >
'< contributors may be used to endorse or promote products derived >
'< from this software without specific prior written permission. >
'< >
'< THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS >
'< AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED >
'< WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES >
'< OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >
'< ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER >
'< OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >
'< SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >
'< LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF >
'< USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED >
'< AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT >
'< LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN >
'< ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE >
'< POSSIBILITY OF SUCH DAMAGE. >
'< >
' ---------------------------------------------------------------------
'< Please prefer GNU GENERAL PUBLIC LICENSE to support open software. >
'< For more information please visit: http://www.fsf.org >
'< >
'< Bitte bevorzugen Sie die GNU GENERAL PUBLIC LICENSE und >
'< unterstuetzen Sie mit Ihrem Programm die freie Software >
'< Mehr Informationen finden Sie unter: http://www.fsf.org >
' ---------------------------------------------------------------------
'< GTK+tobac: general init / Allgemeine Initialisierungen >
' #INCLUDE "gtk/GTK-2.18.6_TJF.bi" ' GTK+library / GTK+ Bibliothek >
#include once "gtk/gtk.bi"
gtk_init(@__FB_ARGC__, @__FB_ARGV__) ' start GKT / GTK starten >
'< GTK+tobac: end block / Blockende >
' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
/' Backing pixmap for drawing area '/
DIM SHARED AS GdkPixmap PTR PIXMAP = NULL
DECLARE SUB draw_brush(BYVAL widget AS GtkWidget PTR, _
BYVAL x AS gdouble, _
BYVAL y AS gdouble)
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'< _tobac.bas modul generated by utility GTK+tobac2 V2.2.0 >
'< Modul _tobac.bas erzeugt von >
'< Generated at / Generierung am 2010-09-06, 02:45 >
' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
IF gtk_check_version(2, 16, 0) THEN
?"Fehler/Error (GTK-Version): Version zu alt"
END -1
END IF
DIM AS STRING GUISTR
DIM SHARED AS GtkBuilder PTR XML
DIM SHARED AS GObject PTR _
WinScribble, Draw1, ButQuit
XML = gtk_builder_new()
SCOPE
DIM AS GError PTR meld
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'< _gui.bas modul generated by utility GTK+tobac2 V2.2.0 >
'< Modul _gui.bas erzeugt von >
'< Generated at / Generierung am 2010-09-06, 02:45 >
' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
GUIstr =_
"<?xml version=""1.0""?>"+_
"<interface>"+_
"<requires lib=""gtk+"" version=""2.16""/>"+_
"<!-- interface-naming-policy project-wide -->"+_
"<object class=""GtkWindow"" id=""WinScribble"">"+_
"<signal name=""destroy"" handler=""gtk_main_quit""/>"+_
"<child>"+_
"<object class=""GtkVBox"" id=""vbox1"">"+_
"<property name=""visible"">True</property>"+_
"<child>"+_
"<object class=""GtkDrawingArea"" id=""Draw1"">"+_
"<property name=""width_request"">200</property>"+_
"<property name=""height_request"">200</property>"+_
"<property name=""visible"">True</property>"+_
"<property name=""events"">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>"+_
"<signal name=""button_press_event"" handler=""on_Draw1_button_press_event""/>"+_
"<signal name=""motion_notify_event"" handler=""on_Draw1_motion_notify_event""/>"+_
"<signal name=""expose_event"" handler=""on_Draw1_expose_event""/>"+_
"<signal name=""configure_event"" handler=""on_Draw1_configure_event""/>"+_
"</object>"+_
"<packing>"+_
"<property name=""position"">0</property>"+_
"</packing>"+_
"</child>"+_
"<child>"+_
"<object class=""GtkButton"" id=""ButQuit"">"+_
"<property name=""label"" translatable=""yes"">Quit</property>"+_
"<property name=""visible"">True</property>"+_
"<property name=""can_focus"">True</property>"+_
"<property name=""receives_default"">True</property>"+_
"<signal name=""clicked"" handler=""gtk_main_quit""/>"+_
"</object>"+_
"<packing>"+_
"<property name=""expand"">False</property>"+_
"<property name=""fill"">False</property>"+_
"<property name=""position"">1</property>"+_
"</packing>"+_
"</child>"+_
"</object>"+_
"</child>"+_
"</object>"+_
"</interface>"
IF 0 = gtk_builder_add_from_string(XML, SADD(GUISTR), LEN(GUISTR), @meld) THEN
WITH *meld
?"Fehler/Error (GTK-Builder):"
?*.message
END WITH
END -1
END IF
END SCOPE
WinScribble = gtk_builder_get_object(XML, "WinScribble")
Draw1 = gtk_builder_get_object(XML, "Draw1")
ButQuit = gtk_builder_get_object(XML, "ButQuit")
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'< callback modul generated by utility GTK+tobac2 V2.2.0 >
'< callback-Modul erzeugt von >
'< Generated at / Generierung am 2010-09-06, 01:24 >
' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
FUNCTION on_Draw1_button_press_event CDECL ALIAS "on_Draw1_button_press_event" _
(BYVAL widget AS GtkWidget PTR, _
BYVAL event AS GdkEventButton PTR) AS gboolean EXPORT
IF event->button = 1 THEN IF PIXMAP THEN draw_brush(widget, event->x, event->y)
RETURN TRUE
END FUNCTION
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'< callback modul generated by utility GTK+tobac2 V2.2.0 >
'< callback-Modul erzeugt von >
'< Generated at / Generierung am 2010-09-06, 01:24 >
' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
FUNCTION on_Draw1_motion_notify_event CDECL ALIAS "on_Draw1_motion_notify_event" _
(BYVAL widget AS GtkWidget PTR, _
BYVAL event AS GdkEventMotion PTR) AS gboolean EXPORT
DIM AS INTEGER x, y
DIM AS GdkModifierType state
IF event->is_hint THEN
gdk_window_get_pointer(event->window, @x, @y, @state)
ELSE
x = event->x
y = event->y
state = event->state
END IF
IF state AND GDK_BUTTON1_MASK THEN IF PIXMAP THEN draw_brush(widget, x, y)
RETURN TRUE
END FUNCTION
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'< callback modul generated by utility GTK+tobac2 V2.2.0 >
'< callback-Modul erzeugt von >
'< Generated at / Generierung am 2010-09-06, 01:24 >
' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
FUNCTION on_Draw1_expose_event CDECL ALIAS "on_Draw1_expose_event" _
(BYVAL widget AS GtkWidget PTR, _
BYVAL event AS GdkEventExpose PTR) AS gboolean EXPORT
gdk_draw_drawable(widget->window, _
widget->style->fg_gc(gtk_widget_get_state(widget)), _
PIXMAP, _
event->area.x, event->area.y, _
event->area.x, event->area.y, _
event->area.width, event->area.height)
RETURN FALSE
END FUNCTION
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'< callback modul generated by utility GTK+tobac2 V2.2.0 >
'< callback-Modul erzeugt von >
'< Generated at / Generierung am 2010-09-06, 01:24 >
' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
FUNCTION on_Draw1_configure_event CDECL ALIAS "on_Draw1_configure_event" _
(BYVAL widget AS GtkWidget PTR, _
BYVAL event AS GdkEventConfigure PTR) AS gboolean EXPORT
IF PIXMAP THEN g_object_unref(pixmap)
PIXMAP = gdk_pixmap_new(widget->window, _
widget->allocation.width, _
widget->allocation.height, _
-1)
gdk_draw_rectangle(PIXMAP, _
widget->style->white_gc, _
TRUE, _
0, 0, _
widget->allocation.width, _
widget->allocation.height)
RETURN TRUE
END FUNCTION
SUB draw_brush(BYVAL widget AS GtkWidget PTR, _
BYVAL x AS gdouble, _
BYVAL y AS gdouble)
DIM AS GdkRectangle update_rect
update_rect.x = x - 5
update_rect.y = y - 5
update_rect.width = 10
update_rect.height = 10
gdk_draw_rectangle(PIXMAP, _
widget->style->black_gc, _
TRUE, _
update_rect.x, update_rect.y, _
update_rect.width, update_rect.height)
gtk_widget_queue_draw_area(widget, _
update_rect.x, update_rect.y, _
update_rect.width, update_rect.height)
END SUB
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'< GTK+tobac: run GTK main, then end / GTK Hauptschleife, dann Ende >
gtk_builder_connect_signals(XML, 0) ' callbacks anbinden >
gtk_widget_show_all(GTK_WIDGET(WinScribble)) 'ptfenster darstellen >
gtk_main() ' main loop / Hauptschleife >
g_object_unref(XML) ' dereference / Referenz abbauen >
'< GTK+tobac: end block / Blockende >
' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
' you may unref files here / ggf. Dateien hier schliessen
END 0 ' finish with return code 0 / Ende mit Returncode 0
Code: Select all
Command executed:
"C:\FreeBasic\fbc.exe" "C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas"
Compiler output:
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(68) error 41: Variable not declared, NULL in 'DIM SHARED AS GdkPixmap PTR PIXMAP = NULL'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(68) warning 4(1): Suspicious pointer assignment
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(85) error 14: Expected identifier, found 'GtkBuilder' in 'DIM SHARED AS GtkBuilder PTR XML'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(89) error 41: Variable not declared, XML in 'XML = gtk_builder_new()'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(143) error 41: Variable not declared, gtk_builder_add_from_string in 'IF 0 = gtk_builder_add_from_string(XML, SADD(GUISTR), LEN(GUISTR), @meld) THEN'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(152) error 41: Variable not declared, gtk_builder_get_object in 'WinScribble = gtk_builder_get_object(XML, "WinScribble")'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(152) warning 4(1): Suspicious pointer assignment
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(153) error 67: Array not dimensioned, before '(' in 'Draw1 = gtk_builder_get_object(XML, "Draw1")'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(153) warning 4(1): Suspicious pointer assignment
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(154) error 67: Array not dimensioned, before '(' in 'ButQuit = gtk_builder_get_object(XML, "ButQuit")'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(154) warning 4(1): Suspicious pointer assignment
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(203) error 41: Variable not declared, gtk_widget_get_state in 'widget->style->fg_gc(gtk_widget_get_state(widget)), _'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(257) error 41: Variable not declared, gtk_builder_connect_signals in 'gtk_builder_connect_signals(XML, 0) ' callbacks anbinden >'
C:\Users\pc\Desktop\test_freebasic\FBIDETEMP.bas(260) warning 1(1): Passing scalar as pointer, at parameter 1 of G_OBJECT_UNREF()
Results:
Compilation failed
System:
FBIde: 0.4.6
fbc: FreeBASIC Compiler - Version 0.23.0 (08-14-2011) for win32 (target:win32)
OS: Windows NT 6.2 (build 9200)