summary refs log tree commit diff stats
path: root/ide
diff options
context:
space:
mode:
Diffstat (limited to 'ide')
-rwxr-xr-xide/config.nim93
-rwxr-xr-xide/main.nim234
-rwxr-xr-xide/nimide.glade192
-rwxr-xr-xide/nimide.gladep8
-rwxr-xr-xide/nimide.nim189
5 files changed, 0 insertions, 716 deletions
diff --git a/ide/config.nim b/ide/config.nim
deleted file mode 100755
index 448a67bda..000000000
--- a/ide/config.nim
+++ /dev/null
@@ -1,93 +0,0 @@
-# Does the config parsing for us

-

-import 

-  parsecfg, strtabs, strutils

-  

-type

-  TTokenClass* = enum

-    gtBackground,

-    gtNone,

-    gtWhitespace,

-    gtDecNumber,

-    gtBinNumber,

-    gtHexNumber,

-    gtOctNumber,

-    gtFloatNumber,

-    gtIdentifier,

-    gtKeyword,

-    gtStringLit,

-    gtLongStringLit,

-    gtCharLit,

-    gtEscapeSequence,

-    gtOperator,

-    gtPunctation,

-    gtComment,

-    gtLongComment,

-    gtRegularExpression,

-    gtTagStart,

-    gtTagEnd,

-    gtKey,

-    gtValue,

-    gtRawData,

-    gtAssembler,

-    gtPreprocessor,

-    gtDirective,

-    gtCommand,

-    gtRule,

-    gtHyperlink,

-    gtLabel,

-    gtReference,

-    gtOther,

-    gtCursor

-

-  TColor* = colKeywords, colIdentifiers, colComments

-  TConfiguration* = object of TObject       ## the configuration object

-    colors*: array [TTokenClass] of TColor  ## the colors to use

-    filelist*: seq[string]                  ## the filelist

-  

-const

-  colWhite = 0x00ffffff # rgb

-  colBlack = 0x00000000

-  colYellow = 

-  

-proc readConfig(filename: string): TConfiguration = 

-  # fill with reasonable defaults:

-  result.filelist = []

-  result.colors[gtBackground] = colWhite

-     gtNone: 

-    gtWhitespace,

-    gtDecNumber,

-    gtBinNumber,

-    gtHexNumber,

-    gtOctNumber,

-    gtFloatNumber,

-    gtIdentifier,

-    gtKeyword,

-    gtStringLit,

-    gtLongStringLit,

-    gtCharLit,

-    gtEscapeSequence,

-    gtOperator,

-    gtPunctation,

-    gtComment,

-    gtLongComment,

-    gtRegularExpression,

-    gtTagStart,

-    gtTagEnd,

-    gtKey,

-    gtValue,

-    gtRawData,

-    gtAssembler,

-    gtPreprocessor,

-    gtDirective,

-    gtCommand,

-    gtRule,

-    gtHyperlink,

-    gtLabel,

-    gtReference,

-    gtOther

-    gtCursor

-  var

-    p: TCfgParser

-  if open(p, filename):

-  

