Buchempfehlung
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Umfassend, aber leicht verständlich führt dieses Buch in die Programmierung von ATMEL AVR Mikrocontrollern ein. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

GTK - Vom Fenster bis zum Mini Text Editor - MTE_103

Uploader:Mitgliedrieselkalk
Datum/Zeit:17.08.2010 20:49:28

'- rieselkalk 2010
'- MiniTextEditor_103.bas  (MyTextEditor) (MaxiTextEditor) (MultiTextEditor)

#Include once "gtk/gtk.bi"
gtk_set_locale()
#define NULL 0

gtk_init (0, 0)

'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'- rieselkalk 2010
'- header_103.bas

'- Konstanten aus gdk/gdkkeysyms.h
#define GDK_A &H041
#define GDK_B &H042
#define GDK_C &H043
#define GDK_D &H044
#define GDK_E &H045
#define GDK_F &H046
#Define GDK_G &H047
#define GDK_H &H048
#define GDK_I &H049
#define GDK_J &H04a
#define GDK_K &H04b
#define GDK_L &H04c
#define GDK_M &H04d
#define GDK_N &H04e
#define GDK_O &H04f
#define GDK_P &H050
#define GDK_Q &H051
#define GDK_R &H052
#define GDK_S &H053
#define GDK_T &H054
#define GDK_U &H055
#define GDK_V &H056
#define GDK_W &H057
#define GDK_X &H058
#define GDK_Y &H059
#define GDK_Z &H05a
#define GDK_F1 &HFFBE
#define GDK_F2 &HFFBF
#define GDK_F3 &HFFC0
#define GDK_F4 &HFFC1
#define GDK_F5 &HFFC2
#define GDK_F6 &HFFC3
#define GDK_F7 &HFFC4
#define GDK_F8 &HFFC5
#define GDK_F9 &HFFC6
#define GDK_F10 &HFFC7
#define GDK_F11 &HFFC8
#define GDK_F12 &HFFC9
#define GDK_Del &HFFFF

#define NULL 0


'#define _GDK_MAKE_ATOM(val)            ((GdkAtom)GUINT_TO_POINTER(val))
#define GDK_NONE                        _GDK_MAKE_ATOM (0)
#define GDK_SELECTION_PRIMARY           _GDK_MAKE_ATOM (1)
#Define GDK_SELECTION_SECONDARY         _GDK_MAKE_ATOM (2)
#Define GDK_SELECTION_TYPE_ATOM         _GDK_MAKE_ATOM (4)
#Define GDK_TARGET_BITMAP                   _GDK_MAKE_ATOM (5)
#define GDK_SELECTION_TYPE_BITMAP   _GDK_MAKE_ATOM (5)
#Define GDK_TARGET_COLORMAP                 _GDK_MAKE_ATOM (7)
#define GDK_SELECTION_TYPE_COLORMAP _GDK_MAKE_ATOM (7)
#Define GDK_TARGET_DRAWABLE                 _GDK_MAKE_ATOM (17)
#define GDK_SELECTION_TYPE_DRAWABLE _GDK_MAKE_ATOM (17)
#Define GDK_SELECTION_TYPE_INTEGER  _GDK_MAKE_ATOM (19)
#Define GDK_TARGET_PIXMAP                   _GDK_MAKE_ATOM (20)
#define GDK_SELECTION_TYPE_PIXMAP   _GDK_MAKE_ATOM (20)
#Define GDK_TARGET_STRING                   _GDK_MAKE_ATOM (31)
#Define GDK_SELECTION_TYPE_WINDOW   _GDK_MAKE_ATOM (33)
#Define GDK_SELECTION_CLIPBOARD         _GDK_MAKE_ATOM (69)

'- Pixbuffer für das Fenster Icon
Dim Shared As GdkPixbuf Ptr p_mte_icon_pixbuf

'- mte_face
Type t_mte  
  AS GtkWidget Ptr p_window_1
  As GtkWidget Ptr p_vbox_1
  As GtkWidget Ptr p_menubar_1
  As GtkWidget Ptr p_menuitem_file
  As GtkWidget Ptr p_menuitem_file_menu
  As GtkWidget Ptr p_menuitem_new
  As GtkWidget Ptr p_image_103
  As GtkWidget Ptr p_menuitem_open
  As GtkWidget Ptr p_image_104
  As GtkWidget Ptr p_menuitem_save
  As GtkWidget Ptr p_image_105
  As GtkWidget Ptr p_menuitem_saveas
  As GtkWidget Ptr p_image_106
  As GtkWidget Ptr p_separator_11
  As GtkWidget Ptr p_menuitem_print
  As GtkWidget Ptr p_image_107
  As GtkWidget Ptr p_separator_12
  As GtkWidget Ptr p_menuitem_quit
  As GtkWidget Ptr p_image_108
  As GtkWidget Ptr p_menuitem_bearbeiten
  As GtkWidget Ptr p_menuitem_bearbeiten_menu
  As GtkWidget Ptr p_menuitem_cut
  As GtkWidget Ptr p_image_109
  As GtkWidget Ptr p_menuitem_copy
  As GtkWidget Ptr p_image_110
  As GtkWidget Ptr p_menuitem_paste
  As GtkWidget Ptr p_image_111
  As GtkWidget Ptr p_menuitem_del
  As GtkWidget Ptr p_image_112
  As GtkWidget Ptr p_separator_21
  As GtkWidget Ptr p_menuitem_find
  As GtkWidget Ptr p_image_113
  As GtkWidget Ptr p_menuitem_replace
  As GtkWidget Ptr p_image_114
  As GtkWidget Ptr p_separator_22
  As GtkWidget Ptr p_menuitem_markall
  As GtkWidget Ptr p_menuitem_delmark
  As GtkWidget Ptr p_menuitem_ansicht
  As GtkWidget Ptr p_menuitem_ansicht_menu
  As GtkWidget Ptr p_menuitem_symbolleiste
  As GtkWidget Ptr p_menuitem_formatierungsleiste
  As GtkWidget Ptr p_menuitem_linealleiste  
  As GtkWidget Ptr p_menuitem_statusleiste
  As GtkWidget Ptr p_separator_31
  As GtkWidget Ptr p_menuitem_einstellungen
  
  As GtkWidget Ptr p_menuitem_insert
  As GtkWidget Ptr p_menuitem_insert_menu
  As GtkWidget Ptr p_menuitem_date
  As GtkWidget Ptr p_menuitem_time
  As GtkWidget Ptr p_menuitem_format
  As GtkWidget Ptr p_menuitem_format_menu
  As GtkWidget Ptr p_menuitem_font
  As GtkWidget Ptr p_menuitem_Aufzaehlungszeichen
  As GtkWidget Ptr p_menuitem_absatz
  As GtkWidget Ptr p_menuitem_tabstop
  
'  As GtkWidget Ptr p_menuitem_umbruch
  As GtkWidget Ptr p_menuitem_hilfe
  As GtkWidget Ptr p_menuitem_hilfe_menu
  As GtkWidget Ptr p_menuitem_help
  As GtkWidget Ptr p_image_115
  As GtkWidget Ptr p_separator_61
  As GtkWidget Ptr p_menuitem_about
  As GtkWidget Ptr p_image_116
  As GtkWidget Ptr p_toolbar_1
  As GtkWidget Ptr p_image_203
  As GtkWidget Ptr p_image_204
  As GtkWidget Ptr p_image_205
  As GtkWidget Ptr p_image_206
  As GtkWidget Ptr p_image_207
  As GtkWidget Ptr p_image_208
  As GtkWidget Ptr p_image_209
  As GtkWidget Ptr p_image_210
  As GtkWidget Ptr p_image_211
  As GtkWidget Ptr p_image_212
  As GtkWidget Ptr p_image_213
  As GtkWidget Ptr p_image_214  
  As GtkWidget Ptr p_hbox_1
  As GtkWidget Ptr p_hruler_1
  As GtkWidget Ptr p_fixed_1
  As GtkWidget Ptr p_button_home
  As GtkWidget Ptr p_button_end
  As GtkWidget Ptr p_hbox_2
  As GtkWidget Ptr p_hbox_3  
  As GtkWidget Ptr p_fixed_2
  As GtkWidget Ptr p_entry_1
  As GtkWidget Ptr p_entry_2
  As GtkWidget Ptr p_entry_3
  As GtkWidget Ptr p_entry_4
  As GtkWidget Ptr p_entry_5
  As GtkWidget Ptr p_entry_6
  As GtkWidget Ptr p_fixed_3
  As GtkWidget Ptr p_image_resize
  As GtkWidget Ptr p_scrolledwindow_1
  As GtkWidget Ptr p_textview_1
  As GtkTextBuffer PTR p_buffer_1
  AS GtkAccelGroup Ptr p_accel_group_1
  As gchar Ptr p_dateiname_1
  
  As GtkIconSize tmp_toolbar_icon_size
  
'- Für Formatierung        
  As GtkWidget Ptr p_toolbar_2  
  As GtkWidget Ptr p_image_303
  As GtkWidget Ptr p_image_304
  As GtkWidget Ptr p_image_305
  As GtkWidget Ptr p_image_306      
  As GtkWidget Ptr p_combo_schriftart
  As GtkWidget Ptr p_combo_schriftgrad
  As GtkWidget Ptr p_button_color
  As GtkWidget Ptr p_button_bold
  As GtkWidget Ptr p_button_italic
  As GtkWidget Ptr p_button_underline
  As GtkTextTag Ptr p_bold
  As GtkTextTag Ptr p_italic
  As GtkTextTag Ptr p_underline  
  As gchar Ptr p_background
  As gchar Ptr p_foreground  
  As GtkTextTagTable Ptr p_tags_1
  As gchar Ptr p_tagname
End Type

'- Zeiger Variablen für das Modul Face
  Dim Shared mte As t_mte
  Dim Shared p_mte As t_mte Ptr
  p_mte = @mte
  
  Dim Shared As GtkTooltips Ptr p_mte_tooltips_1
  p_mte_tooltips_1 = gtk_tooltips_new()
    
'- mte_option
'- Type für die Einstellung (Option) Daten
'- Für das ganze Programm wichtig
Type t_mte_od
    As gint tooltips                                                        '- Tooltips EIN/AUS
    As gint editable
    As gint cursor_visible
    As gint overwrite
    As gint measurement_unit                                        '- Maßeinheit für das Lineal
    As gint wrap_mode                                                   '- Art des Zeilenumbruchs
    As gint pixels_above_lines                                  '- Der Abstand vor einem Absatz in Pixel
    As gint pixels_below_lines                                  '- Der Abstand nach einem Absatz in Pixel
    As gint pixels_inside_wrap                                  '- Der Abstand zwischen aufeinander umbrochenen Zeilen
    As gint justification                                           '- Satzausrichtung
    As gint left_margin                                                 '- Breite des linken Randes
    As gint right_margin                                                '- Breite des rechten Randes
    As gint indent                                                          '- Einrücktiefe von Absätzen
End Type

  '- Option Variablen anlegen
  Dim mte_od As t_mte_od
  Dim p_mte_od As t_mte_od Ptr
  
'- Type für den Einstellungs (Option) Dialog
'- Alle Widget die mit der Dateneingabe zu tun haben
Type t_mte_o
    As t_mte_od Ptr p_daten
    As GtkWidget Ptr p_dialog_option

'- Notebook Blatt Maßeinheiten
  As GtkWidget Ptr p_radiobutton_zoll
  As GtkWidget Ptr p_radiobutton_zentimeter
  As GtkWidget Ptr p_radiobutton_punkte
  
'- Notebook Blatt Zeilenumbruch
  As GtkWidget Ptr p_radiobutton_none
  As GtkWidget Ptr p_radiobutton_zeichenweiser
  As GtkWidget Ptr p_radiobutton_wortweise

'- Notebook Blatt Abstand vor einem Absatz in Pixel  
  As GtkObject Ptr p_spinbutton_abstand_vor_adj
  As GtkWidget Ptr p_spinbutton_abstand_vor
  As GtkObject Ptr p_spinbutton_abstand_zwischen_adj
  As GtkWidget Ptr p_spinbutton_abstand_zwischen
  As GtkObject Ptr p_spinbutton_abstand_nach_adj
  As GtkWidget Ptr p_spinbutton_abstand_nach


'- Notebook Blatt Satzausrichtung
  As GtkWidget Ptr p_radiobutton_links
  As GtkWidget Ptr p_radiobutton_zentriert
  As GtkWidget Ptr p_radiobutton_rechts
  As GtkWidget Ptr p_radiobutton_blocksatz

'- Notebook Blatt Ränder
  As GtkObject Ptr p_spinbutton_rand_links_adj
  As GtkWidget Ptr p_spinbutton_rand_links
  As GtkObject Ptr p_spinbutton_rand_rechts_adj
  As GtkWidget Ptr p_spinbutton_rand_rechts
  As GtkObject Ptr p_spinbutton_rand_tiefe_adj
  As GtkWidget Ptr p_spinbutton_rand_tiefe

'- Notebook Blatt Sonstiges
  As GtkWidget Ptr p_checkbutton_tooltip
  As GtkWidget Ptr p_checkbutton_editable
  As GtkWidget Ptr p_checkbutton_cursor_visible
  As GtkWidget Ptr p_checkbutton_overwrite
End Type

'- Pointer für Dateneingabe Widget's anlegen
  Dim Shared mte_o As t_mte_o
  Dim Shared p_mte_o As t_mte_o Ptr
  
  p_mte_o = @mte_o  


'- Allgemein Gültige Zeiger anlegen



'- Deklarationen
Declare Sub mte_on_window_1_resize  Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer ptr)
Declare Sub mte_on_menuitem_new_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_open_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_save_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_saveas_activate  Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_print_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_quit_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_cut_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_copy_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_paste_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_del_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_find_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_replace_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_markall_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_delmark_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_date_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_time_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_umbruch_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_font_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_help_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
Declare Sub mte_on_menuitem_about_1_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)

'- Datei Dialog


Declare Sub mte_ShowAbout ()
Declare Sub mte_ShowHilfe ()


'----------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------

'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'- rieselkalk 2010
'- func_103.bas

'- Text View mit Einstellungen versorgen
Function mte_func_set_text_view() As gint
  mte_func_set_text_view = TRUE
End Function


'----------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------


'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'- rieselkalk 2010
'- mte_picture_103.bas
'- UTF8 Zeichensatz Ä 195 132, Ö 195 150, Ü 195 156, ß 195 159, ä 195 164, ö 195 182, ü 195 188

Dim As Zstring Ptr p_mte_icon16(30) => { _
                           @"16 16 8 1", _
                           @"  c None", _
                           @"! c #0000FF", _
                           @"# c #FF0000", _
                           @"$ c black", _
                           @"% c #FFFF00", _
                           @"& c #808080", _
                           @"' c #C0C0C0", _
                           @"? c #008000", _
                           @"#!###!#########$", _
                           @"#!!#!!########%#", _
                           @"#!#!#!#######%##", _
                           @"#!###!######%###", _
                           @"#!###!#####&####", _
                           @"######%%%%%#####", _
                           @"########%#######", _
                           @"#''''''#%#######", _
                           @"#$$$'$$#%#######", _
                           @"#''''''#%#######", _
                           @"#$$$$$$####?????", _
                           @"#''''''####?####", _
                           @"#$$$$$$####????#", _
                           @"#''''''####?####", _
                           @"#$$$$$$####?????", _
                           @"################"}

Dim As Zstring Ptr p_mte_icon32(60) => { _
                           @"32 32 9 1", _
                           @"  c None", _
                           @"! c #FF0000", _
                           @"# c black", _
                           @"$ c #0000FF", _
                           @"% c #C0C0C0", _
                           @"& c #808080", _
                           @"' c #FFFF00", _
                           @"( c white", _
                           @") c #008000", _
                           @"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!##!", _
                           @"!$!!!!!!$!!!!!!!!!!!!!!!!!!!#%%#", _
                           @"!$$!!!!$$!!!!!!!!!!!!!!!!!!#&#%#", _
                           @"!$$$!!$$$!!!!!!!!!!!!!!!!!#&&&##", _
                           @"!$$$$$$$$!!!!!!!!!!!!!!!!#'##&#!", _
                           @"!$$!$$!$$!!!!!!!!!!!!!!!#'#''#!!", _
                           @"!$$!!!!$$!!!!!!!!!!!!!!#'#''#!!!", _
                           @"!$$!!!!$$!!!!!!!!!!!!!#&#''#!!!!", _
                           @"!$$!!!!$$!!!!!!!!!!!!!#%#'#!!!!!", _
                           @"!$$!!!!$$!!!!!!!!!!!!#%(%#!!!!!!", _
                           @"!$$!!!!$$!!!!!!!!!!!!##%#!!!!!!!", _
                           @"!!!!!!!!!!!!!''''''!!###!!!!!!!!", _
                           @"!!!!!!!!!!!!''''''''!!!!!!!!!!!!", _
                           @"!!!!!!!!!!!!''!''!''!!!!!!!!!!!!", _
                           @"!!!!!!!!!!!!!!!''!!!!!!!!!!!!!!!", _
                           @"!%%%%%%%%%%%%!!''!!!!!!!!!!!!!!!", _
                           @"!%####%%####%!!''!!!!!!!!!!!!!!!", _
                           @"!%%%%%%%%%%%%!!''!!!!!!!!!!!!!!!", _
                           @"!%#####%%%%%%!!''!!!!!!!!!!!!!!!", _
                           @"!%%%%%%%%%%%%!!''!!!!!!!!!!!!!!!", _
                           @"!%#####%%%%%%!!''!!!!!!!!!!!!!!!", _
                           @"!%%%%%%%%%%%%!!!!!!!!!!!)))))))!", _
                           @"!%$$$$$$$$$$%!!!!!!!!!!))))))))!", _
                           @"!%%%%%%%%%%%%!!!!!!!!!!))!!!!!!!", _
                           @"!%$$$$$$$$$$%!!!!!!!!!!))!!!!!!!", _
                           @"!%%%%%%%%%%%%!!!!!!!!!!))))))!!!", _
                           @"!%$$$$$$$$$$%!!!!!!!!!!))))))!!!", _
                           @"!%%%%%%%%%%%%!!!!!!!!!!))!!!!!!!", _
                           @"!%##########%!!!!!!!!!!))!!!!!!!", _
                           @"!%%%%%%%%%%%%!!!!!!!!!!))))))))!", _
                           @"!%##########%!!!!!!!!!!!)))))))!", _
                           @"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"}
                          
Dim Shared As Zstring Ptr p_mte_icon64(80) => { _
                           @"64 64 12 1", _
                           @"  c None", _
                           @"! c #FF0000", _
                           @"# c #0000FF", _
                           @"$ c #00FFFF", _
                           @"% c black", _
                           @"& c #C0C0C0", _
                           @"' c #FFFF00", _
                           @"( c #808080", _
                           @") c white", _
                           @"* c #000080", _
                           @"+ c #008000", _
                           @", c #00FF00", _
                           @"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", _
                           @"!##!!!!!!!!!!!!!##!!!!!$$$$$$$$$$$$$$$$$$!!!!!!!!!!!!!!!!!!%%!!!", _
                           @"!###!!!!!!!!!!!###!!!!!$%%%%%%%%%%%%%%%%$!!!!!!!!!!!!!!!!!%&&%!!", _
                           @"!####!!!!!!!!!####!!!!!$%''''''''''''''%$!!!!!!!!!!!!!!!!%(%&&%!", _
                           @"!#####!!!!!!!#####!!!!!$%'%%%%''''''%%'%$!!!!!!!!!!!!!!!%(((%&%!", _
                           @"!######!!!!!######!!!!!$%'''''''''''%%'%$!!!!!!!!!!!!!!%'%%((%%!", _
                           @"!#######!!!#######!!!!!$%''''''''''''''%$!!!!!!!!!!!!!%'%''%(%!!", _
                           @"!#################!!!!!$%''''%%%%%%%'''%$!!!!!!!!!!!!%'%''%'%!!!", _
                           @"!#################!!!!!$%''''''''''''''%$!!!!!!!!!!!%'%''%'%!!!!", _
                           @"!####!#######!####!!!!!$%''''%%%%%%''''%$!!!!!!!!!!%'%''%'%!!!!!", _
                           @"!####!!#####!!####!!!!!$%''''''''''''''%$!!!!!!!!!%'%''%'%!!!!!!", _
                           @"!####!!!###!!!####!!!!!$%%%%%%%%%%%%%%%%$!!!!!!!!%'%''%'%!!!!!!!", _
                           @"!####!!!!#!!!!####!!!!!$$$$$$$$$$$$$$$$$$!!!!!!!%'%''%'%!!!!!!!!", _
                           @"!####!!!!!!!!!####!!!!!!!!!!!!!!!!!!!!!!!!!!!!!%'%''%'%!!!!!!!!!", _
                           @"!####!!!!!!!!!####!!!!!!!!!!!!!!!!!!!!!!!!!!!!%'%''%'%!!!!!!!!!!", _
                           @"!####!!!!!!!!!####!!!!!!!!!!!!!!!!!!!!!!!!!!!%'%''%'%!!!!!!!!!!!", _
                           @"!####!!!!!!!!!####!!!!!!!!!!!!!!!!!!!!!!!!!!%'%''%'%!!!!!!!!!!!!", _
                           @"!####!!!!!!!!!####!!!!!!!!!!!!!!!!!!!!!!!!!%(%''%'%!!!!!!!!!!!!!", _
                           @"!####!!!!!!!!!####!!!!!!!!!!!!!!!!!!!!!!!!!%&%'%'%!!!!!!!!!!!!!!", _
                           @"!####!!!!!!!!!####!!!!!!!!!!!!!!!!!!!!!!!!%&)&%'%!!!!!!!!!!!!!!!", _
                           @"!####!!!!!!!!!####!!!!!!!!!!!!!!!!!!!!!!!!%%&)%%!!!!!!!!!!!!!!!!", _
                           @"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!%%%%!!!!!!!!!!!!!!!!!!", _
                           @"!!!!!!!!!!!!!!!!!!!!!!!!!!''''''''''''!!!!!!!!!!!!!!!!!!!!!!!!!!", _
                           @"!!!!!!!!!!!!!!!!!!!!!!!!!''''''''''''''!!!!!!!!!!!!!!!!!!!!!!!!!", _
                           @"!!!!!!!!!!!!!!!!!!!!!!!!''''''''''''''''!!!!!!!!!!!!!!!!!!!!!!!!", _
                           @"!!!!!!!!!!!!!!!!!!!!!!!!''''''''''''''''!!!!!!!!!!!!!!!!))))))!!", _
                           @"!!!!!!!!!!!!!!!!!!!!!!!!''''!!''''!!''''!!!!!!!!!!!!!)))!!!))!!!", _
                           @"!!!!!!!!!!!!!!!!!!!!!!!!''''!!''''!!''''!!!!!!!!!!!)))!!)))!!!!!", _
                           @"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!''''!!!!!!!!!!!!!!!)))!)))!!!!!!!!", _
                           @"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!''''!!!!!!!!!!!!!!#*******#!!!!!!!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!''''!!!!!!!!!!!!!!*&&$&$$#****!!!!", _
                           @"!&%%%%%%%%%&&&&&&%%%%%%%%&!!!!''''!!!!!!!!!!!!!!*&&&$&$#*$&$*!!!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!''''!!!!!!!!!!!!!!*&&$&$$#***$*!!!", _
                           @"!&%%%%%%%%%&&&&&&&&&&&&&&&!!!!''''!!!!!!!!!!!!!!*&&&$&$#*!*$*!!!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!''''!!!!!!!!!!!!!!*&&$&$$#*!*$*!!!", _
                           @"!&%%%%%%%%%&&&&&&&&&&&&&&&!!!!''''!!!!!!!!!!!!!!*&&&$&$#***$*!!!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!''''!!!!!!!!!!!!!!*&&$&$$#*$&$*!!!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!''''!!!!!!!!!!!!!!*&&&$&$#****!!!!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!''''!!!!!!!!!!!!!!#*******#!!!!!!!", _
                           @"!&%%%%%%%%%%%%%%%&&&&&&&&&!!!!''''!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!''''!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", _
                           @"!&%%%%%%%%%%%%%%%%%%%%%%%&!!!!''''!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", _
                           @"!&%%%%%%%%%%%%%%%%%%%%%%%&!!!!!!!!!!!!!!!!!!!!!!!++++++++++++++!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!!!!!!!!!!!!!!!!!!!+++++++++++++++!", _
                           @"!&#######################&!!!!!!!!!!!!!!!!!!!!!++++++++++++++++!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!!!!!!!!!!!!!!!!!!++++++++++++++++!", _
                           @"!&#######################&!!!!!!!!!!!!!!!!!!!!!++++!!!!!!!!!!!!!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!!!!!!!!!!!!!!!!!!++++!!!!!!!!!!!!!", _
                           @"!&#######################&!!!!!!!!!!!!!!!!!!!!!++++!!!!!!!!!!!!!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!!!!!!!!!!!!!!!!!!++++!!!!!!!!!!!!!", _
                           @"!&,,,,,,,,,,,,,&%%%%&&&&&&!!!!!!!!!!!!!!!!!!!!!+++++++++++!!!!!!", _
                           @"!&&&&&&&&&&&&&&&%&&%&&&&&&!!!!!!!!!!!!!!!!!!!!!+++++++++++!!!!!!", _
                           @"!&,,,,,,,,,,,,,&%%%%&&&&&&!!!!!!!!!!!!!!!!!!!!!+++++++++++!!!!!!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!!!!!!!!!!!!!!!!!!+++++++++++!!!!!!", _
                           @"!&!!!!!!!!!!!!!!!!!!!!!!!&!!!!!!!!!!!!!!!!!!!!!++++!!!!!!!!!!!!!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!!!!!!!!!!!!!!!!!!++++!!!!!!!!!!!!!", _
                           @"!&!!!!!!!!!!!!!!!!!!!!!!!&!!!!!!!!!!!!!!!!!!!!!++++!!!!!!!!!!!!!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!!!!!!!!!!!!!!!!!!++++!!!!!!!!!!!!!", _
                           @"!&!!!!!!!!!!&&&&&&&&&&&&&&!!!!!!!!!!!!!!!!!!!!!++++++++++++++++!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!!!!!!!!!!!!!!!!!!++++++++++++++++!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!!!!!!!!!!!!!!!!!!!+++++++++++++++!", _
                           @"!&&&&&&&&&&&&&&&&&&&&&&&&&!!!!!!!!!!!!!!!!!!!!!!!++++++++++++++!", _
                           @"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"}

'- Icon aus xpm Datei laden
  p_mte_icon_pixbuf  = gdk_pixbuf_new_from_xpm_data (Cast(Zstring Ptr Ptr, @p_mte_icon16(0)))

'----------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'- rieselkalk 2010
'- mte_dialoge_103.bas
'- UTF8 Zeichensatz Ä 195 132, Ö 195 150, Ü 195 156, ß 195 159, ä 195 164, ö 195 182, ü 195 188    


'#########################################################################################
'- Message Box Dialog
Function mte_MsgBox (p_text As gchar Ptr, p_caption As gchar Ptr, yesno As gboolean) As gint
  Dim As GtkWidget Ptr dialog_1
  Dim Res As gint

  mte_MsgBox = TRUE
  If yesno = TRUE Then
    dialog_1 = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, _
                                       GTK_MESSAGE_INFO, GTK_BUTTONS_YES_NO, _
                                       p_text )
  Else
    dialog_1 = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, _
                                       GTK_MESSAGE_INFO, GTK_BUTTONS_OK, _
                                       p_text )
  Endif                                    
  gtk_window_set_title (GTK_WINDOW (dialog_1), p_caption)
  gtk_window_set_position (GTK_WINDOW (dialog_1), GTK_WIN_POS_CENTER)  
  gtk_window_set_icon (GTK_WINDOW (dialog_1), p_mte_icon_pixbuf)

  Res = gtk_dialog_run (GTK_DIALOG (dialog_1))                    
  If (Res = GTK_RESPONSE_YES) Or (Res = GTK_RESPONSE_OK) Then
    mte_MsgBox = TRUE
  Else  
    mte_MsgBox = FALSE
  EndIf
  gtk_widget_destroy (dialog_1)
End Function

'#########################################################################################
'- Color Dialog
Function mte_ShowColorDialog(ByRef p_colorvalue As gchar Ptr) As gint
    Dim Res As gint
    Dim my_color As GdkColor
    Dim p_colorsel As GtkColorSelection Ptr
    Dim my_red As guint8
    Dim my_green As guint8
    Dim my_blue As guint8
  Dim p_color_dialog As GtkWidget Ptr
  
  mte_ShowColorDialog = TRUE
    
  p_color_dialog = gtk_color_selection_dialog_new("Schrift Farbe")
  gtk_window_set_icon (GTK_WINDOW (p_color_dialog), p_mte_icon_pixbuf)

  Res = gtk_dialog_run(GTK_DIALOG(p_color_dialog))

  If Res = GTK_RESPONSE_OK Then

    p_colorsel = GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(p_color_dialog)->colorsel)
    
    gtk_color_selection_get_current_color(p_colorsel, @my_color)
    
    my_red = my_color.red/257
    my_green = my_color.green/257
    my_blue = my_color.blue/257
    
    p_colorvalue = g_strdup_printf("#%02X%02X%02X", my_red, my_green, my_blue)
    mte_ShowColorDialog = TRUE
  Else
    mte_ShowColorDialog = FALSE
  EndIf
    gtk_widget_destroy(p_color_dialog)

Ausgang:
  If p_colorsel <> NULL Then
    g_free(p_colorsel)
  EndIf    
End Function

'#########################################################################################
'- Font Dialog
Function mte_ShowFontDialog(ByRef p_fontname As gchar Ptr) As gint
    Dim Res As gint
    Dim p_font_desc As PangoFontDescription Ptr
    Dim p_font_dialog As GtkWidget Ptr
    
    mte_ShowFontDialog = TRUE
    
    p_font_dialog =gtk_font_selection_dialog_new("Schrift Font")
    gtk_window_set_icon (GTK_WINDOW (p_font_dialog), p_mte_icon_pixbuf)

    Res = gtk_dialog_run(GTK_DIALOG(p_font_dialog))
    If (Res = GTK_RESPONSE_OK) Or (Res = GTK_RESPONSE_APPLY) Then
        p_fontname = gtk_font_selection_dialog_get_font_name _
                     (GTK_FONT_SELECTION_DIALOG(p_font_dialog))
        p_font_desc = pango_font_description_from_string(p_fontname)
                    
    EndIf
    gtk_widget_destroy(p_font_dialog)
    
Ausgang:
  If p_font_desc <> NULL Then
    g_free(p_font_desc)
  EndIf    
  If p_font_desc <> NULL Then
    pango_font_description_free(p_font_desc)
  EndIf    
End Function

'#########################################################################################
'- About Dialog

'- Der Spende Button wurde gedrückt
Sub mte_on_menuitem_dialoge_spendebutton_activate Cdecl (ByVal widget as GtkWidget ptr, Byval p_ud as gpointer Ptr)
  Dim p_msg As gchar Ptr
  p_msg  = g_strconcat(@"Gerne nehme ich eine kleine Spende an.", @Chr(13), @Chr(10), _
                                         @"PAYPAL: geschenke@dcde.de", @Chr(13), @Chr(10), _
                                         @"!!! DANKE !!!", NULL)
  mte_MsgBox (p_msg, @"Spenden", FALSE)
End Sub  
Sub mte_on_menuitem_dialoge_okbutton_activate Cdecl (ByVal widget as GtkWidget ptr, Byval p_ud as gpointer Ptr)
  gtk_widget_destroy(p_ud)
End Sub
Sub mte_ShowAbout ()
  Dim As GtkWidget Ptr p_dialog_about
  Dim As GtkWidget Ptr p_dialog_vbox_about
  Dim As GtkWidget Ptr p_fixed_about
  Dim As GtkWidget Ptr p_entry_Version
  Dim As GdkPixbuf Ptr p_pixbuf_about
  Dim As GtkWidget Ptr p_image_about
  Dim As GtkWidget Ptr p_viewport_copyright
  Dim As GtkWidget Ptr p_scrolledwindow_copyright
  Dim As GtkWidget Ptr p_textview_copyright
  Dim As GtkWidget Ptr p_viewport_info
  Dim As GtkWidget Ptr p_scrolledwindow_info
  Dim As GtkWidget Ptr p_textview_info
  Dim As GtkWidget Ptr p_dialog_action_area_about
  Dim As GtkWidget Ptr p_button_spende
  Dim As GtkWidget Ptr p_button_ok
  
  Dim p_msg As gchar Ptr
  
  p_dialog_about = gtk_dialog_new ()
  gtk_window_set_title (GTK_WINDOW (p_dialog_about), Chr(195)+Chr(156)+"ber...")
  gtk_window_set_modal (GTK_WINDOW (p_dialog_about), TRUE)
  gtk_window_set_resizable (GTK_WINDOW (p_dialog_about), FALSE)
  gtk_window_set_icon (GTK_WINDOW (p_dialog_about), p_mte_icon_pixbuf)
  gtk_window_set_position (GTK_WINDOW (p_dialog_about), GTK_WIN_POS_CENTER)

  p_dialog_vbox_about = GTK_DIALOG (p_dialog_about)->vbox
  gtk_widget_show (p_dialog_vbox_about)

  p_fixed_about = gtk_fixed_new ()
  gtk_widget_show (p_fixed_about)
  gtk_box_pack_start (GTK_BOX (p_dialog_vbox_about), p_fixed_about, TRUE, TRUE, 0)
  gtk_container_set_border_width (GTK_CONTAINER (p_fixed_about), 3)

  p_entry_Version = gtk_entry_new ()
  gtk_widget_show (p_entry_Version)
  gtk_fixed_put (GTK_FIXED (p_fixed_about), p_entry_Version, 104, 0)
  gtk_widget_set_usize (p_entry_Version, 229, 21)
  gtk_entry_set_editable (GTK_ENTRY (p_entry_Version), FALSE)
  gtk_entry_set_text (GTK_ENTRY (p_entry_Version), ("MTE Version 103"))
  gtk_entry_set_invisible_char (GTK_ENTRY (p_entry_Version), 9679)

  p_pixbuf_about  = gdk_pixbuf_new_from_xpm_data (Cast(Zstring Ptr Ptr, @p_mte_icon64(0)))
  p_image_about = gtk_image_new_from_pixbuf (p_pixbuf_about)
  gtk_widget_show (p_image_about)
  gtk_fixed_put (GTK_FIXED (p_fixed_about), p_image_about, 16, 16)
    
  p_viewport_copyright = gtk_viewport_new (NULL, NULL)
  gtk_widget_show (p_viewport_copyright)
  gtk_fixed_put (GTK_FIXED (p_fixed_about), p_viewport_copyright, 104, 24)
  gtk_widget_set_usize (p_viewport_copyright, 229, 69)

  p_textview_copyright = gtk_text_view_new ()
  gtk_widget_show (p_textview_copyright)
  gtk_container_add (GTK_CONTAINER (p_viewport_copyright), p_textview_copyright)
  gtk_text_view_set_editable (GTK_TEXT_VIEW (p_textview_copyright), FALSE)
  gtk_text_view_set_justification (GTK_TEXT_VIEW (p_textview_copyright), GTK_JUSTIFY_CENTER)
  gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (p_textview_copyright), FALSE)
  p_msg  = g_strconcat(@"Copyright by", @Chr(13), @Chr(10), _
                       @"Siegfried Schrader", @Chr(13), @Chr(10), _
                       @"2010", @Chr(13), @Chr(10),NULL)
  gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (p_textview_copyright)), p_msg, -1)

  p_viewport_info = gtk_viewport_new (NULL, NULL)
  gtk_widget_show (p_viewport_info)
  gtk_fixed_put (GTK_FIXED (p_fixed_about), p_viewport_info, 0, 96)
  gtk_widget_set_usize (p_viewport_info, 333, 80)

  p_scrolledwindow_info = gtk_scrolled_window_new (NULL, NULL)
  gtk_widget_show (p_scrolledwindow_info)
  gtk_container_add (GTK_CONTAINER (p_viewport_info), p_scrolledwindow_info)
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (p_scrolledwindow_info), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC)

  p_textview_info = gtk_text_view_new ()
  gtk_widget_show (p_textview_info)
  gtk_container_add (GTK_CONTAINER (p_scrolledwindow_info), p_textview_info)
  gtk_text_view_set_editable (GTK_TEXT_VIEW (p_textview_info), FALSE)
  gtk_text_view_set_justification (GTK_TEXT_VIEW (p_textview_info), GTK_JUSTIFY_CENTER)
  gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (p_textview_info), FALSE)
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (p_textview_info), GTK_WRAP_WORD)
  p_msg  = g_strconcat(@"MTE ist eine kleine Demo Anwendung,", @Chr(13), @Chr(10), _
                                         @"programmiert mit GTK und FreeBasic.", @Chr(13), @Chr(10), _
                       @"Software Entwicklung ist nicht kostenlos.", @Chr(13), @Chr(10), _
                       @"Gerne nehme ich eine kleine Spende an.", @Chr(13), @Chr(10),NULL)
  gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (p_textview_info)), p_msg, -1)
    
  p_dialog_action_area_about = GTK_DIALOG (p_dialog_about)->action_area
  gtk_widget_show (p_dialog_action_area_about)
  gtk_button_box_set_layout (GTK_BUTTON_BOX (p_dialog_action_area_about), GTK_BUTTONBOX_END)

  p_button_spende = gtk_button_new_with_mnemonic ("spenden")
  gtk_widget_show (p_button_spende)
  gtk_dialog_add_action_widget (GTK_DIALOG (p_dialog_about), p_button_spende, 0)
  GTK_WIDGET_SET_FLAGS (p_button_spende, GTK_CAN_DEFAULT)

  p_button_ok = gtk_button_new_with_mnemonic ("OK")
  gtk_widget_show (p_button_ok)
  gtk_dialog_add_action_widget (GTK_DIALOG (p_dialog_about), p_button_ok, 0)
  GTK_WIDGET_SET_FLAGS (p_button_ok, GTK_CAN_DEFAULT)

'- Signale
  gtk_signal_connect (GTK_OBJECT (p_button_spende), "clicked", _
                      GTK_SIGNAL_FUNC (@mte_on_menuitem_dialoge_spendebutton_activate), NULL)

  gtk_signal_connect (GTK_OBJECT (p_button_ok), "clicked", _
                      GTK_SIGNAL_FUNC (@mte_on_menuitem_dialoge_okbutton_activate), p_dialog_about)
                      
  gtk_widget_show_all(p_dialog_about)
End Sub

Sub mte_ShowHilfe ()
  Dim text As String
  Dim As GtkWidget Ptr dialog_1
  text = "Folgende Tasten sind belegt:" + Chr(13) + Chr(10) + Chr(13) + Chr(10) +_
         "ALT + A    Anzeige" + Chr(13) + Chr(10) + _
         "ALT + B    Bearbeiten" + Chr(13) + Chr(10) + _
         "ALT + D    Datum einf"+Chr(195)+Chr(188)+ "gen" + Chr(13) + Chr(10) + _
         "ALT + F    Format" + Chr(13) + Chr(10) + _
         "ALT + H    Hilfe" + Chr(13) + Chr(10) + _
         "Ctrl + A   Datei speichern als" + Chr(13) + Chr(10) + _
         "Ctrl + C   Copy" + Chr(13) + Chr(10) + _
         "Ctrl + D   Datum einf"+Chr(195)+Chr(188)+"gen" + Chr(13) + Chr(10) + _
         "Ctrl + E   Markierung entfernen" + Chr(13) + Chr(10) + _
         "Ctrl + F   Suchen" + Chr(13) + Chr(10) + _
         "Ctrl + H   Ersetzen" + Chr(13) + Chr(10) + _
         "Ctrl + M   Alles markieren" + Chr(13) + Chr(10) + _
         "Ctrl + N   Neu" + Chr(13) + Chr(10) + _
         "Ctrl + O   Datei "+Chr(195)+Chr(182)+"ffnen" + Chr(13) + Chr(10) + _
         "Ctrl + P   Datei drucken" + Chr(13) + Chr(10) + _
         "Ctrl + Q   Programm beenden" + Chr(13) + Chr(10) + _
         "Ctrl + S   Datei speichern" + Chr(13) + Chr(10) + _
         "Ctrl + T   Schriftart" + Chr(13) + Chr(10) + _
         "Ctrl + U   Uhrzeit einf"+Chr(195)+Chr(188)+"gen" + Chr(13) + Chr(10) + _
         "Ctrl + V   Aus Zwischenablage einf"+Chr(195)+Chr(188)+"gen" + Chr(13) + Chr(10) + _
         "Ctrl + X   Ausschneiden" + Chr(13) + Chr(10) + _
         "Ctrl + Z   Zeilenumbruch"
                  
  dialog_1 = gtk_message_dialog_new (GTK_WINDOW (mte.p_window_1), GTK_DIALOG_MODAL, _
                                     GTK_MESSAGE_INFO, GTK_BUTTONS_OK, _
                                     text )
  gtk_window_set_title (GTK_WINDOW (dialog_1), "Hilfe...")
  gtk_window_set_position (GTK_WINDOW (dialog_1), GTK_WIN_POS_CENTER)                        
  gtk_dialog_run (GTK_DIALOG (dialog_1))
  gtk_widget_destroy (dialog_1)
End Sub
'----------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------


'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'- rieselkalk 2010
'- mte_find_103.bas
' =============================================================================
'- UTF8 Zeichensatz Ä 195 132, Ö 195 150, Ü 195 156, ß 195 159, ä 195 164, ö 195 182, ü 195 188

'- mte_find
'- Type für die find Daten
Type t_mte_f
  As GtkWidget Ptr p_dialog_find
  As GtkWidget Ptr p_entry_find
  As GtkWidget Ptr p_checkbutton_word
  As GtkWidget Ptr p_checkbutton_upper_lower    
End Type

  '- Find Variablen anlegen
  Dim Shared mte_f As t_mte_f
  Dim Shared p_mte_f As t_mte_f Ptr
  p_mte_f = @mte_f  
  
'- Zeichenkette suchen  
function mte_find_findtext() As gint
    Dim p_search As gchar Ptr
    Dim iter_top As GtkTextIter
  Dim iter_botton   As GtkTextIter
  Dim iter_start As GtkTextIter
  Dim found As gboolean                                
    Dim p_mark_lastpos As GtkTextMark Ptr

    mte_find_findtext = TRUE
    
    '- Text vom Such entry holen
    p_search = gtk_entry_get_text(GTK_ENTRY(p_mte_f->p_entry_find))
    '- Fals vorhanden Marker holen
    p_mark_lastpos = gtk_text_buffer_get_mark (p_mte->p_buffer_1, "lastpos")
    '- Prüfen ob Marker vorhanden
    If p_mark_lastpos = NULL Then
      '- den anfang vom Text Buffer holen und Iter setzen
      gtk_text_buffer_get_start_iter (p_mte->p_buffer_1, @iter_start)
    Else
        '- Iter an Mark Position setzen
        gtk_text_buffer_get_iter_at_mark (p_mte->p_buffer_1, @iter_start, p_mark_lastpos)
    EndIf
    
    '- Text Buffer durchsuchen
    found = gtk_text_iter_forward_search (@iter_start, p_search, 0, @iter_top, @iter_botton, NULL)
  '- wurde die Such Zeichenkette gefunden, dann markieren
  If found = TRUE Then
    gtk_text_buffer_select_range(p_mte->p_buffer_1, @iter_top, @iter_botton)
    '-Überprüfen ob Marker vorhanden, dann entfernen
    If p_mark_lastpos <> NULL Then
        gtk_text_buffer_delete_mark_by_name (p_mte->p_buffer_1, "lastpos")
    EndIf
        '- neuen Marker setzen
    gtk_text_buffer_create_mark (p_mte->p_buffer_1, "lastpos", @iter_botton, FALSE)
    '- Gefundenes richtig im Fenster darstellen
    p_mark_lastpos = gtk_text_buffer_get_mark (p_mte->p_buffer_1, "lastpos")
    gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW(p_mte->p_textview_1), p_mark_lastpos, 0, TRUE, 0.2, 0.2)
  Else
    mte_MsgBox (@"Das Textende wurde erreicht", @"Suchergebnis", FALSE)
    mte_find_findtext = FALSE
  EndIf
  
  
End Function

'- Der Find Button wurde gedrückt
Sub mte_on_menuitem_find_findbutton_activate Cdecl (ByVal widget as GtkWidget ptr, Byval p_ud As gpointer Ptr)
  Dim Res As gint
  Res = mte_find_findtext()
  If Res = FALSE Then
    gtk_widget_destroy(GTK_WIDGET(p_mte_f->p_dialog_find))
  EndIf
End Sub

'- Der Chancel Button wurde gedrückt
Sub mte_on_menuitem_find_cancelbutton_activate Cdecl (ByVal widget as GtkWidget ptr, Byval p_ud as gpointer Ptr)
  gtk_widget_destroy(GTK_WIDGET(p_mte_f->p_dialog_find))
End Sub  


Function mte_ShowFindDialog () As gint

  mte_ShowFindDialog = TRUE

  Dim As GtkWidget Ptr p_dialog_vbox_1
  Dim As GtkWidget Ptr p_fixed_find
  Dim As GtkWidget Ptr p_label_1
  Dim As GtkWidget Ptr p_button_find
  Dim As GtkWidget Ptr p_button_cancel
  Dim As GtkWidget Ptr p_dialog_action_area_1
  Dim p_msg As gchar Ptr
  
'- Fals vorhandene Marke lastpos im Text Buffer dann entfernen  
  Dim p_mark_lastpos As GtkTextMark Ptr
    '- Fals vorhanden Marker holen
    p_mark_lastpos = gtk_text_buffer_get_mark (p_mte->p_buffer_1, "lastpos")
    '- Prüfen ob Marker vorhanden
  If p_mark_lastpos <> NULL Then
    gtk_text_buffer_delete_mark_by_name (p_mte->p_buffer_1, "lastpos")
    g_free(p_mark_lastpos)
  EndIf

  p_mte_f->p_dialog_find = gtk_dialog_new ()
  gtk_widget_set_name (p_mte_f->p_dialog_find, "p_dialog_find")
  gtk_window_set_title (GTK_WINDOW (p_mte_f->p_dialog_find), ("Suchen"))
  gtk_window_set_resizable (GTK_WINDOW (p_mte_f->p_dialog_find), FALSE)
  gtk_dialog_set_has_separator (GTK_DIALOG (p_mte_f->p_dialog_find), FALSE)
  gtk_window_set_position (GTK_WINDOW (p_mte_f->p_dialog_find), GTK_WIN_POS_CENTER)
  gtk_window_set_icon (GTK_WINDOW (p_mte_f->p_dialog_find), p_mte_icon_pixbuf)

  p_dialog_vbox_1 = GTK_DIALOG (p_mte_f->p_dialog_find)->vbox
  gtk_widget_set_name (p_dialog_vbox_1, "p_dialog_vbox_1")
  gtk_widget_show (p_dialog_vbox_1)

  p_fixed_find = gtk_fixed_new ()
  gtk_widget_set_name (p_fixed_find, "p_fixed_find")
  gtk_widget_show (p_fixed_find)
  gtk_box_pack_start (GTK_BOX (p_dialog_vbox_1), p_fixed_find, TRUE, TRUE, 0)
  gtk_container_set_border_width (GTK_CONTAINER (p_fixed_find), 6)

  p_mte_f->p_entry_find = gtk_entry_new ()
  gtk_widget_set_name (p_mte_f->p_entry_find, "p_entry_find")
  gtk_widget_show (p_mte_f->p_entry_find)
  gtk_fixed_put (GTK_FIXED (p_fixed_find), p_mte_f->p_entry_find, 104, 0)
  gtk_widget_set_usize (p_mte_f->p_entry_find, 202, 26)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_f->p_entry_find, ("Die Zeichenkette die gefunden werden soll"), NULL)
  gtk_entry_set_invisible_char (GTK_ENTRY (p_mte_f->p_entry_find), 9679)

  p_label_1 = gtk_label_new (("Suchen nach:"))
  gtk_widget_set_name (p_label_1, "p_label_1")
  gtk_widget_show (p_label_1)
  gtk_fixed_put (GTK_FIXED (p_fixed_find), p_label_1, 0, 0)
  gtk_widget_set_usize (p_label_1, 106, 26)
  gtk_label_set_justify (GTK_LABEL (p_label_1), GTK_JUSTIFY_RIGHT)

  p_button_find = gtk_button_new_with_mnemonic (("Weitersuchen"))
  gtk_widget_set_name (p_button_find, "p_button_find")
  gtk_widget_show (p_button_find)
  gtk_fixed_put (GTK_FIXED (p_fixed_find), p_button_find, 312, 0)
  gtk_widget_set_usize (p_button_find, 88, 24)

  p_button_cancel = gtk_button_new_with_mnemonic (("Abbrechen"))
  gtk_widget_set_name (p_button_cancel, "p_button_cancel")
  gtk_widget_show (p_button_cancel)
  gtk_fixed_put (GTK_FIXED (p_fixed_find), p_button_cancel, 312, 32)
  gtk_widget_set_usize (p_button_cancel, 88, 24)

  p_mte_f->p_checkbutton_word = gtk_check_button_new_with_mnemonic (("Nur ganzes Wort suchen"))
  gtk_widget_set_name (p_mte_f->p_checkbutton_word, "p_checkbutton_word")
  gtk_widget_show (p_mte_f->p_checkbutton_word)
  gtk_fixed_put (GTK_FIXED (p_fixed_find), p_mte_f->p_checkbutton_word, 0, 32)
  gtk_widget_set_usize (p_mte_f->p_checkbutton_word, 224, 24)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_f->p_checkbutton_word, ("Zeichenkette wird nur nach ganze Worte durchsucht"), NULL)

  p_msg  = g_strconcat(@"Gro", @Chr(195), @Chr(159), @"-/Kleinschreibung" ,NULL)
  p_mte_f->p_checkbutton_upper_lower = gtk_check_button_new_with_mnemonic (p_msg)
  g_free(p_msg)
  gtk_widget_set_name (p_mte_f->p_checkbutton_upper_lower, "p_checkbutton_upper_lower")
  gtk_widget_show (p_mte_f->p_checkbutton_upper_lower)
  gtk_fixed_put (GTK_FIXED (p_fixed_find), p_mte_f->p_checkbutton_upper_lower, 0, 64)
  gtk_widget_set_usize (p_mte_f->p_checkbutton_upper_lower, 224, 24)
  p_msg  = g_strconcat(@"Gro", @Chr(195), @Chr(159), @"- und Kleinschreibung wird ber", @Chr(195), @Chr(188), @"cksichtigt" ,NULL)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_f->p_checkbutton_upper_lower, p_msg, NULL)
  g_free(p_msg)

  p_dialog_action_area_1 = GTK_DIALOG (p_mte_f->p_dialog_find)->action_area
  gtk_widget_set_name (p_dialog_action_area_1, "p_dialog_action_area_1")
  gtk_widget_show (p_dialog_action_area_1)
  gtk_button_box_set_layout (GTK_BUTTON_BOX (p_dialog_action_area_1), GTK_BUTTONBOX_END)
  
  
'- Signale
  gtk_signal_connect (GTK_OBJECT (p_button_find), "clicked", _
                      GTK_SIGNAL_FUNC (@mte_on_menuitem_find_findbutton_activate), NULL)

  gtk_signal_connect (GTK_OBJECT (p_button_cancel), "clicked", _
                      GTK_SIGNAL_FUNC (@mte_on_menuitem_find_cancelbutton_activate), NULL)

  gtk_widget_show_all (p_mte_f->p_dialog_find)

End Function

'----------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------
                      

'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'- rieselkalk 2010
'- mte_replace_103.bas
' =============================================================================
'- UTF8 Zeichensatz Ä 195 132, Ö 195 150, Ü 195 156, ß 195 159, ä 195 164, ö 195 182, ü 195 188