diff --git a/ide/main.nim b/ide/main.nim
deleted file mode 100755
index a7e9bb642..000000000
--- a/ide/main.nim
+++ /dev/null
@@ -1,234 +0,0 @@
-# The beginning of an IDE for Nimrod
-#  (c) 2008 Andreas Rumpf
-
-import os, glib2, gtk2, libglade2, dialogs, parseopt
-
-proc on_window_destroy(obj: PGtkObject, data: pointer) {.cdecl.} =
-  gtk_main_quit()
-
-const
-  GuiTemplate = "/media/hda1/Eigenes/nimrod/ide/nimide.glade"
-
-type
-  TTab = object of TObject
-    textview: PGtkTextView
-    filename: string
-    untitled: bool
-
-  TMyTextEditor = object of TObject
-    window: PGtkWindow
-    statusbar: PGtkStatusBar
-    textview: PGtkTextview
-    statusbarContextId: int
-
-
-
-proc on_about_menu_item_activate(menuItem: PGtkMenuItem,
-                                 e: var TMyTextEditor) {.cdecl.} =
-  gtk_show_about_dialog(e.window,
-    "comments", "A fast and leight-weight IDE for Nimrod",
-    "copyright", "Copyright \xc2\xa9 2008 Andreas Rumpf",
-    "version", "0.1",
-    "website", "http://nimrod.ethexor.com",
-    "program-name", "Nimrod IDE",
-    nil)
-
-proc load_file(e: var TMyTextEditor, filename: string) =
-  var
-    err: pointer
-    status: cstring
-    text: cstring
-    result: bool
-    buffer: PGtkTextBuffer
-  discard gtk_statusbar_push(e.statusbar, e.statusbar_context_id, "Loading...")
-  while gtk_events_pending() != 0: discard gtk_main_iteration()
-
-  # get the file contents
-  result = g_file_get_contents(filename, addr(text), nil, addr(err))
-  if not result:
-    error(e.window, "Cannot load file")
-    #g_error_free(err)
-
-  # disable the text view while loading the buffer with the text
-  gtk_widget_set_sensitive(e.text_view, false)
-  buffer = gtk_text_view_get_buffer(e.text_view)
-  gtk_text_buffer_set_text(buffer, text, -1)
-  gtk_text_buffer_set_modified(buffer, false)
-  gtk_widget_set_sensitive(e.text_view, true)
-  g_free(text)
-
-  e.filename = filename
-  gtk_statusbar_pop(e.statusbar, e.statusbar_context_id)
-  reset_default_status(e)
-
-proc write_file(e: var TMyTextEditor, filename: string) =
-  var
-    err: ptr GError
-    status: cstring
-    text: cstring
-    result: bool
-    buffer: PGtkTextBuffer
-    start, ende: TGtkTextIter
-  # add Saving message to status bar and ensure GUI is current
-  gtk_statusbar_push(e.statusbar, e.statusbar_context_id, "Saving....")
-  while gtk_events_pending(): gtk_main_iteration()
-
-  # disable text view and get contents of buffer
-  gtk_widget_set_sensitive(editor->text_view, FALSE)
-  buffer = gtk_text_view_get_buffer(e.text_view)
-  gtk_text_buffer_get_start_iter(buffer, start)
-  gtk_text_buffer_get_end_iter(buffer, ende)
-  text = gtk_text_buffer_get_text(buffer, start, ende, FALSE)
-  gtk_text_buffer_set_modified(buffer, false)
-  gtk_widget_set_sensitive(e.text_view, true)
-  # set the contents of the file to the text from the buffer
-  if filename != "":
-    result = g_file_set_contents(filename, text, -1, addr(err))
-  else:
-    result = g_file_set_contents(editor->filename, text, -1, addr(err))
-  if not result:
-    error_message("cannot save")
-    g_error_free(err)
-  g_free(text)
-  if filename != "":
-    e.filename = filename
-  gtk_statusbar_pop(e.statusbar, e.statusbar_context_id)
-  reset_default_status(editor)
-
-
-proc check_for_save(e: var TMyTextEditor): bool =
-  GtkTextBuffer           *buffer;
-  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (editor->text_view));
-  if gtk_text_buffer_get_modified(buffer):
-    GtkWidget       *dialog;
-    const gchar *msg  = "Do you want to save the changes you have made?";
-    dialog = gtk_message_dialog_new (nil,
-                                     GTK_DIALOG_MODAL or
-                                       GTK_DIALOG_DESTROY_WITH_PARENT,
-                                     GTK_MESSAGE_QUESTION,
-                                     GTK_BUTTONS_YES_NO,
-                                     msg);
-    gtk_window_set_title (GTK_WINDOW (dialog), "Save?");
-    result = gtk_dialog_run(dialog) != GTK_RESPONSE_NO
-    gtk_widget_destroy(dialog)
-
-proc initApp(e: var TMyTextEditor) =
-  var
-    builder: PGladeXML
-    window: PGtkWidget
-    fontDesc: PPangoFontDescription
-    id: int
-  builder = glade_xml_new(GuiTemplate, nil, nil)
-  if builder == nil:
-    error_message("cannot open: " & GuiTemplate)
-    quit(1)
-  # get the components:
-  e.window = GTK_WINDOW(glade_xml_get_widget(builder, "window"))
-  e.statusbar = GTK_STATUSBAR(glade_xml_get_widget(builder, "statusbar"))
-  e.textview = GTK_TEXTVIEW(glade_xml_get_widget(builder, "textview"))
-
-  # connect the signal handlers:
-  glade_xml_signal_connect(builder, "on_window_destroy",
-                           GCallback(on_window_destroy))
-
-  font_desc = pango_font_description_from_string("monospace 10")
-  gtk_widget_modify_font(e.textview, font_desc)
-  pango_font_description_free(font_desc)
-  gtk_window_set_default_icon_name(GTK_STOCK_EDIT)
-
-  id = gtk_statusbar_get_context_id(e.statusbar, "Nimrod IDE")
-  e.statusbarContextId = id
-  reset_default_status(e)
-
-  e.filename = ""
-
-
-proc main() =
-  var
-    editor: TMyTextEditor
-
-  initApp(editor)
-  gtk_widget_show(editor.window)
-  gtk_main()
-
-gtk_nimrod_init()
-main()
-
-proc on_window_delete_event(widget: PGtkWidget, event: PGdkEvent,
-                       e: TMyTextEditor): bool {.cdecl.} =
-  if check_for_save(editor):
-    on_save_menu_item_activate(nil, editor)
-  result = false
-
-proc on_new_menu_item_activate(GtkMenuItem *menuitem, TutorialTextEditor *editor)
-  GtkTextBuffer           *buffer;
-
-  if check_for_save(editor):
-    on_save_menu_item_activate(nil, editor)
-
-  /* clear editor for a new file */
-  editor->filename = nil;
-  buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW (editor->text_view));
-  gtk_text_buffer_set_text(buffer, "", -1);
-  gtk_text_buffer_set_modified(buffer, FALSE);
-
-  reset_default_status(editor);
-
-
-proc on_open_menu_item_activate(menuItem: PGtkMenuItem,
-                                TutorialTextEditor *editor) =
-  gchar                   *filename;
-
-  if check_for_save(editor):
-    on_save_menu_item_activate(nil, editor)
-  filename = get_open_filename(editor)
-  if filename != nil: load_file(editor, filename)
-
-proc on_save_menu_item_activate(menuItem: PGtkMenuItem, TutorialTextEditor *editor) =
-  gchar                   *filename;
-  if (editor->filename == nil)
-  {
-    filename = get_save_filename(editor);
-    if (filename != nil) write_file(editor, filename);
-  }
-  else write_file(editor, nil);
-
-proc on_save_as_menu_item_activate(GtkMenuItem *menuitem,
-                                   TutorialTextEditor *editor) =
-  gchar                   *filename;
-
-  filename = get_save_filename(editor)
-  if filename != nil: write_file(editor, filename)
-
-proc on_quit_menu_item_activate(GtkMenuItem *menuitem, TutorialTextEditor *editor)
-  if check_for_save(editor):
-    on_save_menu_item_activate(nil, editor)
-  gtk_main_quit()
-
-proc on_cut_menu_item_activate(GtkMenuItem *menuitem, TutorialTextEditor *editor) =
-  GtkTextBuffer           *buffer;
-  GtkClipboard            *clipboard;
-
-  clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
-  buffer = gtk_text_view_get_buffer(editor->text_view)
-  gtk_text_buffer_cut_clipboard(buffer, clipboard, TRUE)
-
-proc on_copy_menu_item_activate(GtkMenuItem *menuitem, TutorialTextEditor *editor) =
-  GtkTextBuffer           *buffer;
-  GtkClipboard            *clipboard;
-  clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD)
-  buffer = gtk_text_view_get_buffer(editor->text_view)
-  gtk_text_buffer_copy_clipboard(buffer, clipboard)
-
-
-proc on_paste_menu_item_activate(GtkMenuItem *menuitem, TutorialTextEditor *editor)
-  GtkTextBuffer           *buffer;
-  GtkClipboard            *clipboard;
-  clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD)
-  buffer = gtk_text_view_get_buffer(editor->text_view)
-  gtk_text_buffer_paste_clipboard(buffer, clipboard, nil, TRUE)
-
-proc on_delete_menu_item_activate(GtkMenuItem *menuitem, TutorialTextEditor *editor)
-  GtkTextBuffer           *buffer;
-  buffer = gtk_text_view_get_buffer(editor->text_view);
-  gtk_text_buffer_delete_selection(buffer, FALSE, TRUE);
diff --git a/ide/nimide.glade b/ide/nimide.glade
deleted file mode 100755
index ce24683b2..000000000
--- a/ide/nimide.glade
+++ /dev/null
@@ -1,192 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--*- mode: xml -*-->
-<glade-interface>
-  <widget class="GtkWindow" id="window">
-    <property name="extension_events">GDK_EXTENSION_EVENTS_ALL</property>
-    <signal name="destroy" handler="on_window_destroy" object="destroy"/>
-    <child>
-      <widget class="GtkVBox" id="mainvbox">
-        <property name="width_request">600</property>
-        <property name="height_request">400</property>
-        <property name="visible">True</property>
-        <child>
-          <widget class="GtkMenuBar" id="menubar">
-            <property name="visible">True</property>
-            <child>
-              <widget class="GtkMenuItem" id="menuitem1">
-                <property name="visible">True</property>
-                <property name="label" translatable="yes">_Datei</property>
-                <property name="use_underline">True</property>
-                <child>
-                  <widget class="GtkMenu" id="menu1">
-                    <property name="visible">True</property>
-                    <child>
-                      <widget class="GtkImageMenuItem" id="new_menu_item">
-                        <property name="visible">True</property>
-                        <property name="label">gtk-new</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                      </widget>
-                    </child>
-                    <child>
-                      <widget class="GtkImageMenuItem" id="open_menu_item">
-                        <property name="visible">True</property>
-                        <property name="label">gtk-open</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                      </widget>
-                    </child>
-                    <child>
-                      <widget class="GtkImageMenuItem" id="save_menu_item">
-                        <property name="visible">True</property>
-                        <property name="label">gtk-save</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                      </widget>
-                    </child>
-                    <child>
-                      <widget class="GtkImageMenuItem" id="save_as_menu_item">
-                        <property name="visible">True</property>
-                        <property name="label">gtk-save-as</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                      </widget>
-                    </child>
-                    <child>
-                      <widget class="GtkSeparatorMenuItem" id="separatormenuitem1">
-                        <property name="visible">True</property>
-                      </widget>
-                    </child>
-                    <child>
-                      <widget class="GtkImageMenuItem" id="quit_menu_item">
-                        <property name="visible">True</property>
-                        <property name="label">gtk-quit</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                      </widget>
-                    </child>
-                  </widget>
-                </child>
-              </widget>
-            </child>
-            <child>
-              <widget class="GtkMenuItem" id="menuitem2">
-                <property name="visible">True</property>
-                <property name="label" translatable="yes">_Bearbeiten</property>
-                <property name="use_underline">True</property>
-                <child>
-                  <widget class="GtkMenu" id="menu2">
-                    <property name="visible">True</property>
-                    <child>
-                      <widget class="GtkImageMenuItem" id="cut_menu_item">
-                        <property name="visible">True</property>
-                        <property name="label">gtk-cut</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                      </widget>
-                    </child>
-                    <child>
-                      <widget class="GtkImageMenuItem" id="copy_menu_item">
-                        <property name="visible">True</property>
-                        <property name="label">gtk-copy</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                      </widget>
-                    </child>
-                    <child>
-                      <widget class="GtkImageMenuItem" id="paste_menu_item">
-                        <property name="visible">True</property>
-                        <property name="label">gtk-paste</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                      </widget>
-                    </child>
-                    <child>
-                      <widget class="GtkImageMenuItem" id="delete_menu_item">
-                        <property name="visible">True</property>
-                        <property name="label">gtk-delete</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                      </widget>
-                    </child>
-                  </widget>
-                </child>
-              </widget>
-            </child>
-            <child>
-              <widget class="GtkMenuItem" id="menuitem4">
-                <property name="visible">True</property>
-                <property name="label" translatable="yes">_Hilfe</property>
-                <property name="use_underline">True</property>
-                <child>
-                  <widget class="GtkMenu" id="menu3">
-                    <property name="visible">True</property>
-                    <child>
-                      <widget class="GtkImageMenuItem" id="about_menu_item">
-                        <property name="visible">True</property>
-                        <property name="label">gtk-about</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                      </widget>
-                    </child>
-                  </widget>
-                </child>
-              </widget>
-            </child>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkNotebook" id="notebook">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="tab_hborder">10</property>
-            <property name="tab_vborder">0</property>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-              <packing>
-                <property name="type">tab</property>
-              </packing>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-              <packing>
-                <property name="type">tab</property>
-              </packing>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-              <packing>
-                <property name="type">tab</property>
-              </packing>
-            </child>
-          </widget>
-          <packing>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkStatusbar" id="statusbar">
-            <property name="visible">True</property>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="position">2</property>
-          </packing>
-        </child>
-      </widget>
-    </child>
-  </widget>
-</glade-interface>
diff --git a/ide/nimide.gladep b/ide/nimide.gladep
deleted file mode 100755
index e429f891d..000000000
--- a/ide/nimide.gladep
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->