'- mte_replace
'- Type für die replace Daten
Type t_mte_r
  As GtkWidget Ptr p_dialog_replace
  As GtkWidget Ptr p_entry_find
  As GtkWidget Ptr p_entry_replace
  As GtkWidget Ptr p_checkbutton_word
  As GtkWidget Ptr p_checkbutton_upper_lower    
End Type

  '- Replace Variablen anlegen
  Dim Shared mte_r As t_mte_r
  Dim Shared p_mte_r As t_mte_r Ptr
  p_mte_r = @mte_r
  
'- Zeichenkette suchen  
function mte_replace_findtext() As gint
    Dim p_search As gchar Ptr
    Dim iter_top As GtkTextIter
  Dim iter_botton   As GtkTextIter
  Dim iter_start As GtkTextIter
  Dim found As gboolean
    Dim p_mark_firstpos As GtkTextMark Ptr
    Dim p_mark_lastpos As GtkTextMark Ptr

    mte_replace_findtext = TRUE
    
    '- Text vom Such entry holen
    p_search = gtk_entry_get_text(GTK_ENTRY(p_mte_r->p_entry_find))
    '- Fals vorhanden Marker holen
    p_mark_firstpos = gtk_text_buffer_get_mark (p_mte->p_buffer_1, "firstpos")
    p_mark_lastpos = gtk_text_buffer_get_mark (p_mte->p_buffer_1, "lastpos")
    '- Prüfen ob Marker vorhanden
    If p_mark_lastpos = NULL Then
      '- den anfang vom Text Buffer holen und Iter setzen
      gtk_text_buffer_get_start_iter (p_mte->p_buffer_1, @iter_start)
    Else
        '- Iter an Mark Position setzen
        gtk_text_buffer_get_iter_at_mark (p_mte->p_buffer_1, @iter_start, p_mark_lastpos)
    EndIf  
    '- Text Buffer durchsuchen
    found = gtk_text_iter_forward_search (@iter_start, p_search, 0, @iter_top, @iter_botton, NULL)
  '- wurde die Such Zeichenkette gefunden, dann markieren
  If found = TRUE Then
    '- festhalten das Zeichenkette gefunden wurde
    gtk_text_buffer_select_range(p_mte->p_buffer_1, @iter_top, @iter_botton)
    '-Überprüfen ob Marker vorhanden, dann entfernen
    If p_mark_firstpos <> NULL Then
        gtk_text_buffer_delete_mark_by_name (p_mte->p_buffer_1, "firstpos")
    EndIf
    If p_mark_lastpos <> NULL Then
        gtk_text_buffer_delete_mark_by_name (p_mte->p_buffer_1, "lastpos")
    EndIf  
        '- neue Marker setzen
    gtk_text_buffer_create_mark (p_mte->p_buffer_1, "firstpos", @iter_top, FALSE)      
    gtk_text_buffer_create_mark (p_mte->p_buffer_1, "lastpos", @iter_botton, FALSE)
    '- Gefundenes richtig im Fenster darstellen
    p_mark_lastpos = gtk_text_buffer_get_mark (p_mte->p_buffer_1, "lastpos")
    gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW(p_mte->p_textview_1), p_mark_lastpos, 0, TRUE, 0.2, 0.2)

  Else
    '- Das Ende des Text Buffers wurde erreicht
    mte_MsgBox (@"Das Textende wurde erreicht", @"Suchergebnis", FALSE)
    mte_replace_findtext = FALSE
  EndIf
End Function

'- Zeichenkette ersetzen
function mte_replace_replacetext() As gint
  Dim p_mark_firstpos As GtkTextMark Ptr
  Dim iter_start As GtkTextIter
  Dim p_replace As gchar Ptr

  mte_replace_replacetext = TRUE
  '- Marker aus Text Buffer holen
  p_mark_firstpos = gtk_text_buffer_get_mark (p_mte->p_buffer_1, "firstpos")
  If p_mark_firstpos <> NULL Then
    '- Markierten Bereich löschen
    gtk_text_buffer_delete_selection(p_mte->p_buffer_1, FALSE, TRUE)
    '- iter auf Marker Position setzen
        gtk_text_buffer_get_iter_at_mark (p_mte->p_buffer_1, @iter_start, p_mark_firstpos)
    '- Zeichenkette vom Replace entry holen
      p_replace = gtk_entry_get_text(GTK_ENTRY(p_mte_r->p_entry_replace))
      '- Zeichenkette in den Text Buffer einfügen
    gtk_text_buffer_insert(p_mte->p_buffer_1, @iter_start, p_replace, -1)
  Else
    mte_replace_replacetext = FALSE
  EndIf    
End Function

'- Der Find Button wurde gedrückt
Sub mte_on_menuitem_replace_findbutton_activate Cdecl (ByVal widget as GtkWidget ptr, Byval p_ud As gpointer Ptr)
  Dim Res As gint
  Res = mte_replace_findtext()
  If Res = FALSE Then
    gtk_widget_destroy(GTK_WIDGET(p_mte_r->p_dialog_replace))
  EndIf
End Sub

'- Der Replace Button wurde gedrückt
Sub mte_on_menuitem_replace_replacebutton_activate Cdecl (ByVal widget as GtkWidget ptr, Byval p_ud as gpointer Ptr)
  Dim Res As gint
  '- Markierten Text ersetzen
  Res = mte_replace_replacetext()
  '- Neue Zeichenkette suchen
  Res = mte_replace_findtext()
  If Res = FALSE Then
    gtk_widget_destroy(GTK_WIDGET(p_mte_r->p_dialog_replace))
  EndIf  
End Sub  

'- Der Replace All Button wurde gedrückt
Sub mte_on_menuitem_replace_replaceallbutton_activate Cdecl (ByVal widget as GtkWidget ptr, Byval p_ud as gpointer Ptr)
  Dim Res As gint

  '- Neue Zeichenkette suchen
  Res = mte_replace_findtext()
  
  Do While Res = TRUE
    '- Markierten Text ersetzen
    Res = mte_replace_replacetext()
    '- Neue Zeichenkette suchen
    Res = mte_replace_findtext()
  Loop
  
  gtk_widget_destroy(GTK_WIDGET(p_mte_r->p_dialog_replace))
End Sub  

'- Der Chancel Button wurde gedrückt
Sub mte_on_menuitem_replace_cancelbutton_activate Cdecl (ByVal widget as GtkWidget ptr, Byval p_ud as gpointer Ptr)
  gtk_widget_destroy(GTK_WIDGET(p_mte_r->p_dialog_replace))
End Sub  

Function mte_ShowReplaceDialog () As gint

  mte_ShowReplaceDialog = TRUE

  Dim As GtkWidget Ptr p_dialog_vbox_1
  Dim As GtkWidget Ptr p_fixed_find
  Dim As GtkWidget Ptr p_label_find
  Dim As GtkWidget Ptr p_label_replace
  Dim As GtkWidget Ptr p_button_find
  Dim As GtkWidget Ptr p_button_replace
  Dim As GtkWidget Ptr p_button_replace_all
  Dim As GtkWidget Ptr p_button_cancel
  Dim As GtkWidget Ptr p_dialog_action_area_1
  Dim p_msg As gchar Ptr


'- Fals vorhandene Marke lastpos im Text Buffer dann entfernen  
  Dim p_mark_lastpos As GtkTextMark Ptr
    '- Fals vorhanden Marker holen
    p_mark_lastpos = gtk_text_buffer_get_mark (p_mte->p_buffer_1, "lastpos")
    '- Prüfen ob Marker vorhanden
  If p_mark_lastpos <> NULL Then
    gtk_text_buffer_delete_mark_by_name (p_mte->p_buffer_1, "lastpos")
    g_free(p_mark_lastpos)
  EndIf
  
  p_mte_r->p_dialog_replace = gtk_dialog_new ()
  gtk_widget_set_name (p_mte_r->p_dialog_replace, "p_dialog_replace")
  gtk_window_set_title (GTK_WINDOW (p_mte_r->p_dialog_replace), ("Suchen und ersetzen"))
  gtk_window_set_resizable (GTK_WINDOW (p_mte_r->p_dialog_replace), FALSE)
  gtk_dialog_set_has_separator (GTK_DIALOG (p_mte_r->p_dialog_replace), FALSE)
  gtk_window_set_position (GTK_WINDOW (p_mte_r->p_dialog_replace), GTK_WIN_POS_CENTER)
  gtk_window_set_icon (GTK_WINDOW (p_mte_r->p_dialog_replace), p_mte_icon_pixbuf)

  p_dialog_vbox_1 = GTK_DIALOG (p_mte_r->p_dialog_replace)->vbox
  gtk_widget_set_name (p_dialog_vbox_1, "p_dialog_vbox_1")
  gtk_widget_show (p_dialog_vbox_1)

  p_fixed_find = gtk_fixed_new ()
  gtk_widget_set_name (p_fixed_find, "p_fixed_find")
  gtk_widget_show (p_fixed_find)
  gtk_box_pack_start (GTK_BOX (p_dialog_vbox_1), p_fixed_find, TRUE, TRUE, 0)
  gtk_container_set_border_width (GTK_CONTAINER (p_fixed_find), 6)

  p_mte_r->p_entry_find = gtk_entry_new ()
  gtk_widget_set_name (p_mte_r->p_entry_find, "p_entry_find")
  gtk_widget_show (p_mte_r->p_entry_find)
  gtk_fixed_put (GTK_FIXED (p_fixed_find), p_mte_r->p_entry_find, 104, 0)
  gtk_widget_set_usize (p_mte_r->p_entry_find, 202, 26)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_r->p_entry_find, ("Die Zeichenkette die gefunden werden soll"), NULL)
  gtk_entry_set_invisible_char (GTK_ENTRY (p_mte_r->p_entry_find), 9679)

  p_label_find = gtk_label_new (("Suchen nach:"))
  gtk_widget_set_name (p_label_find, "p_label_find")
  gtk_widget_show (p_label_find)
  gtk_fixed_put (GTK_FIXED (p_fixed_find), p_label_find, 0, 0)
  gtk_widget_set_usize (p_label_find, 104, 24)
  gtk_label_set_justify (GTK_LABEL (p_label_find), GTK_JUSTIFY_RIGHT)

  p_mte_r->p_entry_replace = gtk_entry_new ()
  gtk_widget_set_name (p_mte_r->p_entry_replace, "p_entry_replace")
  gtk_widget_show (p_mte_r->p_entry_replace)
  gtk_fixed_put (GTK_FIXED (p_fixed_find), p_mte_r->p_entry_replace, 104, 32)
  gtk_widget_set_usize (p_mte_r->p_entry_replace, 202, 26)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_r->p_entry_replace, ("wird durch diese Zeichenkette ersetzt"), NULL)
  gtk_entry_set_invisible_char (GTK_ENTRY (p_mte_r->p_entry_replace), 9679)

  p_label_replace = gtk_label_new (("Ersetzen mit:"))
  gtk_widget_set_name (p_label_replace, "p_label_replace")
  gtk_widget_show (p_label_replace)
  gtk_fixed_put (GTK_FIXED (p_fixed_find), p_label_replace, 0, 32)
  gtk_widget_set_usize (p_label_replace, 104, 24)
  gtk_label_set_justify (GTK_LABEL (p_label_replace), GTK_JUSTIFY_RIGHT)

  p_button_find = gtk_button_new_with_mnemonic (("Weitersuchen"))
  gtk_widget_set_name (p_button_find, "p_button_find")
  gtk_widget_show (p_button_find)
  gtk_fixed_put (GTK_FIXED (p_fixed_find), p_button_find, 312, 0)
  gtk_widget_set_usize (p_button_find, 88, 24)

  p_button_replace = gtk_button_new_with_mnemonic (("Ersetzen"))
  gtk_widget_set_name (p_button_replace, "p_button_replace")
  gtk_widget_show (p_button_replace)
  gtk_fixed_put (GTK_FIXED (p_fixed_find), p_button_replace, 312, 32)
  gtk_widget_set_usize (p_button_replace, 88, 24)

  p_button_replace_all = gtk_button_new_with_mnemonic (("Alle ersetzen"))
  gtk_widget_set_name (p_button_replace_all, "p_button_replace_all")
  gtk_widget_show (p_button_replace_all)
  gtk_fixed_put (GTK_FIXED (p_fixed_find), p_button_replace_all, 312, 64)
  gtk_widget_set_usize (p_button_replace_all, 88, 24)

  p_button_cancel = gtk_button_new_with_mnemonic (("Abbrechen"))
  gtk_widget_set_name (p_button_cancel, "p_button_cancel")
  gtk_widget_show (p_button_cancel)
  gtk_fixed_put (GTK_FIXED (p_fixed_find), p_button_cancel, 312, 96)
  gtk_widget_set_usize (p_button_cancel, 88, 24)

  p_mte_r->p_checkbutton_word = gtk_check_button_new_with_mnemonic (("Nur ganzes Wort suchen"))
  gtk_widget_set_name (p_mte_r->p_checkbutton_word, "p_checkbutton_word")
  gtk_widget_show (p_mte_r->p_checkbutton_word)
  gtk_fixed_put (GTK_FIXED (p_fixed_find), p_mte_r->p_checkbutton_word, 0, 64)
  gtk_widget_set_usize (p_mte_r->p_checkbutton_word, 224, 24)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_r->p_checkbutton_word, ("Zeichenkette wird nur nach ganze Worte durchsucht"), NULL)

  p_msg  = g_strconcat(@"Gro", @Chr(195), @Chr(159), @"-/Kleinschreibung" ,NULL)
  p_mte_r->p_checkbutton_upper_lower = gtk_check_button_new_with_mnemonic (p_msg)
  g_free(p_msg)
  gtk_widget_set_name (p_mte_r->p_checkbutton_upper_lower, "p_checkbutton_upper_lower")
  gtk_widget_show (p_mte_r->p_checkbutton_upper_lower)
  gtk_fixed_put (GTK_FIXED (p_fixed_find), p_mte_r->p_checkbutton_upper_lower, 0, 96)
  gtk_widget_set_usize (p_mte_r->p_checkbutton_upper_lower, 224, 24)
  p_msg  = g_strconcat(@"Gro", @Chr(195), @Chr(159), @"- und Kleinschreibung wird ber", @Chr(195), @Chr(188), @"cksichtigt" ,NULL)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_r->p_checkbutton_upper_lower, p_msg, NULL)
  g_free(p_msg)

  p_dialog_action_area_1 = GTK_DIALOG (p_mte_r->p_dialog_replace)->action_area
  gtk_widget_set_name (p_dialog_action_area_1, "p_dialog_action_area_1")
  gtk_widget_show (p_dialog_action_area_1)
  gtk_button_box_set_layout (GTK_BUTTON_BOX (p_dialog_action_area_1), GTK_BUTTONBOX_END)
 



'- Signale
  gtk_signal_connect (GTK_OBJECT (p_button_find), "clicked", _
                      GTK_SIGNAL_FUNC (@mte_on_menuitem_replace_findbutton_activate), NULL)

  gtk_signal_connect (GTK_OBJECT (p_button_replace), "clicked", _
                      GTK_SIGNAL_FUNC (@mte_on_menuitem_replace_replacebutton_activate), NULL)

  gtk_signal_connect (GTK_OBJECT (p_button_replace_all), "clicked", _
                      GTK_SIGNAL_FUNC (@mte_on_menuitem_replace_replaceallbutton_activate), NULL)

  gtk_signal_connect (GTK_OBJECT (p_button_cancel), "clicked", _
                      GTK_SIGNAL_FUNC (@mte_on_menuitem_replace_cancelbutton_activate), NULL)

  gtk_widget_show_all (p_mte_r->p_dialog_replace)

End Function

'----------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------


'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'- rieselkalk 2010
'- mte_option_103.bas

'- An diesem Modul habe ich mir fast die Zähne ausgebissen. Wie bekommt man
'- die Daten zum Abschluß in die übergebenen Variable. Natürlich Parameter Übergabe
'- bei den Funktionen. Wollte aber nicht so klappen. So bin ich wieder bei der alten
'- Methode gebliebe. Shared Variablen. Dies ist so etwas, wo ich meinte, das viele Dinge nicht
'- in irgend welchen Tutorials stehen. Des weiteren kann man hier an diesem Modul
'- auch ganz gut den Unterschied zur Windows Programmierung mit VB erkennen.
' =============================================================================
'- UTF8 Zeichensatz Ä 195 132, Ö 195 150, Ü 195 156, ß 195 159, ä 195 164, ö 195 182, ü 195 188

'  GTK_PIXELS  Pixels.  
'  GTK_INCHES  Inches.  
'  GTK_CENTIMETERS  Centimeters.  

'  GTK_WRAP_NONE                                            '- Kein Umbruch
'  GTK_WRAP_CHAR                                            '- Zeichenweiser Umbruch
'  GTK_WRAP_WORD                                            '- Wortweiser Umbruch
'  GTK_WRAP_WORD_CHAR                                   '- Wortweiser Umbruch, um Zeichenweise erweitert

'  GTK_JUSTIFY_LEFT  The text is placed at the left edge of the label.  
'  GTK_JUSTIFY_RIGHT  The text is placed at the right edge of the label.  
'  GTK_JUSTIFY_CENTER  The text is placed in the center of the label.  
'  GTK_JUSTIFY_FILL  The text is placed is distributed across the label.  

'  GTK_ORIENTATION_HORIZONTAL  The widget is in horizontal orientation.  
'  GTK_ORIENTATION_VERTICAL  The widget is in vertical orientation.  


'- Option Variablen Wert zuweisen
  p_mte_od = @mte_od
    p_mte_od->tooltips = TRUE                                        '- Tooltips EIN/AUS
    p_mte_od->measurement_unit = GTK_CENTIMETERS     '- Maßeinheit für das Lineal
    p_mte_od->wrap_mode =    GTK_WRAP_CHAR                   '- Art des Zeilenumbruchs
    p_mte_od->pixels_above_lines = 0                     '- Der Abstand vor einem Absatz in Pixel
    p_mte_od->pixels_below_lines = 0                     '- Der Abstand nach einem Absatz in Pixel
    p_mte_od->pixels_inside_wrap = 0                     '- Der Abstand zwischen aufeinander umbrochenen Zeilen
    p_mte_od->justification =    GTK_JUSTIFY_LEFT        '- Satzausrichtung
    p_mte_od->left_margin =  0                                       '- Breite des linken Randes
    p_mte_od->right_margin = 0                                   '- Breite des rechten Randes
    p_mte_od->indent = 0                                             '- Einrücktiefe von Absätzen
  p_mte_od->editable = TRUE
  p_mte_od->cursor_visible = TRUE
  p_mte_od->overwrite = FALSE


'- Daten übernahme  in den Widget's Pointer
  p_mte_o->p_daten = p_mte_od
  
'- Einstellungen von Text View holen
Function mte_option_get_text_view() As gint
  mte_option_get_text_view = TRUE
  
'- Zeilenumbruch
  Select Case gtk_text_view_get_wrap_mode (GTK_TEXT_VIEW (p_mte->p_textview_1))
    Case GTK_WRAP_NONE
        '- p_radiobutton_none aktivieren
      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_none),TRUE)
    Case GTK_WRAP_CHAR
        '- p_radiobutton_zeichenweiser aktivieren
      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_zeichenweiser),TRUE)
    Case GTK_WRAP_WORD
        '- p_radiobutton_wortweise aktivieren
      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_wortweise),TRUE)
  End Select

 '- Sonstiges    
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (p_mte_o->p_checkbutton_editable), _                                                      
                                                            gtk_text_view_get_editable (GTK_TEXT_VIEW (p_mte->p_textview_1)))
                                                        
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (p_mte_o->p_checkbutton_cursor_visible), _
                                gtk_text_view_get_cursor_visible (GTK_TEXT_VIEW (p_mte->p_textview_1)))
                                                        
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (p_mte_o->p_checkbutton_overwrite), _
                                gtk_text_view_get_overwrite (GTK_TEXT_VIEW (p_mte->p_textview_1)))

'- Absatzabstand                                                        
  gtk_spin_button_set_value (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_abstand_vor), _
                             gtk_text_view_get_pixels_above_lines (GTK_TEXT_VIEW (p_mte->p_textview_1)))
  
  gtk_spin_button_set_value (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_abstand_zwischen), _                                                      
                             gtk_text_view_get_pixels_below_lines (GTK_TEXT_VIEW (p_mte->p_textview_1)))
  
  gtk_spin_button_set_value (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_abstand_nach), _                                                      
                             gtk_text_view_get_pixels_inside_wrap (GTK_TEXT_VIEW (p_mte->p_textview_1)))
  
  '- Satzausrichtung
  Select Case gtk_text_view_get_justification (GTK_TEXT_VIEW (p_mte->p_textview_1))
    Case GTK_JUSTIFY_LEFT
        '- p_radiobutton_links aktivieren
      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_links),TRUE)
    Case GTK_JUSTIFY_CENTER
        '- p_radiobutton_zentriert aktivieren
      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_zentriert),TRUE)
    Case GTK_JUSTIFY_RIGHT
        '- p_radiobutton_rechts aktivieren
      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_rechts),TRUE)
    Case GTK_JUSTIFY_FILL
        '- p_radiobutton_blocksatz aktivieren
      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_blocksatz),TRUE)
  End Select

'- Ränder                                                      
  gtk_spin_button_set_value (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_rand_links), _                                                      
                             gtk_text_view_get_left_margin (GTK_TEXT_VIEW (p_mte->p_textview_1)))
  
  gtk_spin_button_set_value (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_rand_rechts), _                                                      
                             gtk_text_view_get_right_margin (GTK_TEXT_VIEW (p_mte->p_textview_1)))
  
  gtk_spin_button_set_value (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_rand_tiefe), _                                                      
                             gtk_text_view_get_indent (GTK_TEXT_VIEW (p_mte->p_textview_1)))
End Function  
  
Function mte_option_get_button() As gint
    Dim p_text As gchar Ptr
    
    mte_option_get_button = TRUE
    
'- Masseinheiten
  '- p_radiobutton_zoll abfragen
  If gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_zoll)) Then
    p_mte_o->p_daten->measurement_unit = GTK_INCHES
  Else  
    '- p_radiobutton_zentimeter abfragen
    If gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_zentimeter)) Then
      p_mte_o->p_daten->measurement_unit = GTK_CENTIMETERS
    Else        
        '- p_radiobutton_punkte abfragen
      If gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_punkte)) Then
        p_mte_o->p_daten->measurement_unit = GTK_PIXELS          
      End If
    End If
  End If
  
'- Zeilenumbruch
  '- p_radiobutton_none aktivieren
  If gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_none)) = TRUE Then
    gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (p_mte->p_textview_1), GTK_WRAP_NONE)
  Else          
    '- p_radiobutton_zeichenweiser aktivieren
    If gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_zeichenweiser)) = TRUE Then
        gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (p_mte->p_textview_1), GTK_WRAP_CHAR)
    Else    
        '- p_radiobutton_wortweise aktivieren
      If gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_wortweise)) = TRUE Then
        gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (p_mte->p_textview_1), GTK_WRAP_WORD)
      End If
    End If    
  End If
                                                          
'- Absatzabstand
  gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (p_mte->p_textview_1), gtk_spin_button_get_value_as_int _
                                       (GTK_SPIN_BUTTON  (p_mte_o->p_spinbutton_abstand_vor)))
                                                        
  gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (p_mte->p_textview_1), gtk_spin_button_get_value_as_int _
                                       (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_abstand_nach)))
                                                        
  gtk_text_view_set_pixels_inside_wrap (GTK_TEXT_VIEW (p_mte->p_textview_1), gtk_spin_button_get_value_as_int _
                                       (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_abstand_zwischen)))
                                                        
'- Satzausrichtung
  '- p_radiobutton_links aktivieren
  If gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_links)) Then
    gtk_text_view_set_justification (GTK_TEXT_VIEW (p_mte->p_textview_1), GTK_JUSTIFY_LEFT)
  Else  
    '- p_radiobutton_zentriert aktivieren
    If gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_zentriert)) Then
        gtk_text_view_set_justification (GTK_TEXT_VIEW (p_mte->p_textview_1), GTK_JUSTIFY_CENTER)
    Else        
        '- p_radiobutton_rechts aktivieren
      If gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_rechts)) Then
        gtk_text_view_set_justification (GTK_TEXT_VIEW (p_mte->p_textview_1), GTK_JUSTIFY_RIGHT)
      Else
          '- p_radiobutton_blocksatz aktivieren
        If gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_blocksatz)) Then
          gtk_text_view_set_justification (GTK_TEXT_VIEW (p_mte->p_textview_1), GTK_JUSTIFY_FILL)
        End If
      End If
    End If
  End if  
                                                        
'- Ränder
  gtk_text_view_set_left_margin (GTK_TEXT_VIEW (p_mte->p_textview_1), gtk_spin_button_get_value_as_int _
                                (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_rand_links)))
                                                        
  gtk_text_view_set_right_margin (GTK_TEXT_VIEW (p_mte->p_textview_1), gtk_spin_button_get_value_as_int _
                                 (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_rand_rechts)))
                                                        
  gtk_text_view_set_indent (GTK_TEXT_VIEW (p_mte->p_textview_1), gtk_spin_button_get_value_as_int _
                           (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_rand_tiefe)))

'- Sonstiges
  gtk_text_view_set_editable (GTK_TEXT_VIEW (p_mte->p_textview_1), gtk_toggle_button_get_active _
                             (GTK_TOGGLE_BUTTON (p_mte_o->p_checkbutton_editable)))
                                                                                  
  gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (p_mte->p_textview_1), gtk_toggle_button_get_active _
                                   (GTK_TOGGLE_BUTTON (p_mte_o->p_checkbutton_cursor_visible)))
                                                        
  gtk_text_view_set_overwrite (GTK_TEXT_VIEW (p_mte->p_textview_1), gtk_toggle_button_get_active _
                              (GTK_TOGGLE_BUTTON (p_mte_o->p_checkbutton_overwrite)))
 
  p_mte_o->p_daten->tooltips = gtk_toggle_button_get_active _
                               (GTK_TOGGLE_BUTTON (p_mte_o->p_checkbutton_tooltip))

End Function

'- Der OK Button wurde gedrückt
Sub mte_on_menuitem_option_okbutton_activate Cdecl (ByVal widget as GtkWidget ptr, Byval p_ud As gpointer Ptr)
  Dim Res As gint
  Res = mte_option_get_button()
  
  gtk_widget_destroy(GTK_WIDGET(p_mte_o->p_dialog_option))
End Sub

'- Der Cancel Button wurde gedrückt
Sub mte_on_menuitem_option_cancelbutton_activate Cdecl (ByVal widget as GtkWidget ptr, Byval p_ud as gpointer Ptr)
  gtk_widget_destroy(GTK_WIDGET(p_mte_o->p_dialog_option))
End Sub  

Function mte_ShowOptionDialog () As gint

    Dim Res As gint

  Dim As GtkWidget Ptr p_dialog_vbox_1
  Dim As GtkWidget Ptr p_notebook_1

'- Notebook Blatt Maßeinheiten
  Dim As GtkWidget Ptr p_hbox_11
  Dim As GtkWidget Ptr p_frame_11
  Dim As GtkWidget Ptr p_label_11  
  Dim As GtkWidget Ptr p_label_1x
  Dim As GtkWidget Ptr p_alignment_11
  Dim As GtkWidget Ptr p_vbox_11
  Dim As GSList Ptr p_masseinheiten_group = NULL
  
  Dim As GtkWidget Ptr p_frame_12
  Dim As GtkWidget Ptr p_label_12
  Dim As GtkWidget Ptr p_alignment_12
  Dim As GtkWidget Ptr p_vbox_12

'- Notebook Blatt Zeilenumbruch  
  Dim As GtkWidget Ptr p_hbox_21
  Dim As GtkWidget Ptr p_frame_21
  Dim As GtkWidget Ptr p_label_21
  Dim As GtkWidget Ptr p_label_2x
  Dim As GtkWidget Ptr p_alignment_21
  Dim As GtkWidget Ptr p_vbox_21
  Dim As GSList Ptr p_zeilenumbruch_group = NULL  
  
  Dim As GtkWidget Ptr p_frame_22
  Dim As GtkWidget Ptr p_label_22
  Dim As GtkWidget Ptr p_alignment_22
  Dim As GtkWidget Ptr p_vbox_22

'- Notebook Blatt Abstand vor einem Absatz in Pixel  
  Dim As GtkWidget Ptr p_hbox_31
  Dim As GtkWidget Ptr p_frame_31
  Dim As GtkWidget Ptr p_fixed_31
  Dim As GtkWidget Ptr p_label_abstand_vor
  Dim As GtkWidget Ptr p_label_abstand_zwischen
  Dim As GtkWidget Ptr p_label_abstand_nach
  Dim As GtkWidget Ptr p_label_31
  
  Dim As GtkWidget Ptr p_frame_32
  Dim As GtkWidget Ptr p_label_32
  Dim As GtkWidget Ptr p_label_3x
  
'- Notebook Blatt Satzausrichtung
  Dim As GtkWidget Ptr p_hbox_41
  Dim As GtkWidget Ptr p_frame_41
  Dim As GtkWidget Ptr p_vbox_41
  Dim As GSList Ptr p_ausrichtung_group = NULL  
  Dim As GtkWidget Ptr p_label_41
  
  Dim As GtkWidget Ptr p_frame_42
  Dim As GtkWidget Ptr p_label_42
  Dim As GtkWidget Ptr p_label_4x
  
'- Notebook Blatt Ränder
  Dim As GtkWidget Ptr p_hbox_51
  Dim As GtkWidget Ptr p_frame_51
  Dim As GtkWidget Ptr p_fixed_51
  Dim As GtkWidget Ptr p_label_rand_tiefe
  Dim As GtkWidget Ptr p_label_rand_links
  Dim As GtkWidget Ptr p_label_rand_rechts
  Dim As GtkWidget Ptr p_label_51
  
  Dim As GtkWidget Ptr p_frame_52
  Dim As GtkWidget Ptr p_label_52
  Dim As GtkWidget Ptr p_label_5x

'- Notebook Blatt Sonstiges
  Dim As GtkWidget Ptr p_hbox_61
  Dim As GtkWidget Ptr p_frame_61
  Dim As GtkWidget Ptr p_vbox_61
  Dim As GtkWidget Ptr p_label_61
  
  Dim As GtkWidget Ptr p_frame_62
  Dim As GtkWidget Ptr p_label_62
  Dim As GtkWidget Ptr p_label_6x

'- Button und Sonstiges  
  Dim As GtkWidget Ptr p_dialog_action_area_1
  Dim As GtkWidget Ptr p_cancelbutton_1
  Dim As GtkWidget Ptr p_okbutton_1
  
  Dim p_msg As gchar Ptr

  mte_ShowOptionDialog = TRUE

  p_mte_o->p_dialog_option = gtk_dialog_new ()
  gtk_widget_set_name (p_mte_o->p_dialog_option, "p_dialog_1")
  gtk_window_set_title (GTK_WINDOW (p_mte_o->p_dialog_option), ("Einstellungen"))
  gtk_window_set_modal (GTK_WINDOW (p_mte_o->p_dialog_option), TRUE)
  gtk_window_set_resizable (GTK_WINDOW (p_mte_o->p_dialog_option), FALSE)
  gtk_window_set_position (GTK_WINDOW (p_mte_o->p_dialog_option), GTK_WIN_POS_CENTER)
  gtk_window_set_icon (GTK_WINDOW (p_mte_o->p_dialog_option), p_mte_icon_pixbuf)

  p_dialog_vbox_1 = GTK_DIALOG (p_mte_o->p_dialog_option)->vbox
  gtk_widget_set_name (p_dialog_vbox_1, "p_dialog_vbox_1")
  gtk_widget_show (p_dialog_vbox_1)

  p_notebook_1 = gtk_notebook_new ()
  gtk_widget_set_name (p_notebook_1, "p_notebook_1")
  gtk_widget_show (p_notebook_1)
  gtk_box_pack_start (GTK_BOX (p_dialog_vbox_1), p_notebook_1, TRUE, TRUE, 0)
  
'--------------------
'- 1.1 Notebook eintrag
'- Masseinheiten
  p_hbox_11 = gtk_hbox_new (FALSE, 0)
  gtk_widget_set_name (p_hbox_11, "p_hbox_11")
  gtk_widget_show (p_hbox_11)
  gtk_container_add (GTK_CONTAINER (p_notebook_1), p_hbox_11)
  gtk_container_set_border_width (GTK_CONTAINER (p_hbox_11), 3)

  p_frame_11 = gtk_frame_new (NULL)
  gtk_widget_set_name (p_frame_11, "p_frame_11")
  gtk_widget_show (p_frame_11)
  gtk_box_pack_start (GTK_BOX (p_hbox_11), p_frame_11, TRUE, TRUE, 0)
  gtk_container_set_border_width (GTK_CONTAINER (p_frame_11), 3)

  p_label_11 = gtk_label_new ("Masseinheiten")
  gtk_widget_set_name (p_label_11, "p_label_11")
  gtk_widget_show (p_label_11)
  gtk_frame_set_label_widget (GTK_FRAME (p_frame_11), p_label_11)
  gtk_label_set_use_markup (GTK_LABEL (p_label_11), TRUE)
  gtk_label_set_justify (GTK_LABEL (p_label_11), GTK_JUSTIFY_LEFT)

  p_label_1x= gtk_label_new ("Einheiten")
  gtk_widget_set_name (p_label_1x, "p_label_1x")
  gtk_widget_show (p_label_1x)
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (p_notebook_1), _
                              gtk_notebook_get_nth_page (GTK_NOTEBOOK (p_notebook_1), 0), p_label_1x)
  gtk_label_set_justify (GTK_LABEL (p_label_1x), GTK_JUSTIFY_LEFT)  

  p_alignment_11 = gtk_alignment_new (0.5, 0.5, 1, 1)
  gtk_widget_set_name (p_alignment_11, "p_alignment_11")
  gtk_widget_show (p_alignment_11)
  gtk_container_add (GTK_CONTAINER (p_frame_11), p_alignment_11)
  gtk_container_set_border_width (GTK_CONTAINER (p_alignment_11), 12)

  p_vbox_11 = gtk_vbox_new (FALSE, 0)
  gtk_widget_set_name (p_vbox_11, "p_vbox_11")
  gtk_widget_show (p_vbox_11)
  gtk_container_add (GTK_CONTAINER (p_alignment_11), p_vbox_11)

  p_mte_o->p_radiobutton_zoll = gtk_radio_button_new_with_mnemonic (NULL, ("Zoll"))
  gtk_widget_set_name (p_mte_o->p_radiobutton_zoll, "p_radiobutton_zoll")
  gtk_widget_show (p_mte_o->p_radiobutton_zoll)
  gtk_box_pack_start (GTK_BOX (p_vbox_11), p_mte_o->p_radiobutton_zoll, FALSE, FALSE, 0)
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_zoll), p_masseinheiten_group)
  p_masseinheiten_group = gtk_radio_button_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_zoll))
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_o->p_radiobutton_zoll, _
                       ("Zeigt das Lineal in Zoll an"), NULL)

  p_mte_o->p_radiobutton_zentimeter = gtk_radio_button_new_with_mnemonic (NULL, ("Zentimeter"))
  gtk_widget_set_name (p_mte_o->p_radiobutton_zentimeter, "p_radiobutton_zentimeter")
  gtk_widget_show (p_mte_o->p_radiobutton_zentimeter)
  gtk_box_pack_start (GTK_BOX (p_vbox_11), p_mte_o->p_radiobutton_zentimeter, FALSE, FALSE, 0)
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_zentimeter), p_masseinheiten_group)
  p_masseinheiten_group = gtk_radio_button_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_zentimeter))
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_o->p_radiobutton_zentimeter, _
                       ("Zeigt das Lineal in Zentimeter an"), NULL)
  
'- p_radiobutton_zentimeter aktivieren
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_zentimeter),TRUE)

  p_mte_o->p_radiobutton_punkte = gtk_radio_button_new_with_mnemonic (NULL, ("Punkte"))
  gtk_widget_set_name (p_mte_o->p_radiobutton_punkte, "p_radiobutton_punkte")
  gtk_widget_show (p_mte_o->p_radiobutton_punkte)
  gtk_box_pack_start (GTK_BOX (p_vbox_11), p_mte_o->p_radiobutton_punkte, FALSE, FALSE, 0)
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_punkte), p_masseinheiten_group)
  p_masseinheiten_group = gtk_radio_button_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_punkte))
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_o->p_radiobutton_punkte, _
                       ("Zeigt das Lineal in Punkte an"), NULL)

'--------------------
'- 1.2 Notebook eintrag
'- Masseinheiten sonstiges
  p_frame_12 = gtk_frame_new (NULL)
  gtk_widget_set_name (p_frame_12, "p_frame_12")
  gtk_widget_show (p_frame_12)
  gtk_box_pack_start (GTK_BOX (p_hbox_11), p_frame_12, TRUE, TRUE, 0)
  gtk_container_set_border_width (GTK_CONTAINER (p_frame_12), 3)

  p_label_12 = gtk_label_new ("#")
  gtk_widget_set_name (p_label_12, "p_label_12")
  gtk_widget_show (p_label_12)
  gtk_frame_set_label_widget (GTK_FRAME (p_frame_12), p_label_12)
  gtk_label_set_use_markup (GTK_LABEL (p_label_12), TRUE)
  gtk_label_set_justify (GTK_LABEL (p_label_12), GTK_JUSTIFY_LEFT)

  p_alignment_12 = gtk_alignment_new (0.5, 0.5, 1, 1)
  gtk_widget_set_name (p_alignment_12, "p_alignment_12")
  gtk_widget_show (p_alignment_12)
  gtk_container_add (GTK_CONTAINER (p_frame_12), p_alignment_12)

  p_vbox_12 = gtk_vbox_new (FALSE, 0)
  gtk_widget_set_name (p_vbox_12, "p_vbox_12")
  gtk_widget_show (p_vbox_12)
  gtk_container_add (GTK_CONTAINER (p_alignment_12), p_vbox_12)

'--------------------
'- 2.1 Notebook eintrag
'- Zeilenumbruch
  p_hbox_21 = gtk_hbox_new (FALSE, 0)
  gtk_widget_set_name (p_hbox_21, "p_hbox_21")
  gtk_widget_show (p_hbox_21)
  gtk_container_add (GTK_CONTAINER (p_notebook_1), p_hbox_21)
  gtk_container_set_border_width (GTK_CONTAINER (p_hbox_21), 3)

  p_frame_21 = gtk_frame_new (NULL)
  gtk_widget_set_name (p_frame_21, "p_frame_21")
  gtk_widget_show (p_frame_21)
  gtk_box_pack_start (GTK_BOX (p_hbox_21), p_frame_21, TRUE, TRUE, 0)
  gtk_container_set_border_width (GTK_CONTAINER (p_frame_21), 3)

  p_label_21 = gtk_label_new ("Zeilenumbruch")
  gtk_widget_set_name (p_label_21, "p_label_21")
  gtk_widget_show (p_label_21)
  gtk_frame_set_label_widget (GTK_FRAME (p_frame_21), p_label_21)
  gtk_label_set_use_markup (GTK_LABEL (p_label_21), TRUE)
  gtk_label_set_justify (GTK_LABEL (p_label_21), GTK_JUSTIFY_LEFT)

  p_label_2x = gtk_label_new ("Umbruch")
  gtk_widget_set_name (p_label_2x, "p_label_2x")
  gtk_widget_show (p_label_2x)
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (p_notebook_1), _
                              gtk_notebook_get_nth_page (GTK_NOTEBOOK (p_notebook_1), 1), p_label_2x)
  gtk_label_set_justify (GTK_LABEL (p_label_2x), GTK_JUSTIFY_LEFT)

  p_alignment_21 = gtk_alignment_new (0.5, 0.5, 1, 1)
  gtk_widget_set_name (p_alignment_21, "p_alignment_21")
  gtk_widget_show (p_alignment_21)
  gtk_container_add (GTK_CONTAINER (p_frame_21), p_alignment_21)

  p_vbox_21 = gtk_vbox_new (FALSE, 0)
  gtk_widget_set_name (p_vbox_21, "p_vbox_21")
  gtk_widget_show (p_vbox_21)
  gtk_container_add (GTK_CONTAINER (p_alignment_21), p_vbox_21)
  gtk_container_set_border_width (GTK_CONTAINER (p_vbox_21), 12)

  p_mte_o->p_radiobutton_none = gtk_radio_button_new_with_mnemonic (NULL, ("Kein Umbruch"))
  gtk_widget_set_name (p_mte_o->p_radiobutton_none, "p_radiobutton_none")
  gtk_widget_show (p_mte_o->p_radiobutton_none)
  gtk_box_pack_start (GTK_BOX (p_vbox_21), p_mte_o->p_radiobutton_none, FALSE, FALSE, 0)
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_none), p_zeilenumbruch_group)
  p_zeilenumbruch_group = gtk_radio_button_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_none))

  p_mte_o->p_radiobutton_zeichenweiser = gtk_radio_button_new_with_mnemonic (NULL, ("Zeicheneiser Umbruch"))
  gtk_widget_set_name (p_mte_o->p_radiobutton_zeichenweiser, "p_radiobutton_zeichenweiser")
  gtk_widget_show (p_mte_o->p_radiobutton_zeichenweiser)
  gtk_box_pack_start (GTK_BOX (p_vbox_21), p_mte_o->p_radiobutton_zeichenweiser, FALSE, FALSE, 0)
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_zeichenweiser), p_zeilenumbruch_group)
  p_zeilenumbruch_group = gtk_radio_button_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_zeichenweiser))

'- p_radiobutton_zeichenweiser aktivieren
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_zeichenweiser),TRUE)

  p_mte_o->p_radiobutton_wortweise = gtk_radio_button_new_with_mnemonic (NULL, ("Wortweiser Umbruch"))
  gtk_widget_set_name (p_mte_o->p_radiobutton_wortweise, "p_radiobutton_wortweise")
  gtk_widget_show (p_mte_o->p_radiobutton_wortweise)
  gtk_box_pack_start (GTK_BOX (p_vbox_21), p_mte_o->p_radiobutton_wortweise, FALSE, FALSE, 0)
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_wortweise), p_zeilenumbruch_group)
  p_zeilenumbruch_group = gtk_radio_button_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_wortweise))

'--------------------
'- 2.2 Notebook eintrag
'- Zeilenumbruch sonstiges
  p_frame_22 = gtk_frame_new (NULL)
  gtk_widget_set_name (p_frame_22, "p_frame_22")
  gtk_widget_show (p_frame_22)
  gtk_box_pack_start (GTK_BOX (p_hbox_21), p_frame_22, TRUE, TRUE, 0)
  gtk_container_set_border_width (GTK_CONTAINER (p_frame_22), 3)

  p_label_22 = gtk_label_new ("#")
  gtk_widget_set_name (p_label_22, "p_label_22")
  gtk_widget_show (p_label_22)
  gtk_frame_set_label_widget (GTK_FRAME (p_frame_22), p_label_22)
  gtk_label_set_use_markup (GTK_LABEL (p_label_22), TRUE)
  gtk_label_set_justify (GTK_LABEL (p_label_22), GTK_JUSTIFY_LEFT)
  
  p_alignment_22 = gtk_alignment_new (0.5, 0.5, 1, 1)
  gtk_widget_set_name (p_alignment_22, "p_alignment_22")
  gtk_widget_show (p_alignment_22)
  gtk_container_add (GTK_CONTAINER (p_frame_22), p_alignment_22)

  p_vbox_22 = gtk_vbox_new (FALSE, 0)
  gtk_widget_set_name (p_vbox_22, "p_vbox_22")
  gtk_widget_show (p_vbox_22)
  gtk_container_add (GTK_CONTAINER (p_alignment_22), p_vbox_22)
  gtk_container_set_border_width (GTK_CONTAINER (p_vbox_22), 12)

'- Dialog action Area
  p_dialog_action_area_1 = GTK_DIALOG (p_mte_o->p_dialog_option)->action_area
  gtk_widget_set_name (p_dialog_action_area_1, "p_dialog_action_area_1")
  gtk_widget_show (p_dialog_action_area_1)
  gtk_button_box_set_layout (GTK_BUTTON_BOX (p_dialog_action_area_1), GTK_BUTTONBOX_END)
  
'- Dialog action Button  
  p_cancelbutton_1 = gtk_button_new_from_stock ("gtk-cancel")
  gtk_widget_set_name (p_cancelbutton_1, "p_cancelbutton_1")
  gtk_widget_show (p_cancelbutton_1)
  gtk_dialog_add_action_widget (GTK_DIALOG (p_mte_o->p_dialog_option), p_cancelbutton_1, GTK_RESPONSE_CANCEL)
  GTK_WIDGET_SET_FLAGS (p_cancelbutton_1, GTK_CAN_DEFAULT)

  p_okbutton_1 = gtk_button_new_from_stock ("gtk-ok")
  gtk_widget_set_name (p_okbutton_1, "p_okbutton_1")
  gtk_widget_show (p_okbutton_1)
  gtk_dialog_add_action_widget (GTK_DIALOG (p_mte_o->p_dialog_option), p_okbutton_1, GTK_RESPONSE_OK)
  GTK_WIDGET_SET_FLAGS (p_okbutton_1, GTK_CAN_DEFAULT)
  
'--------------------
'- 3.1 Notebook eintrag Absatz
'- Der Abstand vor einem Absatz in Pixel
  p_hbox_31 = gtk_hbox_new (FALSE, 0)
  gtk_widget_set_name (p_hbox_31, "p_hbox_31")
  gtk_widget_show (p_hbox_31)
  gtk_container_add (GTK_CONTAINER (p_notebook_1), p_hbox_31)

  p_frame_31 = gtk_frame_new (NULL)
  gtk_widget_set_name (p_frame_31, "p_frame_31")
  gtk_widget_show (p_frame_31)
  gtk_box_pack_start (GTK_BOX (p_hbox_31), p_frame_31, TRUE, TRUE, 0)
  gtk_container_set_border_width (GTK_CONTAINER (p_frame_31), 3)

  p_fixed_31 = gtk_fixed_new ()
  gtk_widget_set_name (p_fixed_31, "p_fixed_31")
  gtk_widget_show (p_fixed_31)
  gtk_container_add (GTK_CONTAINER (p_frame_31), p_fixed_31)
  gtk_container_set_border_width (GTK_CONTAINER (p_fixed_31), 12)

  p_mte_o->p_spinbutton_abstand_vor_adj = gtk_adjustment_new (0, 0, 32000, 1, 0, 0)
  p_mte_o->p_spinbutton_abstand_vor = gtk_spin_button_new (GTK_ADJUSTMENT (p_mte_o->p_spinbutton_abstand_vor_adj), 1, 0)
  gtk_widget_set_name (p_mte_o->p_spinbutton_abstand_vor, "p_spinbutton_abstand_vor")
  gtk_widget_show (p_mte_o->p_spinbutton_abstand_vor)
  gtk_fixed_put (GTK_FIXED (p_fixed_31), p_mte_o->p_spinbutton_abstand_vor, 128, 0)
  gtk_widget_set_usize (p_mte_o->p_spinbutton_abstand_vor, 60, 20)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_o->p_spinbutton_abstand_vor, ("Der Abstand vor einem Absatz in Pixel"), NULL)
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_abstand_vor), TRUE)

  p_mte_o->p_spinbutton_abstand_zwischen_adj = gtk_adjustment_new (0, 0, 32000, 1, 0, 0)
  p_mte_o->p_spinbutton_abstand_zwischen = gtk_spin_button_new (GTK_ADJUSTMENT (p_mte_o->p_spinbutton_abstand_zwischen_adj), 1, 0)
  gtk_widget_set_name (p_mte_o->p_spinbutton_abstand_zwischen, "p_spinbutton_abstand_zwischen")
  gtk_widget_show (p_mte_o->p_spinbutton_abstand_zwischen)
  gtk_fixed_put (GTK_FIXED (p_fixed_31), p_mte_o->p_spinbutton_abstand_zwischen, 128, 32)
  gtk_widget_set_usize (p_mte_o->p_spinbutton_abstand_zwischen, 60, 20)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_o->p_spinbutton_abstand_zwischen, ("Der Abstand zwischen aufeinanderfolgenden umbrochenen Zeilen in einem Absatz in Pixel"), NULL)
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_abstand_zwischen), TRUE)

  p_mte_o->p_spinbutton_abstand_nach_adj = gtk_adjustment_new (0, 0, 32000, 1, 0, 0)
  p_mte_o->p_spinbutton_abstand_nach = gtk_spin_button_new (GTK_ADJUSTMENT (p_mte_o->p_spinbutton_abstand_nach_adj), 1, 0)
  gtk_widget_set_name (p_mte_o->p_spinbutton_abstand_nach, "p_mte_o->p_spinbutton_abstand_nach")
  gtk_widget_show (p_mte_o->p_spinbutton_abstand_nach)
  gtk_fixed_put (GTK_FIXED (p_fixed_31), p_mte_o->p_spinbutton_abstand_nach, 128, 64)
  gtk_widget_set_usize (p_mte_o->p_spinbutton_abstand_nach, 60, 20)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_o->p_spinbutton_abstand_nach, ("Der Abstand nach einem Absatz in Pixel"), NULL)
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_abstand_nach), TRUE)


  p_label_abstand_vor = gtk_label_new (("Vor dem Absatz:"))
  gtk_widget_set_name (p_label_abstand_vor, "p_label_abstand_vor")
  gtk_widget_show (p_label_abstand_vor)
  gtk_fixed_put (GTK_FIXED (p_fixed_31), p_label_abstand_vor, 0, 0)
  gtk_widget_set_usize (p_label_abstand_vor, 132, 20)
  gtk_label_set_justify (GTK_LABEL (p_label_abstand_vor), GTK_JUSTIFY_RIGHT)
  
  p_label_abstand_zwischen = gtk_label_new (("Zwischen den Zeilen:"))
  gtk_widget_set_name (p_label_abstand_zwischen, "p_label_abstand_zwischen")
  gtk_widget_show (p_label_abstand_zwischen)
  gtk_fixed_put (GTK_FIXED (p_fixed_31), p_label_abstand_zwischen, 0, 32)
  gtk_widget_set_usize (p_label_abstand_zwischen, 132, 20)
  gtk_label_set_justify (GTK_LABEL (p_label_abstand_zwischen), GTK_JUSTIFY_RIGHT)

  p_label_abstand_nach = gtk_label_new (("Nach dem Absatz:"))
  gtk_widget_set_name (p_label_abstand_nach, "p_label_abstand_nach")
  gtk_widget_show (p_label_abstand_nach)
  gtk_fixed_put (GTK_FIXED (p_fixed_31), p_label_abstand_nach, 0, 64)
  gtk_widget_set_usize (p_label_abstand_nach, 132, 20)
  gtk_label_set_justify (GTK_LABEL (p_label_abstand_nach), GTK_JUSTIFY_RIGHT)

  p_label_31 = gtk_label_new (("Absatzabstand"))
  gtk_widget_set_name (p_label_31, "p_label_31")
  gtk_widget_show (p_label_31)
  gtk_frame_set_label_widget (GTK_FRAME (p_frame_31), p_label_31)
  gtk_label_set_justify (GTK_LABEL (p_label_31), GTK_JUSTIFY_LEFT)

  p_frame_32 = gtk_frame_new (NULL)
  gtk_widget_set_name (p_frame_32, "p_frame_32")
  gtk_widget_show (p_frame_32)
  gtk_box_pack_start (GTK_BOX (p_hbox_31), p_frame_32, TRUE, TRUE, 0)
  gtk_container_set_border_width (GTK_CONTAINER (p_frame_32), 3)

  p_label_32 = gtk_label_new ("#")
  gtk_widget_set_name (p_label_32, "p_label_32")
  gtk_widget_show (p_label_32)
  gtk_frame_set_label_widget (GTK_FRAME (p_frame_32), p_label_32)
  gtk_label_set_justify (GTK_LABEL (p_label_32), GTK_JUSTIFY_LEFT)

  p_label_3x = gtk_label_new ("Abstand")
  gtk_widget_set_name (p_label_3x, "p_label_3x")
  gtk_widget_show (p_label_3x)
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (p_notebook_1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (p_notebook_1), 2), p_label_3x)
  gtk_label_set_justify (GTK_LABEL (p_label_3x), GTK_JUSTIFY_LEFT)