-<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">

-

-<glade-project>

-  <name></name>

-  <program_name></program_name>

-  <gnome_support>FALSE</gnome_support>

-</glade-project>

diff --git a/ide/nimide.nim b/ide/nimide.nim
deleted file mode 100755
index 741f71afb..000000000
--- a/ide/nimide.nim
+++ /dev/null
@@ -1,189 +0,0 @@
-# The beginning of an IDE for Nimrod
-#  (c) 2008 Andreas Rumpf
-
-import os, glib2, gdk2, gtk2, libglade2, pango, dialogs, parseopt
-
-const
-  GuiTemplate = "nimide.glade"
-  dummyConst = ""
-
-type
-  TTab {.pure, final.} = object
-    textview: PGtkTextView
-    filename: string
-    untitled: bool
-    hbox: PGtkHBox
-    e: PEditor
-  PTab = ptr TTab
-    
-  TEditor = object of TObject
-    window: PGtkWindow
-    statusbar: PGtkStatusBar
-    menu: PGtkMenuBar
-    notebook: PGtkNotebook
-    tabname: int               # used for generating tab names
-    tabs: seq[PTab]
-    currTab: int
-  PEditor = ptr TEditor
-
-proc onWindowDestroy(obj: PGtkObject, event: PGdkEvent, 
-                     data: pointer): gboolean {.cdecl.} =
-  gtkMainQuit()
-
-proc onAboutMenuItemActivate(menuItem: PGtkMenuItem, e: PEditor) {.cdecl.} =
-  gtkShowAboutDialog(e.window,
-    "comments", "A fast and leight-weight IDE for Nimrod",
-    "copyright", "Copyright \xc2\xa9 2009 Andreas Rumpf",
-    "version", "0.1",
-    "website", "http://nimrod.ethexor.com",
-    "program-name", "Nimrod IDE",
-    nil)
-
-proc getTabIndex(e: PEditor, tab: PTab): int = 
-  var i = 0
-  while true:
-    var w = gtkNotebookGetNthPage(e.notebook, i)
-    if w == nil: return -1
-    var v = gtkNotebookGetTabLabel(e.notebook, w)
-    if tab.hbox == v: return i
-    inc(i)
-  
-proc getActiveTab(e: PEditor): PTab = 
-  nil
-  
-type
-  TAnswer = enum
-    answerYes, answerNo, answerCancel
-  
-proc askWhetherToSave(e: PEditor): TAnswer = 
-  var dialog = gtkDialogNewWithButtons("Should the changes be saved?", 
-    e.window, GTK_DIALOG_MODAL, GTK_STOCK_SAVE, 1, "gtk-discard", 2,
-    GTK_STOCK_CANCEL, 3, nil)
-  result = TAnswer(gtkDialogRun(dialog)+1)
-  gtkWidgetDestroy(dialog)
-
-proc saveTab(tab: PTab) = 
-  if tab.untitled: 
-    tab.filename = ChooseFileToSave(tab.e.window, getRoot(tab))
-    tab.untitled = false
-  XXX
-  
-proc OnCloseTab(button: PGtkButton, tab: PTab) {.cdecl.} = 
-  var idx = -1
-  for i in 0..high(tab.e.tabs): 
-    if tab.e.tabs[i] == tab: 
-      idx = i
-      break
-  if idx >= 0: 
-    if gtkTextBufferGetModified(gtkTextViewGetBuffer(tab.textView)):
-      case askWhetherToSave(tab.e)
-      of answerCancel: return
-      of answerYes: saveTab(tab)
-      of answerNo: nil
-    
-    gtkNotebookRemovePage(tab.e.notebook, idx)
-    if idx < high(tab.e.tabs):
-      for i in idx..high(tab.e.tabs)-1:  
-        tab.e.tabs[i] = tab.e.tabs[i+1]
-    else:
-      dec currTab
-    GC_unref(tab.filename)
-    dealloc(tab)
-  #var idx = getTabIndex(tab.e, tab)
-  #if idx >= 0: gtk_notebook_remove_page(tab.e.notebook, idx)
-
-proc createTab(e: PEditor, filename: string, untitled: bool) = 
-  var t = cast[PTab](alloc0(sizeof(TTab)))
-  t.textview = gtkTextViewNewWithBuffer(gtkTextBufferNew(nil))
-  var fontDesc = pangoFontDescriptionFromString("monospace 10")
-  gtkWidgetModifyFont(t.textview, fontDesc)
-  pangoFontDescriptionFree(fontDesc)
-  t.filename = filename
-  t.untitled = untitled
-  gtkWidgetShow(t.textview)
-  var scroll = gtkScrolledWindowNew(nil, nil)
-  gtkContainerAdd(scroll, t.textview)
-  gtkWidgetShow(scroll)
-  
-  t.e = e
-  t.hbox = gtkHboxNew(false, 0)
-  var image = gtkImageNewFromStock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU)
-  var button = gtkButtonNew()
-  var lab = gtkLabelNew(filename)
-  gtkButtonSetImage(button, image)
-  gtkButtonSetRelief(button, GTK_RELIEF_NONE)
-  gtkBoxPackStart(t.hbox, lab, false, false, 2)
-  gtkBoxPackEnd(t.hbox, button, false, false, 0)
-  
-  discard gSignalConnect(button, "clicked", G_Callback(onCloseTab), t)
-  gtkWidgetShow(button)
-  gtkWidgetShow(lab)
- 
-  var idx = gtkNotebookAppendPage(e.notebook, scroll, t.hbox)
-  e.currTab = idx
-  add(e.tabs, t)
-  gtkNotebookSetCurrentPage(e.notebook, idx)
-  
-
-proc onOpenMenuItemActivate(menuItem: PGtkMenuItem, e: PEditor) {.cdecl.} =
-  var files = ChooseFilesToOpen(e.window, getRoot(getActiveTab(e)))
-  for f in items(files): createTab(e, f, untitled=false)
-
-proc onSaveMenuItemActivate(menuItem: PGtkMenuItem, e: PEditor) {.cdecl.} =
-  var cp = gtkNotebookGetCurrentPage(e.notebook)
-  
-  
-proc onSaveAsMenuItemActivate(menuItem: PGtkMenuItem, e: PEditor) {.cdecl.} =
-  nil
-
-proc onNewMenuItemActivate(menuItem: PGtkMenuItem, e: PEditor) {.cdecl.} =
-  inc(e.tabname)
-  createTab(e, "untitled-" & $e.tabname, true)
-
-proc main(e: PEditor) = 
-  var builder = gladeXmlNew(getApplicationDir() / GuiTemplate, nil, nil)
-  if builder == nil: quit("cannot open: " & GuiTemplate)
-  # get the components:
-  e.window = GTK_WINDOW(gladeXmlGetWidget(builder, "window"))
-  e.statusbar = GTK_STATUSBAR(gladeXmlGetWidget(builder, "statusbar"))
-  e.notebook = GTK_NOTEBOOK(gladeXmlGetWidget(builder, "notebook"))
-  e.tabs = @[]
-  e.currTab = -1
-  setHomogeneous(e.notebook^, 1)
-
-  # connect the signal handlers:
-  gladeXmlSignalConnect(builder, "on_window_destroy",
-                        GCallback(onWindowDestroy))
-  var about = GTK_MENU_ITEM(gladeXmlGetWidget(builder, "about_menu_item"))
-  discard gSignalConnect(about, "activate", 
-                         G_CALLBACK(onAboutMenuItemActivate), e)
-
-  var newItem = GTK_MENU_ITEM(gladeXmlGetWidget(builder, "new_menu_item"))
-  discard gSignalConnect(newItem, "activate", 
-                         G_CALLBACK(onNewMenuItemActivate), e)
-
-  var quitItem = GTK_MENU_ITEM(gladeXmlGetWidget(builder, "quit_menu_item"))
-  discard gSignalConnect(quitItem, "activate", 
-                         G_CALLBACK(onWindowDestroy), e)
-
-  var openItem = GTK_MENU_ITEM(gladeXmlGetWidget(builder, "open_menu_item"))
-  discard gSignalConnect(openItem, "activate", 
-                         G_CALLBACK(onOpenMenuItemActivate), e)
-  
-  var saveItem = GTK_MENU_ITEM(gladeXmlGetWidget(builder, "save_menu_item")) 
-  discard gSignalConnect(saveItem, "activate", 
-                         G_CALLBACK(onSaveMenuItemActivate), e)
-  
-  var saveAsItem = GTK_MENU_ITEM(gladeXmlGetWidget(builder, "save_as_menu_item")) 
-  discard gSignalConnect(saveAsItem, "activate", 
-                         G_CALLBACK(onSaveAsMenuItemActivate), e)
-
-  gtkWindowSetDefaultIconName(GTK_STOCK_EDIT)
-  gtkWidgetShow(e.window)
-  gtkMain()
-
-
-gtkNimrodInit()
-var e = cast[PEditor](alloc0(sizeof(TEditor)))
-main(e)
-