'--------------------
'- 4.1 Notebook eintrag Satzausrichtung
'- Die Art der Satzausrichtung
  p_hbox_41 = gtk_hbox_new (FALSE, 0)
  gtk_widget_set_name (p_hbox_41, "p_hbox_41")
  gtk_widget_show (p_hbox_41)
  gtk_container_add (GTK_CONTAINER (p_notebook_1), p_hbox_41)

  p_frame_41 = gtk_frame_new (NULL)
  gtk_widget_set_name (p_frame_41, "p_frame_41")
  gtk_widget_show (p_frame_41)
  gtk_box_pack_start (GTK_BOX (p_hbox_41), p_frame_41, TRUE, TRUE, 0)
  gtk_container_set_border_width (GTK_CONTAINER (p_frame_41), 3)

  p_vbox_41 = gtk_vbox_new (FALSE, 0)
  gtk_widget_set_name (p_vbox_41, "p_vbox_41")
  gtk_widget_show (p_vbox_41)
  gtk_container_add (GTK_CONTAINER (p_frame_41), p_vbox_41)
  gtk_container_set_border_width (GTK_CONTAINER (p_vbox_41), 12)

  p_msg  = g_strconcat(@"Linksb", @Chr(195), @Chr(188), @"ndig" ,NULL)
  p_mte_o->p_radiobutton_links = gtk_radio_button_new_with_mnemonic (NULL, p_msg)
  g_free(p_msg)
  gtk_widget_set_name (p_mte_o->p_radiobutton_links, "p_radiobutton_links")
  gtk_widget_show (p_mte_o->p_radiobutton_links)
  gtk_box_pack_start (GTK_BOX (p_vbox_41), p_mte_o->p_radiobutton_links, FALSE, FALSE, 0)
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_links), p_ausrichtung_group)
  p_ausrichtung_group = gtk_radio_button_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_links))

  p_mte_o->p_radiobutton_zentriert = gtk_radio_button_new_with_mnemonic (NULL, ("Mittig"))
  gtk_widget_set_name (p_mte_o->p_radiobutton_zentriert, "p_radiobutton_zentriert")
  gtk_widget_show (p_mte_o->p_radiobutton_zentriert)
  gtk_box_pack_start (GTK_BOX (p_vbox_41), p_mte_o->p_radiobutton_zentriert, FALSE, FALSE, 0)
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_zentriert), p_ausrichtung_group)
  p_ausrichtung_group = gtk_radio_button_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_zentriert))

  p_msg  = g_strconcat(@"Rechtsb", @Chr(195), @Chr(188), @"ndig" ,NULL)
  p_mte_o->p_radiobutton_rechts = gtk_radio_button_new_with_mnemonic (NULL, p_msg)
  g_free(p_msg)
  gtk_widget_set_name (p_mte_o->p_radiobutton_rechts, "p_radiobutton_rechts")
  gtk_widget_show (p_mte_o->p_radiobutton_rechts)
  gtk_box_pack_start (GTK_BOX (p_vbox_41), p_mte_o->p_radiobutton_rechts, FALSE, FALSE, 0)
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_rechts), p_ausrichtung_group)
  p_ausrichtung_group = gtk_radio_button_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_rechts))

  p_mte_o->p_radiobutton_blocksatz = gtk_radio_button_new_with_mnemonic (NULL, ("Blocksatz"))
  gtk_widget_set_name (p_mte_o->p_radiobutton_blocksatz, "p_radiobutton_blocksatz")
  gtk_widget_show (p_mte_o->p_radiobutton_blocksatz)
  gtk_box_pack_start (GTK_BOX (p_vbox_41), p_mte_o->p_radiobutton_blocksatz, FALSE, FALSE, 0)
  gtk_radio_button_set_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_blocksatz), p_ausrichtung_group)
  p_ausrichtung_group = gtk_radio_button_group (GTK_RADIO_BUTTON (p_mte_o->p_radiobutton_blocksatz))

  p_label_41 = gtk_label_new ("Satzausrichtung")
  gtk_widget_set_name (p_label_41, "p_label_41")
  gtk_widget_show (p_label_41)
  gtk_frame_set_label_widget (GTK_FRAME (p_frame_41), p_label_41)
  gtk_label_set_justify (GTK_LABEL (p_label_41), GTK_JUSTIFY_LEFT)

  p_frame_42 = gtk_frame_new (NULL)
  gtk_widget_set_name (p_frame_42, "p_frame_42")
  gtk_widget_show (p_frame_42)
  gtk_box_pack_start (GTK_BOX (p_hbox_41), p_frame_42, TRUE, TRUE, 0)
  gtk_container_set_border_width (GTK_CONTAINER (p_frame_42), 3)

  p_label_42 = gtk_label_new ("#")
  gtk_widget_set_name (p_label_42, "p_label_42")
  gtk_widget_show (p_label_42)
  gtk_frame_set_label_widget (GTK_FRAME (p_frame_42), p_label_42)
  gtk_label_set_justify (GTK_LABEL (p_label_42), GTK_JUSTIFY_LEFT)

  p_label_4x = gtk_label_new ("Ausrichtung")
  gtk_widget_set_name (p_label_4x, "p_label_4x")
  gtk_widget_show (p_label_4x)
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (p_notebook_1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (p_notebook_1), 3), p_label_4x)
  gtk_label_set_justify (GTK_LABEL (p_label_4x), GTK_JUSTIFY_LEFT)

  p_hbox_51 = gtk_hbox_new (FALSE, 0)
  gtk_widget_set_name (p_hbox_51, "p_hbox_51")
  gtk_widget_show (p_hbox_51)
  gtk_container_add (GTK_CONTAINER (p_notebook_1), p_hbox_51)

  p_frame_51 = gtk_frame_new (NULL)
  gtk_widget_set_name (p_frame_51, "p_frame_51")
  gtk_widget_show (p_frame_51)
  gtk_box_pack_start (GTK_BOX (p_hbox_51), p_frame_51, TRUE, TRUE, 0)
  gtk_container_set_border_width (GTK_CONTAINER (p_frame_51), 3)

  p_fixed_51 = gtk_fixed_new ()
  gtk_widget_set_name (p_fixed_51, "p_fixed_51")
  gtk_widget_show (p_fixed_51)
  gtk_container_add (GTK_CONTAINER (p_frame_51), p_fixed_51)
  gtk_container_set_border_width (GTK_CONTAINER (p_fixed_51), 12)

  p_msg  = g_strconcat(@"Einr", @Chr(195), @Chr(188), @"cktiefe:" ,NULL)
  p_label_rand_tiefe = gtk_label_new (p_msg)
  g_free(p_msg)
  gtk_widget_set_name (p_label_rand_tiefe, "p_label_rand_tiefe")
  gtk_widget_show (p_label_rand_tiefe)
  gtk_fixed_put (GTK_FIXED (p_fixed_51), p_label_rand_tiefe, 0, 64)
  gtk_widget_set_usize (p_label_rand_tiefe, 84, 20)
  gtk_label_set_justify (GTK_LABEL (p_label_rand_tiefe), GTK_JUSTIFY_RIGHT)

  p_label_rand_links = gtk_label_new ("Linker Rand:")
  gtk_widget_set_name (p_label_rand_links, "p_label_rand_links")
  gtk_widget_show (p_label_rand_links)
  gtk_fixed_put (GTK_FIXED (p_fixed_51), p_label_rand_links, 0, 0)
  gtk_widget_set_usize (p_label_rand_links, 84, 20)
  gtk_label_set_justify (GTK_LABEL (p_label_rand_links), GTK_JUSTIFY_RIGHT)

  p_mte_o->p_spinbutton_rand_links_adj = gtk_adjustment_new (0, 0, 32000, 1, 0, 0)
  p_mte_o->p_spinbutton_rand_links = gtk_spin_button_new (GTK_ADJUSTMENT (p_mte_o->p_spinbutton_rand_links_adj), 1, 0)
  gtk_widget_set_name (p_mte_o->p_spinbutton_rand_links, "p_spinbutton_rand_links")
  gtk_widget_show (p_mte_o->p_spinbutton_rand_links)
  gtk_fixed_put (GTK_FIXED (p_fixed_51), p_mte_o->p_spinbutton_rand_links, 88, 0)
  gtk_widget_set_usize (p_mte_o->p_spinbutton_rand_links, 60, 20)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_o->p_spinbutton_rand_links, ("Breite des linken Randes in Pixel"), NULL)
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_rand_links), TRUE)

  p_mte_o->p_spinbutton_rand_rechts_adj = gtk_adjustment_new (0, 0, 32000, 1, 0, 0)
  p_mte_o->p_spinbutton_rand_rechts = gtk_spin_button_new (GTK_ADJUSTMENT (p_mte_o->p_spinbutton_rand_rechts_adj), 1, 0)
  gtk_widget_set_name (p_mte_o->p_spinbutton_rand_rechts, "p_spinbutton_rand_rechts")
  gtk_widget_show (p_mte_o->p_spinbutton_rand_rechts)
  gtk_fixed_put (GTK_FIXED (p_fixed_51), p_mte_o->p_spinbutton_rand_rechts, 88, 32)
  gtk_widget_set_usize (p_mte_o->p_spinbutton_rand_rechts, 60, 20)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_o->p_spinbutton_rand_rechts, ("Breite des rechten Randes in Pixel"), NULL)
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_rand_rechts), TRUE)

  p_mte_o->p_spinbutton_rand_tiefe_adj = gtk_adjustment_new (0, 0, 32000, 1, 0, 0)
  p_mte_o->p_spinbutton_rand_tiefe = gtk_spin_button_new (GTK_ADJUSTMENT (p_mte_o->p_spinbutton_rand_tiefe_adj), 1, 0)
  gtk_widget_set_name (p_mte_o->p_spinbutton_rand_tiefe, "p_spinbutton_rand_tiefe")
  gtk_widget_show (p_mte_o->p_spinbutton_rand_tiefe)
  gtk_fixed_put (GTK_FIXED (p_fixed_51), p_mte_o->p_spinbutton_rand_tiefe, 88, 64)
  gtk_widget_set_usize (p_mte_o->p_spinbutton_rand_tiefe, 60, 20)
  p_msg  = g_strconcat(@"Einr", @Chr(195), @Chr(188), @"cktiefe von Abs", @Chr(195), @Chr(164), "tzen in Pixel" ,NULL)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_o->p_spinbutton_rand_tiefe, p_msg, NULL)
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (p_mte_o->p_spinbutton_rand_tiefe), TRUE)

  p_label_rand_rechts = gtk_label_new ("Rechter Rand:")
  gtk_widget_set_name (p_label_rand_rechts, "p_label_rand_rechts")
  gtk_widget_show (p_label_rand_rechts)
  gtk_fixed_put (GTK_FIXED (p_fixed_51), p_label_rand_rechts, 0, 32)
  gtk_widget_set_usize (p_label_rand_rechts, 84, 20)
  gtk_label_set_justify (GTK_LABEL (p_label_rand_rechts), GTK_JUSTIFY_RIGHT)

  p_msg  = g_strconcat(@"R", @Chr(195), @Chr(164), @"nder" ,NULL)
  p_label_51 = gtk_label_new (p_msg)
  g_free(p_msg)
  gtk_widget_set_name (p_label_51, "p_label_51")
  gtk_widget_show (p_label_51)
  gtk_frame_set_label_widget (GTK_FRAME (p_frame_51), p_label_51)
  gtk_label_set_justify (GTK_LABEL (p_label_51), GTK_JUSTIFY_LEFT)

  p_frame_52 = gtk_frame_new (NULL)
  gtk_widget_set_name (p_frame_52, "p_frame_52")
  gtk_widget_show (p_frame_52)
  gtk_box_pack_start (GTK_BOX (p_hbox_51), p_frame_52, TRUE, TRUE, 0)
  gtk_container_set_border_width (GTK_CONTAINER (p_frame_52), 3)

  p_label_52 = gtk_label_new ("#")
  gtk_widget_set_name (p_label_52, "p_label_52")
  gtk_widget_show (p_label_52)
  gtk_frame_set_label_widget (GTK_FRAME (p_frame_52), p_label_52)
  gtk_label_set_justify (GTK_LABEL (p_label_52), GTK_JUSTIFY_LEFT)

  p_msg  = g_strconcat(@"R", @Chr(195), @Chr(164), @"nder" ,NULL)
  p_label_5x = gtk_label_new (p_msg)
  g_free(p_msg)
  gtk_widget_set_name (p_label_5x, "p_label_5x")
  gtk_widget_show (p_label_5x)
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (p_notebook_1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (p_notebook_1), 4), p_label_5x)
  gtk_label_set_justify (GTK_LABEL (p_label_5x), GTK_JUSTIFY_LEFT)

  p_hbox_61 = gtk_hbox_new (FALSE, 0)
  gtk_widget_set_name (p_hbox_61, "p_hbox_61")
  gtk_widget_show (p_hbox_61)
  gtk_container_add (GTK_CONTAINER (p_notebook_1), p_hbox_61)

  p_frame_61 = gtk_frame_new (NULL)
  gtk_widget_set_name (p_frame_61, "p_frame_61")
  gtk_widget_show (p_frame_61)
  gtk_box_pack_start (GTK_BOX (p_hbox_61), p_frame_61, TRUE, TRUE, 0)
  gtk_container_set_border_width (GTK_CONTAINER (p_frame_61), 3)

  p_vbox_61 = gtk_vbox_new (FALSE, 0)
  gtk_widget_set_name (p_vbox_61, "p_vbox_61")
  gtk_widget_show (p_vbox_61)
  gtk_container_add (GTK_CONTAINER (p_frame_61), p_vbox_61)
  gtk_container_set_border_width (GTK_CONTAINER (p_vbox_61), 12)

  p_mte_o->p_checkbutton_tooltip = gtk_check_button_new_with_mnemonic ("Tooltips")
  gtk_widget_set_name (p_mte_o->p_checkbutton_tooltip, "p_checkbutton_tooltip")
  gtk_widget_show (p_mte_o->p_checkbutton_tooltip)
  gtk_box_pack_start (GTK_BOX (p_vbox_61), p_mte_o->p_checkbutton_tooltip, FALSE, FALSE, 0)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_o->p_checkbutton_tooltip, _
                       ("Schaltet die Tooltips EIN und AUS"), NULL)
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (p_mte_o->p_checkbutton_tooltip), TRUE)

  p_mte_o->p_checkbutton_editable = gtk_check_button_new_with_mnemonic ("Text bearbeitbar")
  gtk_widget_set_name (p_mte_o->p_checkbutton_editable, "p_checkbutton_editable")
  gtk_widget_show (p_mte_o->p_checkbutton_editable)
  gtk_box_pack_start (GTK_BOX (p_vbox_61), p_mte_o->p_checkbutton_editable, FALSE, FALSE, 0)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_o->p_checkbutton_editable, _
                       ("Der Benutzer kann den Text bearbeiten"), NULL)
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (p_mte_o->p_checkbutton_editable), TRUE)

  p_mte_o->p_checkbutton_cursor_visible = gtk_check_button_new_with_mnemonic ("Cursor sichtbar")
  gtk_widget_set_name (p_mte_o->p_checkbutton_cursor_visible, "p_checkbutton_cursor_visible")
  gtk_widget_show (p_mte_o->p_checkbutton_cursor_visible)
  gtk_box_pack_start (GTK_BOX (p_vbox_61), p_mte_o->p_checkbutton_cursor_visible, FALSE, FALSE, 0)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_o->p_checkbutton_cursor_visible, _
                       ("Der Cursor ist sichtbar"), NULL)
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (p_mte_o->p_checkbutton_cursor_visible), TRUE)

  p_msg  = g_strconcat(@Chr(195), @Chr(156), @"berschreiben" ,NULL)
  p_mte_o->p_checkbutton_overwrite = gtk_check_button_new_with_mnemonic (p_msg)
  g_free(p_msg)
  gtk_widget_set_name (p_mte_o->p_checkbutton_overwrite, "p_checkbutton_overwrite")
  gtk_widget_show (p_mte_o->p_checkbutton_overwrite)
  gtk_box_pack_start (GTK_BOX (p_vbox_61), p_mte_o->p_checkbutton_overwrite, FALSE, FALSE, 0)
  p_msg  = g_strconcat(@"Vorhandener Text wird ", @Chr(195), @Chr(188), @"berschrieben" ,NULL)
  gtk_tooltips_set_tip (p_mte_tooltips_1, p_mte_o->p_checkbutton_overwrite, p_msg, NULL)
  g_free(p_msg)

  p_label_61 = gtk_label_new ("Dies und Das")
  gtk_widget_set_name (p_label_61, "p_label_61")
  gtk_widget_show (p_label_61)
  gtk_frame_set_label_widget (GTK_FRAME (p_frame_61), p_label_61)
  gtk_label_set_justify (GTK_LABEL (p_label_61), GTK_JUSTIFY_LEFT)

  p_frame_62 = gtk_frame_new (NULL)
  gtk_widget_set_name (p_frame_62, "p_frame_62")
  gtk_widget_show (p_frame_62)
  gtk_box_pack_start (GTK_BOX (p_hbox_61), p_frame_62, TRUE, TRUE, 0)
  gtk_container_set_border_width (GTK_CONTAINER (p_frame_62), 3)

  p_label_62 = gtk_label_new (("#"))
  gtk_widget_set_name (p_label_62, "p_label_62")
  gtk_widget_show (p_label_62)
  gtk_frame_set_label_widget (GTK_FRAME (p_frame_62), p_label_62)
  gtk_label_set_justify (GTK_LABEL (p_label_62), GTK_JUSTIFY_LEFT)

  p_label_6x = gtk_label_new ("Sonstiges")
  gtk_widget_set_name (p_label_6x, "p_label_6x")
  gtk_widget_show (p_label_6x)
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (p_notebook_1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (p_notebook_1), 5), p_label_6x)
  gtk_label_set_justify (GTK_LABEL (p_label_6x), GTK_JUSTIFY_LEFT)

'- Option Dialog mit Werten versorgen
'- Masseinheiten
  Select Case p_mte_o->p_daten->measurement_unit
    Case GTK_INCHES
        '- p_radiobutton_zoll aktivieren
      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_zoll),TRUE)
    Case GTK_CENTIMETERS
        '- p_radiobutton_zentimeter aktivieren
      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_zentimeter),TRUE)
    Case GTK_PIXELS  
        '- p_radiobutton_punkte aktivieren
      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p_mte_o->p_radiobutton_punkte),TRUE)
  End Select

  
'- Sonstiges  
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (p_mte_o->p_checkbutton_tooltip), p_mte_o->p_daten->tooltips)

  Res = mte_option_get_text_view()

'- Signale
  gtk_signal_connect (GTK_OBJECT (p_okbutton_1), "clicked", _
                      GTK_SIGNAL_FUNC (@mte_on_menuitem_option_okbutton_activate), NULL)

  gtk_signal_connect (GTK_OBJECT (p_cancelbutton_1), "clicked", _
                      GTK_SIGNAL_FUNC (@mte_on_menuitem_option_cancelbutton_activate), NULL)
                      
  gtk_widget_show_all (p_mte_o->p_dialog_option)
End Function

'----------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------


'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'- rieselkalk 2010
'- UTF8 Zeichensatz Ä 195 132, Ö 195 150, Ü 195 156, ß 195 159, ä 195 164, ö 195 182, ü 195 188
'- mte_file_103.bas



'- Allgeingültige Variablen und Konstanten
  Dim Shared As GtkWidget Ptr mte_p_my_gtk_dateidialog_entry_message
  Dim Shared As GtkWidget Ptr mte_p_my_gtk_dateidialog_entry_work
  Dim Shared As GtkWidget Ptr mte_p_my_gtk_dateidialog_file_chooser
  



Declare Function mte_ShowFileOpen (p_stitle As gchar Ptr, _
                              ByRef p_sfilename As gchar Ptr, _
                              p_pattern As gchar Ptr, _
                              p_default_folder As gchar Ptr, _
                              p_default_filename As gchar Ptr) As gInt
                              
Declare Function mte_ShowFileSaveAs (p_stitle As gchar Ptr, _
                              ByRef p_sfilename As gchar Ptr, _
                              p_pattern As gchar Ptr, _
                              p_default_folder As gchar Ptr, _
                              p_default_filename As gchar Ptr) As gInt
                              

'- Mehrere Datei auswahl Elemente (Pattern) Dateityp durch Trennzeichen hinzufügen
'- @"Basic (*.BAS;*.exe)|*.bas;*.exe|Bilder (*.JPG;*.BMP)|*.JPG;*.BMP"

Sub mte_my_gtk_dateidialog_filter_add(file_chooser As GtkWidget Ptr, _
                                  pattern  As gchar Ptr)
  #Define max 65                    
  Dim zsText As ZString Ptr
  Dim zsPatterns As ZString*max
  Dim p_Patterns As Any Ptr
  Dim i as Integer
  Dim j As Integer
  Dim n As Integer
  
  Dim p_f As GtkFileFilter Ptr
  p_f = gtk_file_filter_new()
  
  zsText = pattern
  n = 0
  j = 0
  i = 0
  Do While (zsText[i] > 0) Or (j > 0)
  If n = 0 Then
    Do While (zsText[i] > 0) Or (j > 0)    
       If (zsText[i] = Asc("|")) Or (zsText[i] = 0) Then
          zsPatterns[j] = 0
          p_patterns = @zspatterns
          p_f = gtk_file_filter_new()
          gtk_file_filter_set_name(p_f, p_patterns)
          j = 0
          If zsText[i] > 0 Then
          i = i + 1
          End If  
        Exit Do
       EndIf
       If j < max Then
         zspatterns[j] = zsText[i]
       End If  
       j = j + 1
      i = i + 1
    Loop
    n = 1
  Else  
    Do While (zsText[i] > 0) Or (j > 0)
       If (zsText[i] = Asc(";")) Or (zsText[i] = 0) Or (zsText[i] = Asc("|"))Then
          zsPatterns[j] = 0
          p_Patterns = @zsPatterns
          
          gtk_file_filter_add_pattern (p_f, p_patterns)
        j = -1
        If zsText[i] = 0 Then
          j = 0
          Exit do
        EndIf
        If zsText[i] = Asc("|") Then
             j = 0
            i = i + 1
            Exit Do
        EndIf      
       EndIf
       If j < max Then
         zsPatterns[j] = zsText[i]
       End If  
       j = j + 1
      i = i + 1
    Loop
    gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(file_chooser), p_f)
    n = 0
  End If
  Loop
End Sub


'- Button Abbrechen und ok hinzufügen
Sub mte_my_gtk_dateidialog_dialog_add(file_chooser As GtkWidget Ptr, _
                                  mode  As integer)

    Dim As GtkWidget Ptr dialog_action_area_1
    Dim As GtkWidget Ptr button_cancel
    Dim As GtkWidget Ptr button_save
    Dim As GtkWidget Ptr image_cancel
    Dim As GtkWidget Ptr image_save                                
    Dim As GtkWidget Ptr button_open
    Dim As GtkWidget Ptr button_openfolder  
    Dim As GtkWidget Ptr image_open
    Dim As GtkWidget Ptr image_openfolder
        
    Dim zs_text As ZString *21
    
    Dim As gchar Ptr p_gchar
    

'-  button_cancel = gtk_button_new   image_from_stock ("gtk-cancel")
  button_cancel = gtk_button_new
  image_cancel = gtk_image_new_from_stock ("gtk-cancel", GTK_ICON_SIZE_BUTTON)
  gtk_button_set_image(GTK_BUTTON(button_cancel), image_cancel)
  gtk_button_set_label(GTK_BUTTON(button_cancel), @"Abbrechen")
  gtk_widget_set_name (button_cancel, "button_cancel")
  gtk_widget_show (button_cancel)
  gtk_dialog_add_action_widget (GTK_DIALOG (file_chooser), button_cancel, GTK_RESPONSE_CANCEL)
  GTK_WIDGET_SET_FLAGS (button_cancel, GTK_CAN_DEFAULT)

'- 1 = Datei öffnen  
'- 2 = Ordner öffnen mit Lesezeichen Hinzufügen und Entfernen  
  Select Case mode
    Case 1, 8
        zs_text = Chr(195)+Chr(150)+"ffnen"
        p_gchar = @zs_text
      button_open = gtk_button_new
      image_open = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON)
        gtk_button_set_image(GTK_BUTTON(button_open), image_open)
        gtk_button_set_label(GTK_BUTTON(button_open), p_gchar)  
        gtk_widget_set_name (button_open, "button_open")
          gtk_widget_show (button_open)
        gtk_dialog_add_action_widget (GTK_DIALOG (file_chooser), button_open, GTK_RESPONSE_OK)
        GTK_WIDGET_SET_FLAGS (button_open, GTK_CAN_DEFAULT)
        gtk_widget_grab_default (button_open)
        gtk_widget_set_size_request (button_open, 100, 30)

    Case 2
        zs_text = Chr(195)+Chr(156)+"bernehmen"
        p_gchar = @zs_text
      button_openfolder = gtk_button_new
      image_openfolder = gtk_image_new_from_stock ("gtk-ok", GTK_ICON_SIZE_BUTTON)
        gtk_button_set_image(GTK_BUTTON(button_openfolder), image_openfolder)
        gtk_button_set_label(GTK_BUTTON(button_openfolder), p_gchar)  
        gtk_widget_set_name (button_openfolder, "button_openfolder")
          gtk_widget_show (button_openfolder)
        gtk_dialog_add_action_widget (GTK_DIALOG (file_chooser), button_openfolder, GTK_RESPONSE_OK)
        GTK_WIDGET_SET_FLAGS (button_openfolder, GTK_CAN_DEFAULT)
        gtk_widget_grab_default (button_openfolder)        
    Case 16 To 64, 256
        button_save = gtk_button_new
        image_save = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_BUTTON)
        gtk_button_set_image(GTK_BUTTON(button_save), image_save)
        gtk_button_set_label(GTK_BUTTON(button_save), @"Speichern")  
        gtk_widget_set_name (button_save, "button_save")
        gtk_widget_show (button_save)
        gtk_dialog_add_action_widget (GTK_DIALOG (file_chooser), button_save, GTK_RESPONSE_OK)
        GTK_WIDGET_SET_FLAGS (button_save, GTK_CAN_DEFAULT)
        gtk_widget_grab_default (button_save)
  End Select
                                  
End Sub




Function mte_ShowFileOpen (p_stitle As gchar Ptr, _
                              ByRef p_sfilename As gchar Ptr, _
                              p_pattern As gchar Ptr, _
                              p_default_folder As gchar Ptr, _
                              p_default_filename As gchar Ptr) As gInt

  Dim  p_filename As gchar Ptr
  
  mte_ShowFileOpen = 0
  
  mte_p_my_gtk_dateidialog_file_chooser = gtk_file_chooser_dialog_new (p_sTitle, _
                                              NULL, _
                                              GTK_FILE_CHOOSER_ACTION_OPEN, _
                                              NULL)                              
  
  gtk_window_set_position (GTK_WINDOW (mte_p_my_gtk_dateidialog_file_chooser), GTK_WIN_POS_CENTER)      
'  gtk_window_set_default_size (GTK_WINDOW (p_my_gtk_dateidialog_file_chooser), 600, 400)

'  gtk_window_resize (GTK_WINDOW (p_my_gtk_dateidialog_file_chooser), 600, 400)
'  gtk_widget_set_size_request(GTK_WIDGET(p_my_gtk_dateidialog_file_chooser), 600, 400)
'  gtk_window_set_resizable (GTK_WINDOW (p_my_gtk_dateidialog_file_chooser),FALSE)
                                          
'  gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (p_my_gtk_dateidialog_file_chooser), TRUE) V 2.8

'-  Button Cancel Save Open hinzufügen
  mte_my_gtk_dateidialog_dialog_add(mte_p_my_gtk_dateidialog_file_chooser, 1)
  
  
'- Datei öffnen
  gtk_file_chooser_set_action (GTK_FILE_CHOOSER (mte_p_my_gtk_dateidialog_file_chooser), GTK_FILE_CHOOSER_ACTION_OPEN)
  mte_my_gtk_dateidialog_filter_add(mte_p_my_gtk_dateidialog_file_chooser, p_Pattern)
  gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (mte_p_my_gtk_dateidialog_file_chooser), TRUE) 'Standart
        

  If gtk_dialog_run (GTK_DIALOG (mte_p_my_gtk_dateidialog_file_chooser)) = GTK_RESPONSE_OK Then
    mte_ShowFileOpen = -1 ' Dialog war erfolgreich
    p_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (mte_p_my_gtk_dateidialog_file_chooser))
    p_sFileName = g_strdup(p_filename)
  End If  
  gtk_widget_destroy (mte_p_my_gtk_dateidialog_file_chooser)    
  If p_FileName <> NULL Then
    g_free(p_FileName)
  EndIf        
  If mte_p_my_gtk_dateidialog_file_chooser <> NULL Then
    g_free (mte_p_my_gtk_dateidialog_file_chooser)
  EndIf
End Function

Function mte_readfile (p_objekt As t_mte Ptr, p_sFilename As gchar ptr) As gint
  Dim p_err As Gerror Ptr = NULL
  Dim p_status As gchar Ptr
  Dim p_text As gchar Ptr
  Dim res As gint
  
    mte_readfile = TRUE
    
'- Lese Datei Meldung in die Statusbar schreiben    
'   p_status = g_strdup_printf ("Lese %s...", dateiname)

    gtk_entry_set_text (GTK_ENTRY (p_objekt->p_entry_6), p_sFilename)
    
'- Überprüfen ob noch ereignisse anstehen (mainloop)
    While gtk_events_pending()
        gtk_main_iteration()
    Wend
    
'- Datei lesen
'  mte_MsgBox (p_sFilename, @"meldung")
    res = g_file_get_contents_utf8 (p_sFilename, @p_text, NULL, @p_err)
    If res = FALSE Then
        '- Fehler beim Datei lesen. Zeige dem Benutzer eine Meldung
        p_status = g_strconcat(@"Fehler beim ", @Chr(195), @Chr(182), @"ffnen der Datei.", NULL)
        mte_MsgBox (p_status, @"Fehlermeldung", FALSE)
'       mte_MsgBox (p_err->message, @"Fehlermeldung", FALSE)
'       mte_MsgBox (p_text, @"Fehlermeldung", FALSE)
        GoTo Fehler
    EndIf
    
'- text Anzeige ausschalten, da der text buffer geladen wird
  gtk_widget_set_sensitive (p_objekt->p_textview_1, FALSE)
'  gtk_text_buffer_set_text (p_objekt->p_buffer_1, "", -1)
  gtk_text_buffer_set_text (p_objekt->p_buffer_1, p_text, -1)
  gtk_text_buffer_set_modified (p_objekt->p_buffer_1, FALSE)
  gtk_widget_set_sensitive (p_objekt->p_textview_1, TRUE)
  
'- den aktuellen dateinamen setzen, da lesen ok war
  If Not (p_objekt->p_dateiname_1 = NULL) Then
    g_free (p_objekt->p_dateiname_1)
  EndIf
  p_objekt->p_dateiname_1 = g_strdup(p_sFilename)
  GoTo Ausgang
Fehler:
  mte_readfile = FALSE
Ausgang:
  If p_err <> NULL Then
    g_error_free (p_err)
  EndIf  
  If p_status <> NULL Then
    g_free(p_status)
  EndIf  
  If p_text <> NULL Then
    g_free(p_text)
  EndIf    
End Function

Function mte_read (p_objekt As t_mte Ptr) As gint
  Dim Res As gint
  Dim p_status As gchar Ptr
  Dim p_sFileName As gchar Ptr
  Dim p_Caption As gchar Ptr
  
  mte_read = TRUE
  

  p_Caption  = g_strconcat(@"Datei ", @Chr(195), @Chr(182), "ffnen", NULL)
  p_sFileName = g_strconcat(@"KeinName.txt", NULL)
    
    Res = mte_ShowFileOpen (p_Caption, p_sFileName, _
                                @"Alle Dateien(*.*)|*.*|Basic (*.bas;*.txt)|*.bas;*.txt|mte Dateien(*.mte)|*.mte", _
                                  @"C:\Temp", _
                                  @"Dokument.txt")
  If Res = Not FALSE Then
'   mte_MsgBox (p_sFilename, @"meldung")
    Res = mte_readfile (p_objekt, p_sFileName)
  Else
    p_status = g_strconcat(@"Es wurde keine Datei ausgew", @Chr(195), @Chr(164), @"hlt.")
    gtk_entry_set_text (GTK_ENTRY (p_objekt->p_entry_6), p_status)
    GoTo Fehler
  End If    
  GoTo Ausgang
Fehler:
  mte_read = FALSE  
Ausgang:
  If p_status <> NULL Then
    g_free(p_status)
  EndIf  
  If p_Caption <> NULL Then
    g_free(p_Caption)
  Endif  
  If p_sFileName <> NULL Then
    g_free(p_sFileName)
  EndIf    
End Function

Function my_g_file_set_contents_utf8(p_filename As gchar ptr, _
                                       p_contents As gchar ptr, _
                                       length As gsize, _
                                       pp_error As gerror Ptr Ptr) As gint
                                      
    Dim FileNum As Integer
    Dim filename As String
    Dim i As Integer
    Dim j As Double
    Dim res As Integer
    Dim retval As gboolean
    Dim save_errno As Integer
    Dim p_rename_error As GError Ptr = NULL
                              
    my_g_file_set_contents_utf8 = TRUE

'- übergebene parameter testen
    If p_filename = NULL Then
        my_g_file_set_contents_utf8 = FALSE
        GoTo Ausgang
    EndIf
    If p_contents = NULL Then
        my_g_file_set_contents_utf8 = FALSE
        GoTo Ausgang
    EndIf
    If length < -1 Then
        my_g_file_set_contents_utf8 = FALSE
        GoTo Ausgang
    EndIf

'- dateiname in einem string wandeln
    filename = ""
    i = 0  
    Do While p_filename[i] <> 0
        filename = filename + Chr(p_filename[i])
        i = i + 1
        If i > 255 Then
            my_g_file_set_contents_utf8 = FALSE
            GoTo Ausgang
            Exit do
        EndIf
    Loop
'- datei öffnen    
  On Error GoTo Fehler
  FileNum = FreeFile
    res = Open (filename FOR Binary AS #FileNum)
    If res <> 0 Then
        my_g_file_set_contents_utf8 = FALSE
        GoTo Ausgang
    EndIf
'- datei speichern  
  j = 0
    Do While p_contents[j] <> 0
        Put #FileNum, ,p_contents[j]
        j = j + 1
        If j > &H7FFFFFFFFFFFFFFF Then
            my_g_file_set_contents_utf8 = FALSE
            Put #FileNum, ,Chr(0)
            GoTo Ausgang
            Exit do
        EndIf
    Loop
    Put #FileNum, ,Chr(0)
    GoTo Ausgang
Fehler:
    my_g_file_set_contents_utf8 = FALSE
Ausgang:
  On Error GoTo 0
  Close #FileNum
  my_g_file_set_contents_utf8 = TRUE
End Function

Function mte_ShowFileSaveAs (p_stitle As gchar Ptr, _
                              ByRef p_sfilename As gchar Ptr, _
                              p_pattern As gchar Ptr, _
                              p_default_folder As gchar Ptr, _
                              p_default_filename As gchar Ptr) As gInt

  Dim  p_filename As gchar Ptr
  
  mte_ShowFileSaveAs = FALSE
  
  mte_p_my_gtk_dateidialog_file_chooser = gtk_file_chooser_dialog_new (p_sTitle, _
                                              NULL, _
                                              GTK_FILE_CHOOSER_ACTION_SAVE, _
                                              NULL)                              
  
  gtk_window_set_position (GTK_WINDOW (mte_p_my_gtk_dateidialog_file_chooser), GTK_WIN_POS_CENTER)      
'  gtk_window_set_default_size (GTK_WINDOW (p_my_gtk_dateidialog_file_chooser), 600, 400)

'  gtk_window_resize (GTK_WINDOW (p_my_gtk_dateidialog_file_chooser), 600, 400)
'  gtk_widget_set_size_request(GTK_WIDGET(p_my_gtk_dateidialog_file_chooser), 600, 400)
'  gtk_window_set_resizable (GTK_WINDOW (p_my_gtk_dateidialog_file_chooser),FALSE)
                                          
'  gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (p_my_gtk_dateidialog_file_chooser), TRUE) V 2.8

'-  Button Cancel Save Open hinzufügen
  mte_my_gtk_dateidialog_dialog_add(mte_p_my_gtk_dateidialog_file_chooser, 32)
  
'- Datei speichern als
  gtk_file_chooser_set_action (GTK_FILE_CHOOSER (mte_p_my_gtk_dateidialog_file_chooser), GTK_FILE_CHOOSER_ACTION_SAVE)
  gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (mte_p_my_gtk_dateidialog_file_chooser), p_sFileName)
  
  If gtk_dialog_run (GTK_DIALOG (mte_p_my_gtk_dateidialog_file_chooser)) = GTK_RESPONSE_OK Then
    mte_ShowFileSaveAs = TRUE ' Dialog war erfolgreich
    p_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (mte_p_my_gtk_dateidialog_file_chooser))
    p_sFileName = g_strdup(p_filename)
  End If  
  gtk_widget_destroy (mte_p_my_gtk_dateidialog_file_chooser)    
  If p_FileName <> NULL Then
    g_free(p_FileName)
  EndIf
  If mte_p_my_gtk_dateidialog_file_chooser <> NULL Then
    g_free (mte_p_my_gtk_dateidialog_file_chooser)
  EndIf
End Function

Function mte_writefile (p_objekt As t_mte Ptr, p_sFilename As gchar ptr) As gint
  Dim p_err As Gerror Ptr = NULL
  Dim p_status As gchar Ptr
  Dim p_text As gchar Ptr
  Dim res As gint
  Dim iterstart As GtkTextIter
  Dim iterend As GtkTextIter

'  mte_MsgBox (p_sFilename, @"meldung")
  
    mte_writefile = TRUE
    
'- Schreibe Datei Meldung in die Statusbar schreiben    
'   p_status = g_strdup_printf ("Lese %s...", dateiname)
  If p_sFilename = NULL Then
    gtk_entry_set_text (GTK_ENTRY (p_objekt->p_entry_6), p_objekt->p_dateiname_1)
  Else
      gtk_entry_set_text (GTK_ENTRY (p_objekt->p_entry_6), p_sFilename)
  EndIf
  
'- Überprüfen ob noch ereignisse anstehen (mainloop)
    While gtk_events_pending()
        gtk_main_iteration()
    Wend

'- text Anzeige ausschalten, damit der text buffer geändert wird
  gtk_widget_set_sensitive (p_objekt->p_textview_1, FALSE)
'  p_objekt->p_buffer_1 = gtk_text_view_get_buffer (GTK_TEXT_VIEW (p_objekt->p_textview_1))
  gtk_text_buffer_get_start_iter (p_objekt->p_buffer_1, @iterstart)
  gtk_text_buffer_get_end_iter (p_objekt->p_buffer_1, @iterend)
  p_text = gtk_text_buffer_get_text (p_objekt->p_buffer_1, @iterstart, @iterend, FALSE)
  gtk_text_buffer_set_modified (p_objekt->p_buffer_1, FALSE)
  gtk_widget_set_sensitive (p_objekt->p_textview_1, TRUE)
  
'- Den Text vom buffer speichern
'- Ach, wäre das Leben langweilig, wenn alles auf einmal klappen würde
'- "g_file_set_contents" erst ab glib 2.8
  If p_sFilename = NULL Then
'   res = g_file_set_contents_utf8 (p_objekt->p_dateiname_1, p_text, -1, @p_err)    
    res = my_g_file_set_contents_utf8 (p_objekt->p_dateiname_1, p_text, -1, @p_err)
  Else
'     res = g_file_set_contents_utf8 (p_sFilename, p_text, -1, @p_err)
      res = my_g_file_set_contents_utf8 (p_sFilename, p_text, -1, @p_err)
  EndIf
  g_free(p_text)
  
'- Wenn speichern nicht möglich dann Fehlermeldung
  If res = FALSE Then
'   mte_MsgBox (p_err->message, @"Fehlermeldung")
'   g_error_free(p_err)
    gtk_entry_set_text (GTK_ENTRY (p_objekt->p_entry_6), @"Datei konnte nicht geschrieben werden")
    GoTo Fehler
  EndIf

'- den aktuellen dateinamen setzen, da schreiben ok war und ein neuer Dateiname gewählt wurde
  If p_sFilename <> NULL Then  
    If Not (p_objekt->p_dateiname_1 = NULL) Then
      g_free (p_objekt->p_dateiname_1)
    EndIf
    p_objekt->p_dateiname_1 = g_strdup(p_sFilename)
  EndIf  
  GoTo Ausgang
  
Fehler:  
  mte_writefile = FALSE
Ausgang:    
End Function

Function mte_writeas (p_objekt As t_mte Ptr) As gint
  Dim Res As gint
  Dim p_status As gchar Ptr
  Dim p_sFileName As gchar Ptr
  Dim p_Caption As gchar Ptr
  
  mte_writeas = TRUE
  

  p_Caption  = g_strconcat(@"Datei speichern als", NULL)
  p_sFileName = g_strconcat(@"KeinName.txt", NULL)
    
'- Datei Winget zur Anzeige bringen
    Res = mte_ShowFileSaveAs (p_Caption, p_sFileName, _
                                @"Alle Dateien(*.*)|*.*|Basic (*.bas;*.txt)|*.bas;*.txt|mte Dateien(*.mte)|*.mte", _
                                  @"C:\Temp", _
                                  @"Dokument.txt")
                                                          
  If Res = TRUE Then
    '- Testen ob Datei vorhanden
    if g_file_test_utf8 (p_sfilename, G_FILE_TEST_EXISTS) = TRUE Then
        '- Abfrage ob Datei überschrieben werden soll
        p_status = g_strconcat(@"Datei ist schon vorhanden. ", @Chr(195), @Chr(156), @"berschreiben?", NULL)
        Res = mte_MsgBox (p_status, @"Meldung", TRUE)
        If Res = FALSE Then
            Print Res
          GoTo Ausgang
        EndIf  
    EndIf
    '- Datei speichern
    Res = mte_writefile (p_objekt, p_sFileName)
  Else
    '- Datei Auswahl wurde abgebrochen
    p_status = g_strconcat(@"Es wurde keine Datei ausgew", @Chr(195), @Chr(164), @"hlt.", NULL)
    gtk_entry_set_text (GTK_ENTRY (p_objekt->p_entry_6), p_status)
    GoTo Fehler
  End If      
  GoTo Ausgang
Fehler:
  mte_writeas = FALSE
Ausgang:
  If p_status <> NULL Then
    g_free(p_status)
  EndIf  
  If p_Caption <> NULL Then
    g_free(p_Caption)
  Endif  
  If p_sFileName <> NULL Then
    g_free(p_sFileName)
  EndIf    
End Function

Function mte_write (p_objekt As t_mte Ptr) As gint
  Dim Res As gint
  Dim p_sFileName As gchar Ptr
  
  mte_write = TRUE
  
  p_sFileName = NULL
  If (p_objekt->p_dateiname_1 = NULL) Then
    Res = mte_writeas(p_objekt)
  Else
    Res = mte_writefile (p_objekt, p_sFileName)    
  EndIf
  If Res = FALSE Then
    mte_write = FALSE
  EndIf
  GoTo Ausgang
  
Fehler:
  mte_write = FALSE
Ausgang:
  If p_sFileName <> NULL Then
    g_free(p_sFileName)
  EndIf    
End Function

'----------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------


'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'- rieselkalk 2010
'- mte_format_103.bas



Function mte_setFontColor(p_objekt As t_mte Ptr) As gint
  Dim Res As gint
    Dim p_colorvalue As gchar Ptr
    Dim p_tagname As gchar Ptr
    Dim p_tagcolor As GtkTextTag Ptr
    Dim iter_top As GtkTextIter
    Dim iter_bottom As GtkTextIter
    Dim iter_cur As GtkTextIter
    Dim p_mark_cur As GtkTextMark Ptr
    
    mte_setFontColor = TRUE
    
    gtk_text_buffer_get_selection_bounds(p_objekt->p_buffer_1, @iter_top, @iter_bottom)
    p_mark_cur = gtk_text_buffer_get_insert(p_objekt->p_buffer_1)
  gtk_text_buffer_get_iter_at_mark(p_objekt->p_buffer_1, @iter_cur, p_mark_cur)
  
    If gtk_text_iter_equal(@iter_top, @iter_bottom) = FALSE Then    
    Res = mte_ShowColorDialog(p_colorvalue)
    If Res = TRUE Then
      p_tagname = g_strconcat(@"color-", p_colorvalue, NULL)
    
      p_tagcolor = gtk_text_buffer_create_tag(p_objekt->p_buffer_1, _
                  p_tagname, "foreground", p_colorvalue, NULL)  'p_mte->p_foreground
      
      gtk_text_buffer_apply_tag_by_name(p_objekt->p_buffer_1, p_tagname, @iter_top, @iter_bottom)
    Else
        mte_setFontColor = FALSE
    EndIf
  Else
    mte_setFontColor = FALSE
  EndIf
    
Ausgang:
  If p_colorvalue <> NULL Then
    g_free(p_colorvalue)
  EndIf
  If p_tagcolor <> NULL Then
    g_free(p_tagcolor)
  EndIf
  If p_tagname <> NULL Then
    g_free(p_tagname)
  EndIf
  If p_mark_cur <> NULL Then
    g_free(p_mark_cur)
  EndIf  
End Function



Function mte_setFont(p_objekt As t_mte Ptr) As gint
  Dim Res As gint
    Dim p_fontvalue As gchar Ptr
    Dim p_tagname As gchar Ptr
    Dim p_tagfont As GtkTextTag Ptr
    Dim iter_top As GtkTextIter
    Dim iter_bottom As GtkTextIter
    Dim iter_cur As GtkTextIter
    Dim p_mark_cur As GtkTextMark Ptr
    
    mte_setFont = TRUE
    
    gtk_text_buffer_get_selection_bounds(p_objekt->p_buffer_1, @iter_top, @iter_bottom)
    p_mark_cur = gtk_text_buffer_get_insert(p_objekt->p_buffer_1)
  gtk_text_buffer_get_iter_at_mark(p_objekt->p_buffer_1, @iter_cur, p_mark_cur)
  
    If gtk_text_iter_equal(@iter_top, @iter_bottom) = FALSE Then    
    Res = mte_ShowFontDialog(p_fontvalue)
    If Res = TRUE Then
      p_tagname = g_strconcat(@"font-", p_fontvalue, NULL)
    
      p_tagfont = gtk_text_buffer_create_tag(p_objekt->p_buffer_1, _
                  p_tagname, "font", p_fontvalue, NULL)  'p_mte->p_foreground
      
      gtk_text_buffer_apply_tag_by_name(p_objekt->p_buffer_1, p_tagname, @iter_top, @iter_bottom)
    Else
        mte_setFont = FALSE
    EndIf
  Else
    mte_setFont = FALSE
  EndIf
    
Ausgang:
  If p_fontvalue <> NULL Then
    g_free(p_fontvalue)
  EndIf
  If p_tagfont <> NULL Then
    g_free(p_tagfont)
  EndIf
  If p_tagname <> NULL Then
    g_free(p_tagname)
  EndIf
  If p_mark_cur <> NULL Then
    g_free(p_mark_cur)
  EndIf  
End Function


Function mte_formatieren(p_objekt As t_mte Ptr, num As gint) As gint
    Dim iter_top As GtkTextIter
    Dim iter_bottom As GtkTextIter
    Dim iter_cur As GtkTextIter
    Dim p_mark_cur As GtkTextMark Ptr
    mte_formatieren = TRUE
    
    gtk_text_buffer_get_selection_bounds(p_objekt->p_buffer_1, @iter_top, @iter_bottom)
    p_mark_cur = gtk_text_buffer_get_insert(p_mte->p_buffer_1)
  gtk_text_buffer_get_iter_at_mark(p_mte->p_buffer_1, @iter_cur, p_mark_cur)

    If gtk_text_iter_equal(@iter_top, @iter_bottom) = FALSE Then
      Select Case num
        Case 303                'Bold
          If gtk_text_iter_has_tag(@iter_top, p_objekt->p_bold) = FALSE Then
            '- Markierter Text ist nicht Fett
            gtk_text_buffer_apply_tag_by_name(p_objekt->p_buffer_1, @"bold", @iter_top, @iter_bottom)
          Else
            gtk_text_buffer_remove_tag_by_name(p_objekt->p_buffer_1, @"bold", @iter_top, @iter_bottom)
          EndIf
        Case 304                'Italic
          If gtk_text_iter_has_tag(@iter_top, p_objekt->p_italic) = FALSE Then
            '- Markierter Text ist nicht kursiv
            gtk_text_buffer_apply_tag_by_name(p_objekt->p_buffer_1, @"italic", @iter_top, @iter_bottom)
          Else
            gtk_text_buffer_remove_tag_by_name(p_objekt->p_buffer_1, @"italic", @iter_top, @iter_bottom)
          EndIf
        Case 305                'Underline  
          If gtk_text_iter_has_tag(@iter_top, p_objekt->p_underline) = FALSE Then
            '- Markierter Text ist nicht unterstrichen
            gtk_text_buffer_apply_tag_by_name(p_objekt->p_buffer_1, @"underline", @iter_top, @iter_bottom)
          Else
            gtk_text_buffer_remove_tag_by_name(p_objekt->p_buffer_1, @"underline", @iter_top, @iter_bottom)
          EndIf
      End Select
    EndIf  
Ausgang:    
  If p_mark_cur <> NULL Then
    g_free(p_mark_cur)
  EndIf    
End Function

'----------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------

'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'- rieselkalk 2010
'- events_103.bas

'- Fenster Ereignisse
Sub mte_on_window_1_resize  Cdecl (ByVal widget as GtkWidget ptr, ByVal p_ud as gpointer ptr)
  Dim  rlaenge As gint
  Dim  rhoehe As gint
  Dim  laenge As gint
  Dim  hoehe As gint
  Dim  tiefe As gint
  Dim  hlaenge As gint
  laenge = 0
  hoehe = 0
  
  gtk_window_get_size (GTK_WINDOW(p_mte->p_window_1),@laenge, @hoehe)
  rlaenge = laenge - 19
  gtk_ruler_set_range (GTK_RULER (p_mte->p_hruler_1), 0, rlaenge / 1.35, 160, rlaenge / 1.35)        
End Sub

'- Menü Ereignisse
'- Menü
Sub mte_on_menuitem_new_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
    gtk_text_buffer_set_text (p_mte->p_buffer_1, "", -1)
    gtk_entry_set_text (GTK_ENTRY (p_mte->p_entry_6), "")
End Sub
Sub mte_on_menuitem_open_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
  '- UTF8 Zeichensatz Ä 195 132, Ö 195 150, Ü 195 156, ß 195 159, ä 195 164, ö 195 182, ü 195 188
  Dim res As gint  
  res = mte_read(p_mte)
End sub
Sub mte_on_menuitem_save_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
  Dim res As gint  
  res = mte_write(p_mte)                                    
End sub
Sub mte_on_menuitem_saveas_activate  Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
  '- UTF8 Zeichensatz Ä 195 132, Ö 195 150, Ü 195 156, ß 195 159, ä 195 164, ö 195 182, ü 195 188
  Dim res As gint  
  res = mte_writeas(p_mte)                                
End sub
Sub mte_on_menuitem_print_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
End sub
Sub mte_on_menuitem_quit_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
  gtk_main_quit()
End Sub

'- Toolbar 1 und Menü
Sub mte_on_menuitem_cut_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
  Dim As GtkClipboard Ptr p_clipboard
  p_clipboard = gtk_clipboard_get (NULL)
  gtk_text_buffer_cut_clipboard(p_mte->p_buffer_1, p_clipboard, TRUE)
  If p_clipboard <> NULL Then
    g_free(p_clipboard)
  EndIf    
End sub
Sub mte_on_menuitem_copy_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
  Dim As GtkClipboard Ptr p_clipboard
  p_clipboard = gtk_clipboard_get (NULL)
  gtk_text_buffer_copy_clipboard(p_mte->p_buffer_1, p_clipboard)
  If p_clipboard <> NULL Then
    g_free(p_clipboard)
  EndIf    
End sub
Sub mte_on_menuitem_paste_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
  Dim As GtkClipboard Ptr p_clipboard
  p_clipboard = gtk_clipboard_get (NULL)
  gtk_text_buffer_paste_clipboard(p_mte->p_buffer_1, p_clipboard, NULL, TRUE)
  If p_clipboard <> NULL Then
    g_free(p_clipboard)
  EndIf    
End sub
Sub mte_on_menuitem_del_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
  gtk_text_buffer_delete_selection(p_mte->p_buffer_1, FALSE, TRUE)  
End sub
Sub mte_on_menuitem_find_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
  Dim Res As gint
  Res = mte_ShowFindDialog()
End sub
Sub mte_on_menuitem_replace_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
  Dim Res As gint
  Res = mte_ShowReplaceDialog()
End Sub

'- Menue
Sub mte_on_menuitem_markall_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
    Dim iter_top As GtkTextIter
  Dim iter_botton   As GtkTextIter
    gtk_text_buffer_get_bounds (p_mte->p_buffer_1, @iter_top, @iter_botton)
  gtk_text_buffer_select_range(p_mte->p_buffer_1, @iter_top, @iter_botton)
End sub
Sub mte_on_menuitem_delmark_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
    Dim iter_top As GtkTextIter
  Dim iter_botton   As GtkTextIter
  Dim p_mark_cursor As GtkTextMark Ptr
  p_mark_cursor = gtk_text_buffer_get_mark (p_mte->p_buffer_1, "insert")
    gtk_text_buffer_get_iter_at_mark (p_mte->p_buffer_1, @iter_top, p_mark_cursor)
    gtk_text_buffer_get_iter_at_mark (p_mte->p_buffer_1, @iter_botton, p_mark_cursor)
  gtk_text_buffer_select_range(p_mte->p_buffer_1, @iter_top, @iter_botton)
End Sub
Sub mte_on_menuitem_einstellungen_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
  Dim Res As gint
  Res = mte_ShowOptionDialog ()
'  mte_MsgBox (@"Die TextView Einstellungen wurden geaendert", @"Meldung", FALSE)
End Sub
Sub mte_on_menuitem_date_activate Cdecl (ByVal widget as GtkWidget ptr, ByVal p_ud as gpointer Ptr)
    Dim iter_cursor As GtkTextIter
  Dim p_mark_cursor As GtkTextMark Ptr
  Dim z_msg As ZString *(11)
  Dim p_msg As gchar ptr
  z_msg = Mid (Date, 4, 2) + "." + Mid (Date, 1, 2) + "."  + Mid (Date, 7, 4)
  p_msg  = g_strconcat(@z_msg, NULL)
'  g_print ("%s", p_msg)
  p_mark_cursor = gtk_text_buffer_get_mark (p_mte->p_buffer_1, "insert")
    gtk_text_buffer_get_iter_at_mark (p_mte->p_buffer_1, @iter_cursor, p_mark_cursor)
    gtk_text_buffer_insert (p_mte->p_buffer_1, @iter_cursor, p_msg, -1)
End sub
Sub mte_on_menuitem_time_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
    Dim iter_cursor As GtkTextIter
  Dim p_mark_cursor As GtkTextMark Ptr
  Dim z_msg As ZString *(11)
  Dim p_msg As gchar ptr
  z_msg = Mid (Time, 1, 5)
  p_msg  = g_strconcat(@z_msg, NULL)
'  g_print ("%s", p_msg)
  p_mark_cursor = gtk_text_buffer_get_mark (p_mte->p_buffer_1, "insert")
    gtk_text_buffer_get_iter_at_mark (p_mte->p_buffer_1, @iter_cursor, p_mark_cursor)
    gtk_text_buffer_insert (p_mte->p_buffer_1, @iter_cursor, p_msg, -1)
End sub
Sub mte_on_menuitem_umbruch_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
End sub
Sub mte_on_menuitem_font_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
    Dim Res As gint  
  Res = mte_setFont(p_mte)
End sub

Sub mte_on_menuitem_help_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
  mte_ShowHilfe ()
End Sub
Sub mte_on_menuitem_about_1_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
  mte_ShowAbout ()  
End sub

'- Buffer aktion
Sub mte_on_cursor_position_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
    Dim iter_cur As GtkTextIter
    Dim p_mark_cur As GtkTextMark Ptr
    Dim i_line As gint
    Dim i_chars As gint
    Dim p_line As gchar Ptr
  Dim p_chars As gchar Ptr
    
  p_mark_cur = gtk_text_buffer_get_insert(p_mte->p_buffer_1)
  gtk_text_buffer_get_iter_at_mark(p_mte->p_buffer_1, @iter_cur, p_mark_cur)
  i_line = gtk_text_iter_get_line (@iter_cur) + 1
  i_chars = gtk_text_iter_get_line_offset (@iter_cur)
  p_line = g_strdup_printf("%d", i_line)
  p_chars = g_strdup_printf("%d", i_chars)
  gtk_entry_set_text (GTK_ENTRY (p_mte->p_entry_3), p_line)
  gtk_entry_set_text (GTK_ENTRY (p_mte->p_entry_5), p_chars)
  If p_mark_cur <> NULL Then
    g_free(p_mark_cur)
  EndIf    
  If p_line <> NULL Then
    g_free(p_line)
  EndIf    
  If p_chars <> NULL Then
    g_free(p_chars)
  EndIf    
End Sub

'- Toolbar 2
Sub mte_on_menuitem_bold_activate Cdecl (ByVal widget as GtkWidget ptr, ByVal p_ud as gpointer Ptr)
    Dim Res As gint
    Res = mte_formatieren(p_mte, 303)
End Sub
Sub mte_on_menuitem_italic_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
    Dim Res As gint
    Res = mte_formatieren(p_mte, 304)
End sub
Sub mte_on_menuitem_underline_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
    Dim Res As gint
    Res = mte_formatieren(p_mte, 305)
End Sub
Sub mte_on_menuitem_color_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
    Dim Res As gint  
  Res = mte_setFontColor(p_mte)
End Sub

'- Home (H) Button gedrückt
Sub mte_on_menuitem_button_home_activate Cdecl (ByVal widget as GtkWidget ptr, byval p_ud as gpointer Ptr)
    Dim iter_start As GtkTextIter
  Dim p_mark_cursor As GtkTextMark Ptr

    '- den anfang vom Text Buffer holen und Iter setzen
    gtk_text_buffer_get_start_iter (p_mte->p_buffer_1, @iter_start)
  '- den Cursor auf Text Start (iter_start) setzen
  gtk_text_buffer_place_cursor(p_mte->p_buffer_1, @iter_start)
  '- Marker für Cursor holen
  p_mark_cursor = gtk_text_buffer_get_mark (p_mte->p_buffer_1, "insert")
    '- Fenster auf Cursor position setzen
    gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW(p_mte->p_textview_1), p_mark_cursor, 0, TRUE, 0.0, 0.0)
End Sub

'----------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------


'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'- rieselkalk 2010
'- face_103.bas


'- UTF8 Zeichensatz Ä 195 132, Ö 195 150, Ü 195 156, ß 195 159, ä 195 164, ö 195 182, ü 195 188    

'- Allgemein Gültige Zeiger anlegen

'  Dim Shared mte As t_mte
'  Dim Shared p_mte As t_mte Ptr
'  p_mte = @mte

' Menu Tasturkürzel mit AccelGroup bearbeiten
  p_mte->p_accel_group_1 = gtk_accel_group_new ()

  p_mte->p_window_1 = gtk_window_new (GTK_WINDOW_TOPLEVEL)
  gtk_widget_set_name (p_mte->p_window_1, "mte_window_1")
  gtk_window_set_title (GTK_WINDOW (p_mte->p_window_1), ("Mini Text Editor"))
  gtk_window_resize (GTK_WINDOW (p_mte->p_window_1), 500, 300)
  gtk_window_set_position (GTK_WINDOW (p_mte->p_window_1), GTK_WIN_POS_CENTER)
  gtk_window_add_accel_group (GTK_WINDOW (p_mte->p_window_1), p_mte->p_accel_group_1)
  g_signal_connect (G_OBJECT (p_mte->p_window_1), "size-request", _
                             G_CALLBACK (@mte_on_window_1_resize), p_mte)

                            
  mte.p_vbox_1 = gtk_vbox_new (FALSE, 0)
  gtk_widget_set_name (GTK_WIDGET(mte.p_vbox_1), "mte_vbox_1")
  gtk_container_add (GTK_CONTAINER (mte.p_window_1), mte.p_vbox_1)

  mte.p_menubar_1 = gtk_menu_bar_new ()
  gtk_widget_set_name (GTK_WIDGET(mte.p_menubar_1), "mte_menubar_1")
  gtk_box_pack_start (GTK_BOX (mte.p_vbox_1), mte.p_menubar_1, FALSE, FALSE, 0)

'- Haupt Menu Eintrag Datei
  mte.p_menuitem_file = gtk_menu_item_new_with_mnemonic ("_Datei")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_file), "mte_menuitem_file")
  gtk_container_add (GTK_CONTAINER (mte.p_menubar_1), mte.p_menuitem_file)

'- Sub Menu Eintrag Popup Datei  
  mte.p_menuitem_file_menu = gtk_menu_new ()
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_file_menu), "mte_menuitem_file_menu")
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (mte.p_menuitem_file), GTK_WIDGET(mte.p_menuitem_file_menu))

'- Menu Eintrag Neu      
  mte.p_menuitem_new = gtk_image_menu_item_new_with_mnemonic ("Neu")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_new), "mte_menuitem_new")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_file_menu), GTK_WIDGET(mte.p_menuitem_new))
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_new), "activate", _
                           G_CALLBACK (@mte_on_menuitem_new_activate), p_mte)
                    
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_new), "activate", mte.p_accel_group_1, _
                              GDK_N, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)

  mte.p_image_103 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU)
  gtk_widget_set_name (GTK_WIDGET(mte.p_image_103), "mte_image_103")
  gtk_image_menu_item_set_image (GTK_image_MENU_ITEM (mte.p_menuitem_new), mte.p_image_103)


'- Menu Eintrag Öffnen
  mte.p_menuitem_open = gtk_image_menu_item_new_with_mnemonic (Chr(195)+Chr(150)+"ffnen...")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_open), "mte_menuitem_open")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_file_menu), mte.p_menuitem_open)

  g_signal_connect (GTK_OBJECT (mte.p_menuitem_open), "activate", _
                             G_CALLBACK (@mte_on_menuitem_open_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_open), "activate", mte.p_accel_group_1, _
                              GDK_O, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)

  mte.p_image_104 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU)
  gtk_widget_set_name (GTK_WIDGET(mte.p_image_104), "mte_image_104")
  gtk_image_menu_item_set_image (GTK_image_MENU_ITEM (mte.p_menuitem_open), mte.p_image_104)

'- Menu Eintrag Speichern
  mte.p_menuitem_save = gtk_image_menu_item_new_with_mnemonic ("Speichern")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_save), "mte_menuitem_save")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_file_menu), mte.p_menuitem_save)
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_save), "activate", _
                             G_CALLBACK (@mte_on_menuitem_save_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_save), "activate", mte.p_accel_group_1, _
                              GDK_S, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)

  mte.p_image_105 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU)
  gtk_widget_set_name (GTK_WIDGET(mte.p_image_105), "mte_image_105")
  gtk_image_menu_item_set_image (GTK_image_MENU_ITEM (mte.p_menuitem_save), mte.p_image_105)

'- Menu Eintrag Speicher als
  mte.p_menuitem_saveas = gtk_image_menu_item_new_with_mnemonic ("Speichern als...")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_saveas), "mte_menuitem_saveas")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_file_menu), mte.p_menuitem_saveas)
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_saveas), "activate", _
                             G_CALLBACK (@mte_on_menuitem_saveas_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_saveas), "activate", mte.p_accel_group_1, _
                              GDK_A, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)

  mte.p_image_106 = gtk_image_new_from_stock ("gtk-save-as", GTK_ICON_SIZE_MENU)
  gtk_widget_set_name (GTK_WIDGET(mte.p_image_106), "mte_image_106")
  gtk_image_menu_item_set_image (GTK_image_MENU_ITEM (mte.p_menuitem_saveas), mte.p_image_106)

'- Menu Eintrag  separator 11
  mte.p_separator_11 = gtk_menu_item_new ()
  gtk_widget_set_name (GTK_WIDGET(mte.p_separator_11), "mte_separator_11")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_file_menu), mte.p_separator_11)
  gtk_widget_set_sensitive (GTK_WIDGET(mte.p_separator_11), FALSE)

'- Menu Eintrag Drucken
  mte.p_menuitem_print = gtk_image_menu_item_new_with_mnemonic ("Drucken")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_print), "mte_menuitem_print")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_file_menu), mte.p_menuitem_print)
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_print), "activate", _
                             G_CALLBACK (@mte_on_menuitem_print_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_print), "activate", mte.p_accel_group_1, _
                              GDK_P, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)

  mte.p_image_107 = gtk_image_new_from_stock ("gtk-print", GTK_ICON_SIZE_MENU)
  gtk_widget_set_name (GTK_WIDGET(mte.p_image_107), "mte_image_107")
  gtk_image_menu_item_set_image (GTK_image_MENU_ITEM (mte.p_menuitem_print), mte.p_image_107)

'- Menu Eintrag separator 12
  mte.p_separator_12 = gtk_menu_item_new ()
  gtk_widget_set_name (GTK_WIDGET(mte.p_separator_12), "mte_separator_12")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_file_menu), mte.p_separator_12)
  gtk_widget_set_sensitive (GTK_WIDGET(mte.p_separator_12), FALSE)

'- Menu Eintrag Beenden
  mte.p_menuitem_quit = gtk_image_menu_item_new_with_mnemonic ("Beenden")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_quit), "mte_menuitem_quit")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_file_menu), mte.p_menuitem_quit)
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_quit), "activate", _
                             G_CALLBACK (@mte_on_menuitem_quit_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_quit), "activate", mte.p_accel_group_1, _
                              GDK_Q, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)

  mte.p_image_108 = gtk_image_new_from_stock ("gtk-quit", GTK_ICON_SIZE_MENU)
  gtk_widget_set_name (GTK_WIDGET(mte.p_image_108), "mte_image_108")
  gtk_image_menu_item_set_image (GTK_image_MENU_ITEM (mte.p_menuitem_quit), mte.p_image_108)

'- Haupt Menu Eintrag Bearbeiten
  mte.p_menuitem_bearbeiten = gtk_menu_item_new_with_mnemonic ("_Bearbeiten")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_bearbeiten), "mte_menuitem_bearbeiten")
  gtk_container_add (GTK_CONTAINER (mte.p_menubar_1), mte.p_menuitem_bearbeiten)

'- Sub Menu Eintrag Popup Bearbeiten
  mte.p_menuitem_bearbeiten_menu = gtk_menu_new ()
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_bearbeiten_menu), "mte_menuitem_bearbeiten_menu")
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (mte.p_menuitem_bearbeiten), mte.p_menuitem_bearbeiten_menu)

'- Menu Eintrag Ausschneiden
  mte.p_menuitem_cut = gtk_image_menu_item_new_with_mnemonic ("Ausschneiden")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_cut), "mte_menuitem_cut")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_bearbeiten_menu), mte.p_menuitem_cut)
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_cut), "activate", _
                             G_CALLBACK (@mte_on_menuitem_cut_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_cut), "activate", mte.p_accel_group_1, _
                              GDK_X, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)

  mte.p_image_109 = gtk_image_new_from_stock ("gtk-cut", GTK_ICON_SIZE_MENU)
  gtk_widget_set_name (GTK_WIDGET(mte.p_image_109), "mte_image_109")
  gtk_image_menu_item_set_image (GTK_image_MENU_ITEM (mte.p_menuitem_cut), mte.p_image_109)

'- Menu Eintrag Kopieren
  mte.p_menuitem_copy = gtk_image_menu_item_new_with_mnemonic ("Kopieren")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_copy), "mte_menuitem_copy")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_bearbeiten_menu), mte.p_menuitem_copy)
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_copy), "activate", _
                             G_CALLBACK (@mte_on_menuitem_copy_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_copy), "activate", mte.p_accel_group_1, _
                              GDK_C, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)

  mte.p_image_110 = gtk_image_new_from_stock ("gtk-copy", GTK_ICON_SIZE_MENU)
  gtk_widget_set_name (GTK_WIDGET(mte.p_image_110), "mte_image_110")
  gtk_image_menu_item_set_image (GTK_image_MENU_ITEM (mte.p_menuitem_copy), mte.p_image_110)

'- Menu Eintrag Einfügen
  mte.p_menuitem_paste = gtk_image_menu_item_new_with_mnemonic ("Einf"+Chr(195)+Chr(188)+"gen")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_paste), "mte_menuitem_paste")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_bearbeiten_menu), mte.p_menuitem_paste)
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_paste), "activate", _
                             G_CALLBACK (@mte_on_menuitem_paste_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_paste), "activate", mte.p_accel_group_1, _
                              GDK_V, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)

  mte.p_image_111 = gtk_image_new_from_stock ("gtk-paste", GTK_ICON_SIZE_MENU)
  gtk_widget_set_name (GTK_WIDGET(mte.p_image_111), "mte_image_111")
  gtk_image_menu_item_set_image (GTK_image_MENU_ITEM (mte.p_menuitem_paste), mte.p_image_111)

'- Menu Eintrag Löschen
  mte.p_menuitem_del = gtk_image_menu_item_new_with_mnemonic ("L"+Chr(195)+Chr(182)+"schen")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_del), "mte_menuitem_del")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_bearbeiten_menu), mte.p_menuitem_del)
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_del), "activate", _
                             G_CALLBACK (@mte_on_menuitem_del_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_del), "activate", mte.p_accel_group_1, _
                              GDK_Del, 0, _
                              GTK_ACCEL_VISIBLE)

  mte.p_image_112 = gtk_image_new_from_stock ("gtk-delete", GTK_ICON_SIZE_MENU)
  gtk_widget_set_name (GTK_WIDGET(mte.p_image_112), "mte_image_112")
  gtk_image_menu_item_set_image (GTK_image_MENU_ITEM (mte.p_menuitem_del), mte.p_image_112)

'- Menu Eintrag seperator 21
  mte.p_separator_21 = gtk_menu_item_new ()
  gtk_widget_set_name (GTK_WIDGET(mte.p_separator_21), "mte_separator_21")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_bearbeiten_menu), mte.p_separator_21)
  gtk_widget_set_sensitive (GTK_WIDGET(mte.p_separator_21), FALSE)

'- Menu Eintrag Suchen
  mte.p_menuitem_find = gtk_image_menu_item_new_with_mnemonic ("Suchen...")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_find), "mte_menuitem_find")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_bearbeiten_menu), mte.p_menuitem_find)
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_find), "activate", _
                             G_CALLBACK (@mte_on_menuitem_find_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_find), "activate", mte.p_accel_group_1, _
                              GDK_F, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)

  mte.p_image_113 = gtk_image_new_from_stock ("gtk-find", GTK_ICON_SIZE_MENU)
  gtk_widget_set_name (GTK_WIDGET(mte.p_image_113), "mte_image_113")
  gtk_image_menu_item_set_image (GTK_image_MENU_ITEM (mte.p_menuitem_find), mte.p_image_113)

'- Menu Eintrag Ersetzen
  mte.p_menuitem_replace = gtk_image_menu_item_new_with_mnemonic ("Ersetzen...")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_replace), "mte_menuitem_replace")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_bearbeiten_menu), mte.p_menuitem_replace)
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_replace), "activate", _
                             G_CALLBACK (@mte_on_menuitem_replace_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_replace), "activate", mte.p_accel_group_1, _
                              GDK_H, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)

  mte.p_image_114 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU)
  gtk_widget_set_name (GTK_WIDGET(mte.p_image_114), "mte_image_114")
  gtk_image_menu_item_set_image (GTK_image_MENU_ITEM (mte.p_menuitem_replace), mte.p_image_114)

'- Menu Eintrag separator 22
  mte.p_separator_22 = gtk_menu_item_new ()
  gtk_widget_set_name (GTK_WIDGET(mte.p_separator_22), "mte_separator_22")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_bearbeiten_menu), mte.p_separator_22)
  gtk_widget_set_sensitive (GTK_WIDGET(mte.p_separator_22), FALSE)

'- Menu Eintrag Alles markieren
  mte.p_menuitem_markall = gtk_menu_item_new_with_mnemonic ("Alles markieren")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_markall), "mte_menuitem_markall")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_bearbeiten_menu), mte.p_menuitem_markall)
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_markall), "activate", _
                             G_CALLBACK (@mte_on_menuitem_markall_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_markall), "activate", mte.p_accel_group_1, _
                              GDK_M, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)

'- Menu Eintrag Markierung entfernen
  mte.p_menuitem_delmark = gtk_menu_item_new_with_mnemonic ("Markierung entfernen")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_delmark), "mte_menuitem_delmark")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_bearbeiten_menu), mte.p_menuitem_delmark)
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_delmark), "activate", _
                             G_CALLBACK (@mte_on_menuitem_delmark_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_delmark), "activate", mte.p_accel_group_1, _
                              GDK_E, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)

'- Haupt Menu Eintrag Ansicht
  mte.p_menuitem_ansicht = gtk_menu_item_new_with_mnemonic ("_Ansicht")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_ansicht), "mte_menuitem_ansicht")
  gtk_container_add (GTK_CONTAINER (mte.p_menubar_1), mte.p_menuitem_ansicht)

'- Sub Menu Eintrag Popup Ansicht
  mte.p_menuitem_ansicht_menu = gtk_menu_new ()
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_ansicht_menu), "mte_menuitem_ansicht_menu")
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (mte.p_menuitem_ansicht), mte.p_menuitem_ansicht_menu)

'- Menu Eintrag Symbolleiste
  mte.p_menuitem_symbolleiste = gtk_menu_item_new_with_mnemonic ("Symbolleiste")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_symbolleiste), "mte_menuitem_symbolleiste")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_ansicht_menu), mte.p_menuitem_symbolleiste)

'- Menu Eintrag Formatierungsleiste
  mte.p_menuitem_formatierungsleiste = gtk_menu_item_new_with_mnemonic ("Formatierungsleiste")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_formatierungsleiste), "mte_menuitem_formatierungsleiste")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_ansicht_menu), mte.p_menuitem_formatierungsleiste)

'- Menu Eintrag Linealleiste
  mte.p_menuitem_linealleiste = gtk_menu_item_new_with_mnemonic ("Linealleiste")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_linealleiste), "mte_menuitem_linealleiste")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_ansicht_menu), mte.p_menuitem_linealleiste)

'- Menu Eintrag Statusleiste
  mte.p_menuitem_statusleiste = gtk_menu_item_new_with_mnemonic ("Statusleiste")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_statusleiste), "mte_menuitem_statusleiste")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_ansicht_menu), mte.p_menuitem_statusleiste)

'- Menu Eintrag separator 31
  mte.p_separator_31 = gtk_menu_item_new ()
  gtk_widget_set_name (GTK_WIDGET(mte.p_separator_31), "mte_separator_31")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_ansicht_menu), mte.p_separator_31)
  gtk_widget_set_sensitive (GTK_WIDGET(mte.p_separator_31), FALSE)

'- Menu Eintrag Einstellungen
  mte.p_menuitem_einstellungen = gtk_menu_item_new_with_mnemonic ("Einstellungen...")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_einstellungen), "mte_menuitem_einstellungen")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_ansicht_menu), mte.p_menuitem_einstellungen)

  g_signal_connect (GTK_OBJECT (mte.p_menuitem_einstellungen), "activate", _
                             G_CALLBACK (@mte_on_menuitem_einstellungen_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_einstellungen), "activate", mte.p_accel_group_1, _
                              GDK_E, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)


'- Haupt Menu Eintrag Einfügen
  mte.p_menuitem_insert = gtk_menu_item_new_with_mnemonic ("_Einf"+Chr(195)+Chr(188)+"gen")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_insert), "mte_menuitem_insert")
  gtk_container_add (GTK_CONTAINER (mte.p_menubar_1), mte.p_menuitem_insert)

'- Sub Menu Eintrag Popup Einfügen
  mte.p_menuitem_insert_menu = gtk_menu_new ()
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_insert_menu), "mte_menuitem_insert_menu")
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (mte.p_menuitem_insert), mte.p_menuitem_insert_menu)

'- Menu Eintrag Datum
  mte.p_menuitem_date = gtk_menu_item_new_with_mnemonic ("Datum")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_date), "mte_menuitem_date")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_insert_menu), mte.p_menuitem_date)
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_date), "activate", _
                             G_CALLBACK (@mte_on_menuitem_date_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_date), "activate", mte.p_accel_group_1, _
                              GDK_D, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)

'- Menu Eintrag Uhrzeit
  mte.p_menuitem_time = gtk_menu_item_new_with_mnemonic ("Uhrzeit")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_time), "mte_menuitem_time")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_insert_menu), mte.p_menuitem_time)
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_time), "activate", _
                             G_CALLBACK (@mte_on_menuitem_time_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_time), "activate", mte.p_accel_group_1, _
                              GDK_U, GDK_CONTROL_MASK, _
                              GTK_ACCEL_VISIBLE)

'- Haupt Menu Eintrag Format
  mte.p_menuitem_format = gtk_menu_item_new_with_mnemonic ("_Format")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_format), "mte_menuitem_format")
  gtk_container_add (GTK_CONTAINER (mte.p_menubar_1), mte.p_menuitem_format)

'- Sub Menu Eintrag Popup Format
  mte.p_menuitem_format_menu = gtk_menu_new ()
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_format_menu), "mte_menuitem_format_menu")
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (mte.p_menuitem_format), mte.p_menuitem_format_menu)

'- Menu Eintrag Schriftart
  mte.p_menuitem_font = gtk_menu_item_new_with_mnemonic ("Schriftart...")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_font), "mte_menuitem_font")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_format_menu), mte.p_menuitem_font)

  g_signal_connect (GTK_OBJECT (mte.p_menuitem_font), "activate", _
                             G_CALLBACK (@mte_on_menuitem_font_activate), p_mte)

'  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_font), "activate", mte.p_accel_group_1, _
'                              GDK_T, GDK_CONTROL_MASK, _
'                              GTK_ACCEL_VISIBLE)

'- Menu Eintrag Aufzählungszeichen
  mte.p_menuitem_aufzaehlungszeichen = gtk_menu_item_new_with_mnemonic ("Aufzaehlungszeichen")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_Aufzaehlungszeichen), "mte_menuitem_Aufzaehlungszeichen")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_format_menu), mte.p_menuitem_Aufzaehlungszeichen)

'- Menu Eintrag Absatz...
  mte.p_menuitem_absatz = gtk_menu_item_new_with_mnemonic ("Absatz...")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_absatz), "mte_menuitem_absatz")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_format_menu), mte.p_menuitem_absatz)

'- Menu Eintrag Tabstop
  mte.p_menuitem_tabstop = gtk_menu_item_new_with_mnemonic ("Tabstop")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_tabstop), "mte_menuitem_tabstop")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_format_menu), mte.p_menuitem_tabstop)


'- Haupt Menu Eintrag Hilfe
  mte.p_menuitem_hilfe = gtk_menu_item_new_with_mnemonic ("_Hilfe")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_hilfe), "mte_menuitem_hilfe")
  gtk_container_add (GTK_CONTAINER (mte.p_menubar_1), mte.p_menuitem_hilfe)

'- Sub Menu Eintrag Popup Hilfe
  mte.p_menuitem_hilfe_menu = gtk_menu_new ()
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_hilfe_menu), "mte_menuitem_hilfe_menu")
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (mte.p_menuitem_hilfe), mte.p_menuitem_hilfe_menu)

'- Menu Eintrag Hilfe
  mte.p_menuitem_help = gtk_image_menu_item_new_with_mnemonic ("Hilfe")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_help), "mte_menuitem_help")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_hilfe_menu), mte.p_menuitem_help)
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_help), "activate", _
                              G_CALLBACK (@mte_on_menuitem_help_activate), p_mte)
  
  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_help), "activate", mte.p_accel_group_1, _
                              GDK_F1, 0, _
                              GTK_ACCEL_VISIBLE)

  mte.p_image_115 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU)
  gtk_widget_set_name (GTK_WIDGET(mte.p_image_115), "mte_image_115")
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mte.p_menuitem_help), mte.p_image_115)

'- Menu Eintrag separator 61
  mte.p_separator_61 = gtk_menu_item_new ()
  gtk_widget_set_name (GTK_WIDGET(mte.p_separator_61), "mte_separator_61")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_hilfe_menu), mte.p_separator_61)
  gtk_widget_set_sensitive (GTK_WIDGET(mte.p_separator_61), FALSE)

'- Menu Eintrag Über
  mte.p_menuitem_about = gtk_image_menu_item_new_with_mnemonic (chr(195)+chr(156)+"ber")
  gtk_widget_set_name (GTK_WIDGET(mte.p_menuitem_about), "mte_menuitem_about")
  gtk_menu_append (GTK_MENU (mte.p_menuitem_hilfe_menu), mte.p_menuitem_about)
  
  g_signal_connect (GTK_OBJECT (mte.p_menuitem_about), "activate", _
                             G_CALLBACK (@mte_on_menuitem_about_1_activate), p_mte)

  gtk_widget_add_accelerator (GTK_WIDGET(mte.p_menuitem_about), "activate", mte.p_accel_group_1, _
                              GDK_F12, 0, _
                              GTK_ACCEL_VISIBLE)

  mte.p_image_116 = gtk_image_new_from_stock ("gtk-dialog-info", GTK_ICON_SIZE_MENU)
  gtk_widget_set_name (GTK_WIDGET(mte.p_image_116), "mte_image_116")
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mte.p_menuitem_about), mte.p_image_116)

'- Image für die Toolbar vom Stock laden
  mte.p_image_203 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_SMALL_TOOLBAR)
  mte.p_image_204 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_SMALL_TOOLBAR)
  mte.p_image_205 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_SMALL_TOOLBAR)
  mte.p_image_206 = gtk_image_new_from_stock ("gtk-save-as", GTK_ICON_SIZE_SMALL_TOOLBAR)
  mte.p_image_207 = gtk_image_new_from_stock ("gtk-print", GTK_ICON_SIZE_SMALL_TOOLBAR)
  mte.p_image_208 = gtk_image_new_from_stock ("gtk-quit", GTK_ICON_SIZE_SMALL_TOOLBAR)
  mte.p_image_209 = gtk_image_new_from_stock ("gtk-cut", GTK_ICON_SIZE_SMALL_TOOLBAR)
  mte.p_image_210 = gtk_image_new_from_stock ("gtk-copy", GTK_ICON_SIZE_SMALL_TOOLBAR)
  mte.p_image_211 = gtk_image_new_from_stock ("gtk-paste", GTK_ICON_SIZE_SMALL_TOOLBAR)
  mte.p_image_212 = gtk_image_new_from_stock ("gtk-delete", GTK_ICON_SIZE_SMALL_TOOLBAR)
  mte.p_image_213 = gtk_image_new_from_stock ("gtk-find", GTK_ICON_SIZE_SMALL_TOOLBAR)
  mte.p_image_214 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_SMALL_TOOLBAR)


'- Toolbar 1
  mte.p_toolbar_1 = gtk_toolbar_new ()
  gtk_widget_set_name (mte.p_toolbar_1, "mte_toolbar_1")
  gtk_box_pack_start (GTK_BOX (mte.p_vbox_1), mte.p_toolbar_1, FALSE, FALSE, 0)
  gtk_container_set_border_width (GTK_CONTAINER (mte.p_toolbar_1), 0)
  gtk_toolbar_set_style (GTK_TOOLBAR (mte.p_toolbar_1), GTK_TOOLBAR_ICONS)
  gtk_toolbar_set_icon_size (GTK_TOOLBAR (mte.p_toolbar_1), GTK_ICON_SIZE_SMALL_TOOLBAR)

  gtk_toolbar_append_item (GTK_TOOLBAR (mte.p_toolbar_1), "", "Ein neues leeres Formular anzeigen", _
                           "", mte.p_image_203, G_CALLBACK (@mte_on_menuitem_new_activate), p_mte)
  
  gtk_toolbar_append_item (GTK_TOOLBAR (mte.p_toolbar_1), "", "Eine vorhandene Datei anzeigen", _
                           "", mte.p_image_204, G_CALLBACK (@mte_on_menuitem_open_activate), p_mte)
  
  gtk_toolbar_append_item (GTK_TOOLBAR (mte.p_toolbar_1), "", "Datei unter aktuellem Namen erneuern", _
                           "", mte.p_image_205, G_CALLBACK (@mte_on_menuitem_save_activate), p_mte)

  gtk_toolbar_append_item (GTK_TOOLBAR (mte.p_toolbar_1), "", "Datei unter neuem Namen speichern", _
                           "", mte.p_image_206, G_CALLBACK (@mte_on_menuitem_saveas_activate), p_mte)

  gtk_toolbar_append_item (GTK_TOOLBAR (mte.p_toolbar_1), "", "Formular drucken", _
                           "", mte.p_image_207, G_CALLBACK (@mte_on_menuitem_print_activate), p_mte)
  
  gtk_toolbar_insert_space (GTK_TOOLBAR (mte.p_toolbar_1), 5)                        

  gtk_toolbar_append_item (GTK_TOOLBAR (mte.p_toolbar_1), "", "Markiertes in die Zwischenablage kopieren und ausschneiden", _
                           "", mte.p_image_209, G_CALLBACK (@mte_on_menuitem_cut_activate), p_mte)

  gtk_toolbar_append_item (GTK_TOOLBAR (mte.p_toolbar_1), "", "Markiertes in die Zwischenablage kopieren", _
                           "", mte.p_image_210, G_CALLBACK (@mte_on_menuitem_copy_activate), p_mte)

  gtk_toolbar_append_item (GTK_TOOLBAR (mte.p_toolbar_1), "", "An Cursor position einf"+Chr(195)+Chr(188)+"gen", _
                           "", mte.p_image_211, G_CALLBACK (@mte_on_menuitem_paste_activate), p_mte)

  gtk_toolbar_append_item (GTK_TOOLBAR (mte.p_toolbar_1), "", "Markiertes l"+Chr(195)+Chr(182)+"schen", _
                           "", mte.p_image_212, G_CALLBACK (@mte_on_menuitem_del_activate), p_mte)
                          
  gtk_toolbar_insert_space (GTK_TOOLBAR (mte.p_toolbar_1), 10)                        
                                                    
  gtk_toolbar_append_item (GTK_TOOLBAR (mte.p_toolbar_1), "", "Im Formular suchen", _
                           "", mte.p_image_213, G_CALLBACK (@mte_on_menuitem_find_activate), p_mte)
                          
  gtk_toolbar_append_item (GTK_TOOLBAR (mte.p_toolbar_1), "", "Im Formular suchen und ersetzen", _
                           "", mte.p_image_214, G_CALLBACK (@mte_on_menuitem_replace_activate), p_mte)
 
'- Toogle Buttons für die Toolbar 2
  mte.p_button_bold = gtk_button_new()
  mte.p_button_italic = gtk_button_new()
  mte.p_button_underline = gtk_button_new()  
  mte.p_button_color = gtk_button_new()
 
'- Toolbar 2
  mte.p_toolbar_2 = gtk_toolbar_new ()
  gtk_widget_set_name (mte.p_toolbar_2, "mte_toolbar_2")
  gtk_box_pack_start (GTK_BOX (mte.p_vbox_1), mte.p_toolbar_2, FALSE, TRUE, 0)

'- Combo Box in die Toolbar 2 einfügen
  mte.p_combo_schriftart = g_object_new (GTK_TYPE_COMBO, NULL)
  gtk_toolbar_append_widget (GTK_TOOLBAR (mte.p_toolbar_2), GTK_WIDGET (mte.p_combo_schriftart), _
                             "Schriftart", "")
  gtk_widget_set_usize (mte.p_combo_schriftart, 200, 10)

  mte.p_combo_schriftgrad = g_object_new (GTK_TYPE_COMBO, NULL)
  gtk_toolbar_append_widget (GTK_TOOLBAR (mte.p_toolbar_2), GTK_WIDGET (mte.p_combo_schriftgrad), _
                             "Schriftgrad", "")
  gtk_widget_set_usize (mte.p_combo_schriftgrad, 50, 10)

  gtk_toolbar_insert_space (GTK_TOOLBAR (mte.p_toolbar_2), 10)  
                        
'- Buttons in die Toolbar 2 einfügen                                                      
  gtk_toolbar_append_widget (GTK_TOOLBAR (mte.p_toolbar_2), GTK_WIDGET (mte.p_button_bold), _
                             "Mit Fett formatieren", "")  

  gtk_toolbar_append_widget (GTK_TOOLBAR (mte.p_toolbar_2), GTK_WIDGET (mte.p_button_italic), _
                             "Mit Italic formatieren", "")  

  gtk_toolbar_append_widget (GTK_TOOLBAR (mte.p_toolbar_2), GTK_WIDGET (mte.p_button_underline), _
                             "Mit Unterstreichen formatieren", "")  

  gtk_toolbar_insert_space (GTK_TOOLBAR (mte.p_toolbar_2), 10)  

  gtk_toolbar_append_widget (GTK_TOOLBAR (mte.p_toolbar_2), GTK_WIDGET (mte.p_button_color), _
                             "Mit Farbe formatieren", "")  

  gtk_toolbar_insert_space (GTK_TOOLBAR (mte.p_toolbar_2), 10)  

'- Das Aussehen der Toolbar einstellen
  gtk_container_set_border_width (GTK_CONTAINER (p_mte->p_toolbar_2), 0)
  gtk_toolbar_set_style (GTK_TOOLBAR (p_mte->p_toolbar_2), GTK_TOOLBAR_ICONS)
  gtk_toolbar_set_icon_size (GTK_TOOLBAR (p_mte->p_toolbar_2), GTK_ICON_SIZE_SMALL_TOOLBAR)

'- Icon für die Toolbar Buttons vom Stock laden
  p_mte->p_image_303 = gtk_image_new_from_stock ("gtk-bold", GTK_ICON_SIZE_SMALL_TOOLBAR)
  p_mte->p_image_304 = gtk_image_new_from_stock ("gtk-italic", GTK_ICON_SIZE_SMALL_TOOLBAR)
  p_mte->p_image_305 = gtk_image_new_from_stock ("gtk-underline", GTK_ICON_SIZE_SMALL_TOOLBAR)
  p_mte->p_image_306 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_SMALL_TOOLBAR)

'- den Buttons ein Icon zuweisen  
  gtk_button_set_image (GTK_BUTTON (p_mte->p_button_bold), p_mte->p_image_303)
  gtk_button_set_image (GTK_BUTTON (p_mte->p_button_italic), p_mte->p_image_304)
  gtk_button_set_image (GTK_BUTTON (p_mte->p_button_underline), p_mte->p_image_305)
  gtk_button_set_image (GTK_BUTTON (p_mte->p_button_color), p_mte->p_image_306)
  
'- Toolbar aktionen, Signale Funktionen zuweisen
  g_signal_connect (G_OBJECT (p_mte->p_button_bold), "clicked", _
                             G_CALLBACK (@mte_on_menuitem_bold_activate), p_mte)
                      
  g_signal_connect (G_OBJECT (p_mte->p_button_italic), "clicked", _
                             G_CALLBACK (@mte_on_menuitem_italic_activate), p_mte)

  g_signal_connect (G_OBJECT (p_mte->p_button_underline), "clicked", _
                             G_CALLBACK (@mte_on_menuitem_underline_activate), p_mte)

  g_signal_connect (G_OBJECT (p_mte->p_button_color), "clicked", _
                             G_CALLBACK (@mte_on_menuitem_color_activate), p_mte)
 
  
'- Ende der Toolbar 2  
'--------------------------------------------------------------------------------------------------------

'- Box für das Textfeld
  mte.p_hbox_1 = gtk_hbox_new (FALSE, 0)
  gtk_widget_set_name (mte.p_hbox_1, "mte_hbox_1")
  gtk_box_pack_start (GTK_BOX (mte.p_vbox_1), mte.p_hbox_1, FALSE, TRUE, 0)

  mte.p_hruler_1 = gtk_hruler_new ()
  gtk_widget_set_name (mte.p_hruler_1, "mte_hruler_1")
  gtk_box_pack_start (GTK_BOX (mte.p_hbox_1), mte.p_hruler_1, TRUE, TRUE, 0)
  gtk_ruler_set_metric (GTK_RULER (mte.p_hruler_1), GTK_CENTIMETERS)
  gtk_ruler_set_range (GTK_RULER (mte.p_hruler_1), 0, 400, 160, 100)
  
'- Box für den Button am Textfeld
  mte.p_fixed_1 = gtk_fixed_new ()
  gtk_widget_set_name (mte.p_fixed_1, "mte_fixed_1")
  gtk_box_pack_end (GTK_BOX (mte.p_hbox_1), mte.p_fixed_1, FALSE, FALSE, 0)
  gtk_widget_set_size_request (mte.p_fixed_1, 19, -1)

  mte.p_button_home = gtk_button_new_with_mnemonic ("H")
  gtk_widget_set_name (mte.p_button_home, "mte_button_home")
  gtk_fixed_put (GTK_FIXED (mte.p_fixed_1), mte.p_button_home, 2, 0)
  gtk_widget_set_size_request (mte.p_button_home, 17, 20)
  
  g_signal_connect (GTK_OBJECT (mte.p_button_home), "clicked", _
                             G_CALLBACK (@mte_on_menuitem_button_home_activate), p_mte)
  

  mte.p_scrolledwindow_1 = gtk_scrolled_window_new (NULL, NULL)
  gtk_widget_set_name (mte.p_scrolledwindow_1, "mte_scrolledwindow_1")
  gtk_box_pack_start (GTK_BOX (mte.p_vbox_1), mte.p_scrolledwindow_1, TRUE, TRUE, 0)
  
  mte.p_button_end = gtk_button_new_with_mnemonic ("E")
  gtk_widget_set_name (mte.p_button_end, "mte_button_end")
'  gtk_container_add (GTK_CONTAINER (mte.p_scrolledwindow_1), mte.p_button_end)
  gtk_widget_set_size_request (mte.p_button_end, 17, 20)
 
 
'- Text Widget  
'- Tagtabelle anlegen
  mte.p_tags_1 = gtk_text_tag_table_new()
'- Puffer anlegen
  mte.p_buffer_1 = gtk_text_buffer_new(mte.p_tags_1)    
'- Text Anzeige anlegen
  mte.p_textview_1 = gtk_text_view_new_with_buffer (mte.p_buffer_1)
  gtk_widget_set_name (mte.p_textview_1, "mte.p_textview_1")
  gtk_container_add (GTK_CONTAINER (mte.p_scrolledwindow_1), mte.p_textview_1)
  
'- Text View mit Einstellungen versorgen
  mte_func_set_text_view ()
  
'- Buffer aktionen, Signale Funktionen zuweisen  
  g_signal_connect(G_OBJECT (p_mte->p_buffer_1), "mark-set", _
                             G_CALLBACK (@mte_on_cursor_position_activate), p_mte)
                            
'- Standart Tags anlegen                            
p_mte->p_bold =  gtk_text_buffer_create_tag(p_mte->p_buffer_1, "bold", "weight", 2000, NULL)
p_mte->p_italic =    gtk_text_buffer_create_tag(p_mte->p_buffer_1, "italic", "style", PANGO_STYLE_ITALIC, NULL)
p_mte->p_underline = gtk_text_buffer_create_tag(p_mte->p_buffer_1, "underline", "underline", PANGO_UNDERLINE_SINGLE, NULL)


'- StatusBar
'- StatusBar Eltern Box
  mte.p_hbox_2 = gtk_hbox_new (FALSE, 0)
  gtk_widget_set_name (mte.p_hbox_2, "mte_hbox_2")
  gtk_box_pack_start (GTK_BOX (mte.p_vbox_1), mte.p_hbox_2, FALSE, FALSE, 0)

'- StatusBar Kind Box für die statischen Felder
  mte.p_fixed_2 = gtk_fixed_new ()
  gtk_widget_set_name (mte.p_fixed_2, "mte_fixed_2")
  gtk_box_pack_start(GTK_BOX (mte.p_hbox_2), mte.p_fixed_2, FALSE, FALSE, 0)

'- StatusBar statischen Felder
  mte.p_entry_1 = gtk_entry_new ()
  gtk_widget_set_name (mte.p_entry_1, "mte_entry_1")
  gtk_fixed_put (GTK_FIXED (mte.p_fixed_2), mte.p_entry_1, 0, 0)
  gtk_widget_set_size_request (mte.p_entry_1, 25, 20)
  gtk_entry_set_max_length (GTK_ENTRY (mte.p_entry_1), 3)
  gtk_editable_set_editable (GTK_EDITABLE (mte.p_entry_1), FALSE)
  gtk_entry_set_text (GTK_ENTRY (mte.p_entry_1), "---")
  gtk_entry_set_editable (GTK_ENTRY (mte.p_entry_1), FALSE)

  mte.p_entry_2 = gtk_entry_new ()
  gtk_widget_set_name (mte.p_entry_2, "mte_entry_2")
  gtk_fixed_put (GTK_FIXED (mte.p_fixed_2), mte.p_entry_2, 25, 0)
  gtk_widget_set_size_request (mte.p_entry_2, 55, 20)
  gtk_entry_set_max_length (GTK_ENTRY (mte.p_entry_2), 7)
  gtk_editable_set_editable (GTK_EDITABLE (mte.p_entry_2), FALSE)
  gtk_entry_set_text (GTK_ENTRY (mte.p_entry_2), "Y-Pos:")
  gtk_entry_set_editable (GTK_ENTRY (mte.p_entry_2), FALSE)

  mte.p_entry_3 = gtk_entry_new ()
  gtk_widget_set_name (mte.p_entry_3, "mte_entry_3")
  gtk_fixed_put (GTK_FIXED (mte.p_fixed_2), mte.p_entry_3, 80, 0)
  gtk_widget_set_size_request (mte.p_entry_3, 55, 20)
  gtk_entry_set_max_length (GTK_ENTRY (mte.p_entry_3), 7)
  gtk_entry_set_text (GTK_ENTRY (mte.p_entry_3), "0")
  gtk_entry_set_editable (GTK_ENTRY (mte.p_entry_3), FALSE)

  mte.p_entry_4 = gtk_entry_new ()
  gtk_widget_set_name (mte.p_entry_4, "mte_entry_4")
  gtk_fixed_put (GTK_FIXED (mte.p_fixed_2), mte.p_entry_4, 135, 0)
  gtk_widget_set_size_request (mte.p_entry_4, 55, 20)
  gtk_entry_set_max_length (GTK_ENTRY (mte.p_entry_4), 7)
  gtk_editable_set_editable (GTK_EDITABLE (mte.p_entry_4), FALSE)
  gtk_entry_set_text (GTK_ENTRY (mte.p_entry_4), "X-Pos:")
  gtk_entry_set_editable (GTK_ENTRY (mte.p_entry_4), FALSE)

  mte.p_entry_5 = gtk_entry_new ()
  gtk_widget_set_name (mte.p_entry_5, "mte_entry_5")
  gtk_fixed_put (GTK_FIXED (mte.p_fixed_2), mte.p_entry_5, 190, 0)
  gtk_widget_set_size_request (mte.p_entry_5, 55, 20)
  gtk_entry_set_max_length (GTK_ENTRY (mte.p_entry_5), 7)
  gtk_entry_set_text (GTK_ENTRY (mte.p_entry_5), "0")
  gtk_entry_set_editable (GTK_ENTRY (mte.p_entry_5), FALSE)

'- StatusBar dynamisches Feld
  mte.p_entry_6 = gtk_entry_new ()
  gtk_widget_set_name (mte.p_entry_6, "mte_entry_6")
  gtk_box_pack_start (GTK_BOX (mte.p_hbox_2), mte.p_entry_6, TRUE, TRUE, 0)
  gtk_widget_set_size_request (mte.p_entry_6, 10, 20)   ' länge nicht größer als 10, also kleiner als sichtbare länge
  gtk_entry_set_text (GTK_ENTRY (mte.p_entry_6), "Hier stehen Meldungen")
  gtk_entry_set_editable (GTK_ENTRY (mte.p_entry_6), FALSE)
  gtk_entry_set_max_length (GTK_ENTRY (mte.p_entry_6), 0)

'- StatusBar Kind Box für das statische Image Feld
  mte.p_fixed_3 = gtk_fixed_new ()
  gtk_widget_set_name (mte.p_fixed_3, "mte_fixed_3")
  gtk_box_pack_end (GTK_BOX (mte.p_hbox_2), mte.p_fixed_3, FALSE, FALSE, 0)
  gtk_widget_set_size_request (mte.p_fixed_3, -1, 20)

'- StatusBar statische Image Feld
  mte.p_image_resize = gtk_image_new()
  gtk_widget_set_name (mte.p_image_resize, "mte_image_resize")
  gtk_fixed_put (GTK_FIXED (mte.p_fixed_3), mte.p_image_resize, 0, 0)
  gtk_widget_set_size_request (mte.p_image_resize, 18, 20)


  gtk_widget_show_all (mte.p_window_1)
  
'- Fenster Icon setzen nach show                              
  gtk_window_set_icon (GTK_WINDOW (p_mte->p_window_1), p_mte_icon_pixbuf)



'----------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------

 

'#Include  Once  "D:/User-Dateien/FreeBasic/User/GTK/Mini-Editor/mte_header_103.bas"
'#Include  Once  "D:/User-Dateien/FreeBasic/User/GTK/Mini-Editor/mte_func_103.bas"
'#Include  Once  "D:/User-Dateien/FreeBasic/User/GTK/Mini-Editor/mte_picture_103.bas"
'#Include  Once  "D:/User-Dateien/FreeBasic/User/GTK/Mini-Editor/mte_dialoge_103.bas"
'#Include  Once  "D:/User-Dateien/FreeBasic/User/GTK/Mini-Editor/mte_find_103.bas"
'#Include  Once  "D:/User-Dateien/FreeBasic/User/GTK/Mini-Editor/mte_replace_103.bas"
'#Include  Once  "D:/User-Dateien/FreeBasic/User/GTK/Mini-Editor/mte_option_103.bas"
'#Include  Once  "D:/User-Dateien/FreeBasic/User/GTK/Mini-Editor/mte_file_103.bas"
'#Include  Once  "D:/User-Dateien/FreeBasic/User/GTK/Mini-Editor/mte_format_103.bas"
'#Include  Once  "D:/User-Dateien/FreeBasic/User/GTK/Mini-Editor/mte_events_103.bas"
'#include  Once  "D:/User-Dateien/FreeBasic/User/GTK/Mini-Editor/mte_face_103.bas"
gtk_main()