[dasher] g/c actions



commit bdf6ff7d9bfab9a22ef5d99b09580f58a337621d
Author: Patrick Welche <prlw1 cam ac uk>
Date:   Fri Aug 12 16:47:04 2011 +0100

    g/c actions
    
    Remove the action code (+ extra commented out code) #ifdef'd out
    in 4c37ab02. It looks as though the code was the basis for a dasher
    scripting language. Sadly it also seems as though the complete
    source only existed on a past developer's computer and was never
    committed to the repository in its entirety.

 Src/Gtk2/DasherAppSettings.cpp            |   44 ---
 Src/Gtk2/DasherAppSettings.h              |    4 -
 Src/Gtk2/Makefile.am                      |   15 -
 Src/Gtk2/dasher_action.cpp                |  127 -------
 Src/Gtk2/dasher_action.h                  |   52 ---
 Src/Gtk2/dasher_action_keyboard.cpp       |   57 ---
 Src/Gtk2/dasher_action_keyboard.h         |   31 --
 Src/Gtk2/dasher_action_keyboard_maemo.cpp |   96 -----
 Src/Gtk2/dasher_action_keyboard_maemo.h   |   31 --
 Src/Gtk2/dasher_action_script.cpp         |   93 -----
 Src/Gtk2/dasher_action_script.h           |   31 --
 Src/Gtk2/dasher_editor.cpp                |  112 ------
 Src/Gtk2/dasher_editor.h                  |   25 --
 Src/Gtk2/dasher_editor_internal.cpp       |  543 -----------------------------
 Src/Gtk2/dasher_editor_internal.h         |    3 -
 Src/Gtk2/dasher_maemo_helper.cpp          |  142 --------
 Src/Gtk2/dasher_maemo_helper.h            |   39 --
 17 files changed, 0 insertions(+), 1445 deletions(-)
---
diff --git a/Src/Gtk2/DasherAppSettings.cpp b/Src/Gtk2/DasherAppSettings.cpp
index 077d01a..e63ceb6 100644
--- a/Src/Gtk2/DasherAppSettings.cpp
+++ b/Src/Gtk2/DasherAppSettings.cpp
@@ -379,50 +379,6 @@ void dasher_app_settings_set_long(DasherAppSettings *pSelf, int iParameter, gint
   }
 }
 
-#ifdef XXXPRLWACTIONSAREFIXED
-gboolean dasher_app_settings_get_free_long(DasherAppSettings *pSelf, const gchar *szName, gint &iValue) {
-  DasherAppSettingsPrivate *pPrivate = (DasherAppSettingsPrivate *)(pSelf->private_data);
-#ifdef WITH_GCONF
-  gchar szFullName[256];
-      
-  strncpy(szFullName, "/apps/dasher4/", 256);
-  strncat(szFullName, szName, 255 - strlen(szFullName));
-
-  GConfValue *pGConfValue;
-  GError *pGConfError = NULL;
-
-  pGConfValue = gconf_client_get_without_default(pPrivate->pGConfClient, szFullName, &pGConfError);
-      
-  if(pGConfValue) {
-    iValue = gconf_value_get_int(pGConfValue);
-    gconf_value_free(pGConfValue);
-    return true;
-  }
-  else {
-    return false;
-  }
-#else
-  return false;
-#endif
-}
-#endif
-
-#ifdef XXXPRLWACTIONSAREFIXED
-void dasher_app_settings_set_free_long(DasherAppSettings *pSelf, const gchar *szName, gint iValue) {   
-#ifdef WITH_GCONF
-  DasherAppSettingsPrivate *pPrivate = (DasherAppSettingsPrivate *)(pSelf->private_data);
-
-  gchar szFullName[256];
-      
-  strncpy(szFullName, "/apps/dasher4/", 256);
-  strncat(szFullName, szName, 255 - strlen(szFullName));
-
-  GError *pGConfError = NULL;
-  gconf_client_set_int(pPrivate->pGConfClient, szFullName, iValue, &pGConfError);
-#endif
-}
-#endif
-
 const gchar *dasher_app_settings_get_string(DasherAppSettings *pSelf, int iParameter) {
   DasherAppSettingsPrivate *pPrivate = (DasherAppSettingsPrivate *)(pSelf->private_data);
  
diff --git a/Src/Gtk2/DasherAppSettings.h b/Src/Gtk2/DasherAppSettings.h
index 7a8149f..bcee864 100644
--- a/Src/Gtk2/DasherAppSettings.h
+++ b/Src/Gtk2/DasherAppSettings.h
@@ -60,10 +60,6 @@ bool dasher_app_settings_get_bool(DasherAppSettings *pSelf, int iParameter);
 void dasher_app_settings_set_bool(DasherAppSettings *pSelf, int iParameter, bool bValue);
 gint dasher_app_settings_get_long(DasherAppSettings *pSelf, int iParameter);
 void dasher_app_settings_set_long(DasherAppSettings *pSelf, int iParameter, gint iValue);
-#ifdef XXXPRLWACTIONSAREFIXED
-gboolean dasher_app_settings_get_free_long(DasherAppSettings *pSelf, const gchar *szName, gint &iValue);
-void dasher_app_settings_set_free_long(DasherAppSettings *pSelf, const gchar *szName, gint iValue);
-#endif
 const gchar *dasher_app_settings_get_string(DasherAppSettings *pSelf, int iParameter);
 void dasher_app_settings_set_string(DasherAppSettings *pSelf, int iParameter, const gchar *szValue);
 
diff --git a/Src/Gtk2/Makefile.am b/Src/Gtk2/Makefile.am
index f77ead6..f80c0b1 100644
--- a/Src/Gtk2/Makefile.am
+++ b/Src/Gtk2/Makefile.am
@@ -86,19 +86,4 @@ libdashergtk_la_SOURCES = \
 		module_settings_window.cpp \
 		module_settings_window.h
 
-# ifdef XXXPRLWACTIONSAREFIXED
-#		dasher_action.cpp \
-#		dasher_action.h \
-#		dasher_action_keyboard.cpp \
-#		dasher_action_keyboard.h \
-#		dasher_action_script.cpp \
-#		dasher_action_script.h \
-# if WITH_MAEMO
-# libdashergtk_la_SOURCES += \
-#		dasher_action_keyboard_maemo.cpp \
-#		dasher_action_keyboard_maemo.h \
-#		dasher_maemo_helper.cpp \
-#		dasher_maemo_helper.h
-# endif
-
 AM_CXXFLAGS = -I$(srcdir)/../DasherCore -DPROGDATA=\"$(pkgdatadir)\" $(GTKBUILD_CFLAGS) 
diff --git a/Src/Gtk2/dasher_editor.cpp b/Src/Gtk2/dasher_editor.cpp
index c3201fe..2c40b1c 100644
--- a/Src/Gtk2/dasher_editor.cpp
+++ b/Src/Gtk2/dasher_editor.cpp
@@ -25,57 +25,19 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#ifdef XXXPRLWACTIONSAREFIXED
-#ifdef WITH_MAEMO
-#include "dasher_action_keyboard_maemo.h"
-#else
-#include "dasher_action_keyboard.h"
-#include "dasher_action_script.h"
-#endif
-#endif
-
 #include "dasher_editor.h"
 #include "dasher_lock_dialogue.h"
 #include "dasher_main.h"
 //#include "game_mode_helper.h"
 
-#ifdef XXXPRLWACTIONSAREFIXED
-#define ACTION_STATE_SHOW 1
-#define ACTION_STATE_CONTROL 2
-#define ACTION_STATE_AUTO 4
-
-typedef struct _EditorAction EditorAction;
-
-struct _EditorAction {
-  DasherAction *pAction;
-  EditorAction *pNext;
-  EditorAction *pPrevious;
-  gint iControlID;
-  gint iID; // TODO: does this need to be separate from iControlID?
-  gboolean bShow;
-  gboolean bControl;
-  gboolean bAuto;
-  gint iNSub;
-};
-#endif
-
 typedef struct _DasherEditorPrivate DasherEditorPrivate;
 
 struct _DasherEditorPrivate {
   DasherMain *pDasherMain;
   GtkTextView *pTextView;
   GtkTextBuffer *pBuffer;
-#ifdef XXXPRLWACTIONSAREFIXED
-  GtkVBox *pActionPane;
-#endif
   GtkClipboard *pTextClipboard;
   GtkClipboard *pPrimarySelection;
-#ifdef XXXPRLWACTIONSAREFIXED
-  EditorAction *pActionRing;
-  EditorAction *pActionIter;
-  gboolean bActionIterStarted;
-  gint iNextActionID;
-#endif
   //  GameModeHelper *pGameModeHelper;
   GtkTextMark *pNewMark;
   DasherAppSettings *pAppSettings;
@@ -132,15 +94,6 @@ dasher_editor_class_init(DasherEditorClass *pClass) {
 
   pClass->initialise = NULL;
   pClass->command = NULL;
-#ifdef XXXPRLWACTIONSAREFIXED
-  pClass->action_button = NULL;
-  pClass->actions_start = NULL;
-  pClass->actions_more = NULL;
-  pClass->actions_get_next = NULL;
-  pClass->action_set_show = NULL;
-  pClass->action_set_control = NULL;
-  pClass->action_set_auto = NULL;
-#endif
   pClass->clear = NULL;
   pClass->get_all_text = NULL;
   pClass->get_new_text = NULL;
@@ -173,10 +126,6 @@ dasher_editor_init(DasherEditor *pDasherControl) {
   pPrivate->szFilename = NULL;
   pPrivate->pTextClipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
   pPrivate->pPrimarySelection = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
-#ifdef XXXPRLWACTIONSAREFIXED
-  pPrivate->pActionRing = NULL;
-  pPrivate->iNextActionID = 0;
-#endif
   //  pPrivate->pGameModeHelper = NULL;
   pPrivate->bFileModified = FALSE;
 }
@@ -187,21 +136,6 @@ dasher_editor_finalize(GObject *pObject) {
 
   DasherEditorPrivate *pPrivate = DASHER_EDITOR_GET_PRIVATE(pObject);
 
-#ifdef XXXPRLWACTIONSAREFIXED
-  EditorAction *pCurrentAction = pPrivate->pActionRing;
-
-  if(pCurrentAction) {
-    bool bStarted = false;
-   
-    while(!bStarted || (pCurrentAction != pPrivate->pActionRing)) {
-      bStarted = true;
-      dasher_action_deactivate(pCurrentAction->pAction);
-      g_object_unref(G_OBJECT(pCurrentAction->pAction));
-      pCurrentAction = pCurrentAction->pNext;
-    }
-  }
-#endif
-
   if(pPrivate->szFilename)
     g_free(pPrivate->szFilename);
 }
@@ -230,52 +164,6 @@ dasher_editor_handle_start(DasherEditor *pSelf) {
     DASHER_EDITOR_GET_CLASS(pSelf)->handle_start(pSelf);
 }
 
-#ifdef XXXPRLWACTIONSAREFIXED
-void
-dasher_editor_action_button(DasherEditor *pSelf, DasherAction *pAction) {
-  if(DASHER_EDITOR_GET_CLASS(pSelf)->action_button)
-    DASHER_EDITOR_GET_CLASS(pSelf)->action_button(pSelf, pAction);
-}
-
-void
-dasher_editor_actions_start(DasherEditor *pSelf) {
-  if(DASHER_EDITOR_GET_CLASS(pSelf)->actions_start)
-    DASHER_EDITOR_GET_CLASS(pSelf)->actions_start(pSelf);
-}
-
-bool
-dasher_editor_actions_more(DasherEditor *pSelf) {
-  if(DASHER_EDITOR_GET_CLASS(pSelf)->actions_more)
-    return DASHER_EDITOR_GET_CLASS(pSelf)->actions_more(pSelf);
-  else
-    return false;
-}
-
-void
-dasher_editor_actions_get_next(DasherEditor *pSelf, const gchar **szName, gint *iID, gboolean *bShow, gboolean *bControl, gboolean *bAuto) {
-  if(DASHER_EDITOR_GET_CLASS(pSelf)->actions_get_next)
-    DASHER_EDITOR_GET_CLASS(pSelf)->actions_get_next(pSelf, szName, iID, bShow, bControl, bAuto);
-}
-
-void
-dasher_editor_action_set_show(DasherEditor *pSelf, int iActionID, bool bValue) {
-  if(DASHER_EDITOR_GET_CLASS(pSelf)->action_set_show)
-    DASHER_EDITOR_GET_CLASS(pSelf)->action_set_show(pSelf, iActionID, bValue);
-}
-
-void
-dasher_editor_action_set_control(DasherEditor *pSelf, int iActionID, bool bValue) {
-  if(DASHER_EDITOR_GET_CLASS(pSelf)->action_set_control)
-    DASHER_EDITOR_GET_CLASS(pSelf)->action_set_control(pSelf, iActionID, bValue);
-}
-
-void
-dasher_editor_action_set_auto(DasherEditor *pSelf, int iActionID, bool bValue) {
-  if(DASHER_EDITOR_GET_CLASS(pSelf)->action_set_auto)
-    DASHER_EDITOR_GET_CLASS(pSelf)->action_set_auto(pSelf, iActionID, bValue);
-}
-#endif
-
 void
 dasher_editor_grab_focus(DasherEditor *pSelf) {
   if(DASHER_EDITOR_GET_CLASS(pSelf)->grab_focus)
diff --git a/Src/Gtk2/dasher_editor.h b/Src/Gtk2/dasher_editor.h
index 98c5481..65d42cc 100644
--- a/Src/Gtk2/dasher_editor.h
+++ b/Src/Gtk2/dasher_editor.h
@@ -5,9 +5,6 @@
 #include <glib-object.h>
 #include <gtk/gtk.h>
 
-#ifdef XXXPRLWACTIONSAREFIXED
-#include "dasher_action.h"
-#endif
 #include "../DasherCore/ControlManager.h"
 
 /* Forward declaration */
@@ -37,15 +34,6 @@ struct _DasherEditorClass {
   /* VTable */
   void (*initialise)(DasherEditor *, DasherAppSettings *, DasherMain *, GtkBuilder *, const gchar *);
   gboolean (*command)(DasherEditor *, const gchar *);
-#ifdef XXXPRLWACTIONSAREFIXED
-  void (*action_button)(DasherEditor *, DasherAction *);
-  void (*actions_start)(DasherEditor *);
-  bool (*actions_more)(DasherEditor *);
-  void (*actions_get_next)(DasherEditor *, const gchar **, gint *, gboolean *, gboolean *, gboolean *);
-  void (*action_set_show)(DasherEditor *, int, bool);
-  void (*action_set_control)(DasherEditor *, int, bool);
-  void (*action_set_auto)(DasherEditor *, int, bool);
-#endif
   void (*clear)(DasherEditor *);
   const gchar *(*get_all_text)(DasherEditor *);
   const gchar *(*get_new_text)(DasherEditor *);
@@ -92,19 +80,6 @@ void dasher_editor_initialise(DasherEditor *pSelf,
 /* Abstract command handler */
 gboolean dasher_editor_command(DasherEditor *pSelf, const gchar *szCommand);
 
-/* Action related methods */
-#ifdef XXXPRLWACTIONSAREFIXED
-void dasher_editor_action_button(DasherEditor *pSelf, DasherAction *pAction);
-void dasher_editor_actions_start(DasherEditor *pSelf);
-bool dasher_editor_actions_more(DasherEditor *pSelf);
-void dasher_editor_actions_get_next(DasherEditor *pSelf, const gchar **szName,
-				    gint *iID, gboolean *bShow, gboolean *bControl,
-				    gboolean *bAuto);
-void dasher_editor_action_set_show(DasherEditor *pSelf, int iActionID, bool bValue);
-void dasher_editor_action_set_control(DasherEditor *pSelf, int iActionID, bool bValue);
-void dasher_editor_action_set_auto(DasherEditor *pSelf, int iActionID, bool bValue);
-#endif
-
 GtkTextBuffer *dasher_editor_game_text_buffer(DasherEditor *);
 
 void dasher_editor_clear(DasherEditor *pSelf);
diff --git a/Src/Gtk2/dasher_editor_internal.cpp b/Src/Gtk2/dasher_editor_internal.cpp
index 39e34c6..5b88232 100644
--- a/Src/Gtk2/dasher_editor_internal.cpp
+++ b/Src/Gtk2/dasher_editor_internal.cpp
@@ -9,85 +9,21 @@
 #endif
 #include <gtk/gtk.h>
 
-#if XXXPRLWACTIONSAREFIXED
-#ifdef WITH_MAEMO
-#include "dasher_action_keyboard_maemo.h"
-#else
-#include "dasher_action_keyboard.h"
-#endif
-
-#ifndef WITH_MAEMO
-#include "dasher_action_script.h"
-#endif
-#endif
-
 #include "dasher_editor_internal.h"
 #include "dasher_lock_dialogue.h"
 #include "dasher_main.h"
 #include "../DasherCore/ControlManager.h"
 
-// TODO: Maybe reimplement something along the lines of the following, which used to be in edit.cc
-
-// void set_mark() {
-//   GtkTextIter oBufferEnd;
-//   GtkTextIter oBufferStart;
-//   gtk_text_buffer_get_bounds( the_text_buffer, &oBufferStart, &oBufferEnd);
-//   gtk_text_buffer_create_mark(the_text_buffer, "new_start", &oBufferEnd, true);
-// }
-
-// const gchar *get_new_text() {
-//   GtkTextIter oNewStart;
-//   GtkTextIter oNewEnd;
-//   GtkTextIter oDummy;
-
-//   gtk_text_buffer_get_bounds( the_text_buffer, &oDummy, &oNewEnd);
-//   gtk_text_buffer_get_iter_at_mark( the_text_buffer, &oNewStart, gtk_text_buffer_get_mark(the_text_buffer, "new_start"));
-
-//   return gtk_text_buffer_get_text( the_text_buffer, &oNewStart, &oNewEnd, false );
-
-// }
-
-// ---
-
-#ifdef XXXPRLWACTIONSAREFIXED
-#define ACTION_STATE_SHOW 1
-#define ACTION_STATE_CONTROL 2
-#define ACTION_STATE_AUTO 4
-
-typedef struct _EditorAction EditorAction;
-
-struct _EditorAction {
-  DasherAction *pAction;
-  EditorAction *pNext;
-  EditorAction *pPrevious;
-  gint iControlID;
-  gint iID; // TODO: does this need to be separate from iControlID?
-  gboolean bShow;
-  gboolean bControl;
-  gboolean bAuto;
-  gint iNSub;
-};
-#endif /* XXXPRLWACTIONSAREFIXED */
-
 typedef struct _DasherEditorInternalPrivate DasherEditorInternalPrivate;
 
 struct _DasherEditorInternalPrivate {
   DasherMain *pDasherMain;
   GtkTextView *pTextView;
   GtkTextBuffer *pBuffer;
-#ifdef XXXPRLWACTIONSAREFIXED
-  GtkVBox *pActionPane;
-#endif
   GtkClipboard *pTextClipboard;
   GtkClipboard *pPrimarySelection;
   GtkTable *pGameGroup;
   GtkLabel *pGameInfoLabel;
-#ifdef XXXPRLWACTIONSAREFIXED
-  EditorAction *pActionRing;
-  EditorAction *pActionIter;
-  gboolean bActionIterStarted;
-  gint iNextActionID;
-#endif
   //  GameModeHelper *pGameModeHelper;
   GtkTextMark *pNewMark;
   DasherAppSettings *pAppSettings;
@@ -122,14 +58,6 @@ void dasher_editor_internal_initialise(DasherEditor *pSelf, DasherAppSettings *p
 
 /* Private methods */
 static void dasher_editor_internal_select_all(DasherEditor *pSelf);
-#if XXXPRLWACTIONSAREFIXED
-static void dasher_editor_internal_setup_actions(DasherEditor *pSelf);
-static void dasher_editor_internal_add_action(DasherEditor *pSelf, DasherAction *pNewAction);
-static EditorAction *dasher_editor_internal_get_action_by_id(DasherEditor *pSelf, int iID);
-static void dasher_editor_internal_rebuild_action_pane(DasherEditor *pSelf);
-static void dasher_editor_internal_action_save_state(DasherEditor *pSelf, EditorAction *pAction);
-static void dasher_editor_internal_check_activity(DasherEditor *pSelf, EditorAction *pAction);
-#endif
 
 static void dasher_editor_internal_command_new(DasherEditor *pSelf);
 static void dasher_editor_internal_command_open(DasherEditor *pSelf);
@@ -172,17 +100,6 @@ void dasher_editor_internal_mark_changed(DasherEditorInternal *pSelf, GtkTextIte
 void dasher_editor_internal_handle_stop(DasherEditor *pSelf);
 void dasher_editor_internal_handle_start(DasherEditor *pSelf);
 
-/* Action related methods - TODO: a lot of this should be moved to dasher_main (eg action on stop etc) - that way we get a better level of abstraction, and can incorporate commands from other modules too. Actions should only be externally visible as a list of string commands*/
-#ifdef XXXPRLWACTIONSAREFIXED
-void dasher_editor_internal_action_button(DasherEditor *pSelf, DasherAction *pAction);
-void dasher_editor_internal_actions_start(DasherEditor *pSelf);
-bool dasher_editor_internal_actions_more(DasherEditor *pSelf);
-void dasher_editor_internal_actions_get_next(DasherEditor *pSelf, const gchar **szName, gint *iID, gboolean *bShow, gboolean *bControl, gboolean *bAuto);
-void dasher_editor_internal_action_set_show(DasherEditor *pSelf, int iActionID, bool bValue);
-void dasher_editor_internal_action_set_control(DasherEditor *pSelf, int iActionID, bool bValue);
-void dasher_editor_internal_action_set_auto(DasherEditor *pSelf, int iActionID, bool bValue);
-#endif
-
 void dasher_editor_internal_grab_focus(DasherEditor *pSelf);
 
 /* TODO: Tutorial editor should be a separate class */
@@ -232,15 +149,6 @@ dasher_editor_internal_class_init(DasherEditorInternalClass *pClass) {
 
   pParentClass->handle_stop = dasher_editor_internal_handle_stop;
   pParentClass->handle_start = dasher_editor_internal_handle_start;
-#ifdef XXXPRLWACTIONSAREFIXED
-  pParentClass->action_button = dasher_editor_internal_action_button;
-  pParentClass->actions_start = dasher_editor_internal_actions_start;
-  pParentClass->actions_more = dasher_editor_internal_actions_more;
-  pParentClass->actions_get_next = dasher_editor_internal_actions_get_next;
-  pParentClass->action_set_show = dasher_editor_internal_action_set_show;
-  pParentClass->action_set_control = dasher_editor_internal_action_set_control;
-  pParentClass->action_set_auto = dasher_editor_internal_action_set_auto;
-#endif
   pParentClass->grab_focus = dasher_editor_internal_grab_focus;
   pParentClass->file_changed = dasher_editor_internal_file_changed;
   pParentClass->get_filename = dasher_editor_internal_get_filename;
@@ -261,10 +169,6 @@ dasher_editor_internal_init(DasherEditorInternal *pSelf) {
   pPrivate->szFilename = NULL;
   pPrivate->pTextClipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
   pPrivate->pPrimarySelection = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
-#ifdef XXXPRLWACTIONSAREFIXED
-  pPrivate->pActionRing = NULL;
-  pPrivate->iNextActionID = 0;
-#endif
   //  pPrivate->pGameModeHelper = NULL;
   GtkTextIter oStartIter;
   gtk_text_buffer_get_start_iter(pPrivate->pBuffer, &oStartIter);
@@ -295,21 +199,6 @@ static void
 dasher_editor_internal_finalize(GObject *pObject) {
   DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pObject);
 
-#ifdef XXXPRLWACTIONSAREFIXED
-  EditorAction *pCurrentAction = pPrivate->pActionRing;
-
-  if(pCurrentAction) {
-    bool bStarted = false;
-
-    while(!bStarted || (pCurrentAction != pPrivate->pActionRing)) {
-      bStarted = true;
-      dasher_action_deactivate(pCurrentAction->pAction);
-      g_object_unref(G_OBJECT(pCurrentAction->pAction));
-      pCurrentAction = pCurrentAction->pNext;
-    }
-  }
-#endif
-
   if(pPrivate->szFilename)
     g_free(pPrivate->szFilename);
 }
@@ -333,20 +222,9 @@ dasher_editor_internal_initialise(DasherEditor *pSelf, DasherAppSettings *pAppSe
 				     dasher_app_settings_get_string(pPrivate->pAppSettings,
 								    APP_SP_EDIT_FONT));
 
-#ifdef XXXPRLWACTIONSAREFIXED
-  GtkVBox *pActionPane = GTK_VBOX(gtk_builder_get_object(pXML, "vbox39"));
-
-
-  pPrivate->pActionPane = pActionPane;
-#endif
-
   // TODO: is this still needed?
   dasher_editor_internal_create_buffer(pSelf);
 
-#ifdef XXXPRLWACTIONSAREFIXED
-  dasher_editor_internal_setup_actions(pSelf);
-#endif
-
   // TODO: see note in command_new method
   if(szFullPath)
     dasher_editor_internal_open(pSelf, szFullPath);
@@ -400,23 +278,6 @@ dasher_editor_internal_clipboard(DasherEditor *pSelf, clipboard_action act) {
 
 void
 dasher_editor_internal_handle_stop(DasherEditor *pSelf) {
-#ifdef XXXPRLWACTIONSAREFIXED
-  DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
-
-  // See if anything is set to auto:
-  EditorAction *pCurrentAction = pPrivate->pActionRing;
-
-  if(pCurrentAction) {
-    bool bStarted = false;
-
-    while(!bStarted || (pCurrentAction != pPrivate->pActionRing)) {
-      bStarted = true;
-      if(pCurrentAction->bAuto)
-	dasher_action_execute(pCurrentAction->pAction, DASHER_EDITOR(pSelf), -1);
-      pCurrentAction = pCurrentAction->pNext;
-    }
-  }
-#endif
 }
 
 void
@@ -427,15 +288,6 @@ dasher_editor_internal_handle_start(DasherEditor *pSelf) {
   //  set_mark();
 }
 
-#ifdef XXXPRLWACTIONSAREFIXED
-void
-dasher_editor_internal_action_button(DasherEditor *pSelf, DasherAction *pAction) {
-  if(pAction) {
-    dasher_action_execute(pAction, DASHER_EDITOR(pSelf), -1);
-  } //else, Clear button (?!)
-  dasher_editor_internal_clear(pSelf);
-}
-#endif
 
 static void
 dasher_editor_internal_clear(DasherEditor *pSelf) {
@@ -459,86 +311,6 @@ dasher_editor_internal_clear(DasherEditor *pSelf) {
   pPrivate->iLastOffset = 0;
 }
 
-
-#ifdef XXXPRLWACTIONSAREFIXED
-void
-dasher_editor_internal_actions_start(DasherEditor *pSelf) {
-  DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
-
-  pPrivate->bActionIterStarted = false;
-  pPrivate->pActionIter = pPrivate->pActionRing;
-}
-
-bool
-dasher_editor_internal_actions_more(DasherEditor *pSelf) {
-  DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
-
- return(!pPrivate->bActionIterStarted || (pPrivate->pActionIter != pPrivate->pActionRing));
-}
-
-void
-dasher_editor_internal_actions_get_next(DasherEditor *pSelf, const gchar **szName, gint *iID, gboolean *bShow, gboolean *bControl, gboolean *bAuto) {
-  DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
-
-  *szName = dasher_action_get_name(pPrivate->pActionIter->pAction);
-  *iID = pPrivate->pActionIter->iID;
-  *bShow = pPrivate->pActionIter->bShow;
-  *bControl = pPrivate->pActionIter->bControl;
-  *bAuto = pPrivate->pActionIter->bAuto;
-
-  pPrivate->pActionIter = pPrivate->pActionIter->pNext;
-  pPrivate->bActionIterStarted = true;
-}
-
-void
-dasher_editor_internal_action_set_show(DasherEditor *pSelf, int iActionID, bool bValue) {
-  EditorAction *pAction;
-  pAction = dasher_editor_internal_get_action_by_id(pSelf, iActionID);
-
-  if(pAction) {
-    pAction->bShow = bValue;
-    dasher_editor_internal_check_activity(pSelf, pAction);
-    dasher_editor_internal_rebuild_action_pane(pSelf);
-
-    dasher_editor_internal_action_save_state(pSelf, pAction);
-  }
-}
-
-void
-dasher_editor_internal_action_set_control(DasherEditor *pSelf, int iActionID, bool bValue) {
-  // TODO: Need to actually change behaviour in resonse to these calls
-
-  // TODO: Reimplement
-
-//   EditorAction *pAction;
-//   pAction = dasher_editor_internal_get_action_by_id(pSelf, iActionID);
-
-//   if(pAction) {
-//     pAction->bControl = bValue;
-//     dasher_editor_internal_check_activity(pSelf, pAction);
-//     if(bValue)
-//       gtk_dasher_control_connect_node(GTK_DASHER_CONTROL(pDasherWidget), pAction->iControlID, Dasher::CControlManager::CTL_USER, -2);
-//     else
-//       gtk_dasher_control_disconnect_node(GTK_DASHER_CONTROL(pDasherWidget), pAction->iControlID, Dasher::CControlManager::CTL_USER);
-
-//     dasher_editor_internal_action_save_state(pSelf, pAction);
-//   }
-}
-
-void
-dasher_editor_internal_action_set_auto(DasherEditor *pSelf, int iActionID, bool bValue) {
-EditorAction *pAction;
-  pAction = dasher_editor_internal_get_action_by_id(pSelf, iActionID);
-
-  if(pAction) {
-    pAction->bAuto = bValue;
-    dasher_editor_internal_check_activity(pSelf, pAction);
-
-    dasher_editor_internal_action_save_state(pSelf, pAction);
-  }
-}
-#endif
-
 void
 dasher_editor_internal_grab_focus(DasherEditor *pSelf) {
   DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
@@ -575,31 +347,6 @@ void
 dasher_editor_internal_output(DasherEditor *pSelf, const gchar *szText, int iOffset) {
   DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
 
-  // TODO: tidy this up, actionlookup by name, more flexible
-  // definition of space
-  // Python scripting?
-#ifdef XXXPRLWACTIONSAREFIXED
-  if(!strcmp(szText, " ")) {
-    gboolean bActionIterStarted = false;
-    EditorAction *pActionIter = pPrivate->pActionRing;
-
-    while((pActionIter != pPrivate->pActionRing) || !bActionIterStarted) {
-      bActionIterStarted = true;
-
-      if(!strcmp(dasher_action_get_name(pActionIter->pAction), "Speak")) {
-        dasher_action_preview(pActionIter->pAction, DASHER_EDITOR(pSelf));
-      }
-
-      pActionIter = pActionIter->pNext;
-    }
-  }
-#endif
-
-  //  std::cout << "i: " << szText << " (" << iOffset << " " << gtk_text_buffer_get_char_count(pPrivate->pBuffer) << ")" << std::endl;
-
-  // This seems overzealous.
-  // DASHER_ASSERT(gtk_text_buffer_get_char_count(pPrivate->pBuffer) == iOffset);
-
   gtk_text_buffer_delete_selection(pPrivate->pBuffer, false, true );
 
   GtkTextIter sIter;
@@ -627,11 +374,6 @@ dasher_editor_internal_output(DasherEditor *pSelf, const gchar *szText, int iOff
 
   gtk_text_view_scroll_mark_onscreen(pPrivate->pTextView, gtk_text_buffer_get_insert(pPrivate->pBuffer));
 
-  //  g_message("Buffer lenght: %d", gtk_text_buffer_get_char_count(pPrivate->pBuffer));
-
-//   if(pPrivate->pGameModeHelper)
-//     game_mode_helper_output(pPrivate->pGameModeHelper, szText);
-
   pPrivate->bFileModified = TRUE;
 }
 
@@ -1031,279 +773,6 @@ dasher_editor_internal_select_all(DasherEditor *pSelf) {
   delete end;
 }
 
-#ifdef XXXPRLWACTIONSAREFIXED
-static void
-dasher_editor_internal_setup_actions(DasherEditor *pSelf) {
-  DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
-
-  // TODO: Activate and deactivate methods for actions
-  // TODO: Clear shouldn't be a special case (include support for false in clear method)
-
-  //ACL 14/6/09 Removing old speech code: the Control Mode bits of this
-  // are now in DasherCore, & the old DasherAction would no-op if used in
-  // any otherway! (Also the whole actions code stuff seems so unfinished etc.
-  // anyway...that perhaps it's best removed?)
-  //PRLW 4/4/11 Its tentacles made it into DasherAppSettings, so hiding with
-  // #ifdef XXXPRLWACTIONSAREFIXED
-
-  dasher_editor_internal_add_action(pSelf, DASHER_ACTION(dasher_action_keyboard_new()));
-
-#ifdef WITH_MAEMO
-  dasher_editor_internal_add_action(pSelf, DASHER_ACTION(dasher_action_keyboard_maemo_new()));
-#else
-  //  dasher_editor_internal_add_action(pSelf, DASHER_ACTION(dasher_action_copy_new(pSelf)));
-
-  GDir *pDirectory;
-  G_CONST_RETURN gchar *szFilename;
-
-
-  gchar *szUserScriptDir = new gchar[strlen(dasher_app_settings_get_string(pPrivate->pAppSettings, SP_USER_LOC))+9];
-  strcpy(szUserScriptDir, dasher_app_settings_get_string(pPrivate->pAppSettings, SP_USER_LOC));
-  strcat(szUserScriptDir, "scripts/");
-
-  pDirectory = g_dir_open(szUserScriptDir, 0, NULL);
-
-  if(pDirectory) {
-    while((szFilename = g_dir_read_name(pDirectory))) {
-      dasher_editor_internal_add_action(pSelf, DASHER_ACTION(dasher_action_script_new(szUserScriptDir, szFilename)));
-    }
-
-    g_dir_close(pDirectory);
-  }
-
-  delete[] szUserScriptDir;
-
-  gchar *szSystemScriptDir = new gchar[strlen(dasher_app_settings_get_string(pPrivate->pAppSettings, SP_SYSTEM_LOC))+9];
-  strcpy(szSystemScriptDir, dasher_app_settings_get_string(pPrivate->pAppSettings, SP_SYSTEM_LOC));
-  strcat(szSystemScriptDir, "scripts/");
-
-  pDirectory = g_dir_open(szSystemScriptDir, 0, NULL);
-
-  if(pDirectory) {
-    while((szFilename = g_dir_read_name(pDirectory))) {
-      dasher_editor_internal_add_action(pSelf, DASHER_ACTION(dasher_action_script_new(szSystemScriptDir, szFilename)));
-    }
-
-    g_dir_close(pDirectory);
-  }
-
-  delete[] szSystemScriptDir;
-#endif
-
-  // TODO: Reimplement
-
-//   // TODO: This doesn't get re-called if the preferences change
-
-//   gtk_dasher_control_register_node( GTK_DASHER_CONTROL(pDasherWidget), Dasher::CControlManager::CTL_USER, "Actions", -1 );
-//   gtk_dasher_control_connect_node( GTK_DASHER_CONTROL(pDasherWidget), Dasher::CControlManager::CTL_USER, Dasher::CControlManager::CTL_ROOT, -2);
-//   int iControlOffset(1);
-
-//   gtk_dasher_control_register_node( GTK_DASHER_CONTROL(pDasherWidget), Dasher::CControlManager::CTL_USER + iControlOffset, "Clear", -1 );
-//   gtk_dasher_control_connect_node( GTK_DASHER_CONTROL(pDasherWidget), Dasher::CControlManager::CTL_USER + iControlOffset, Dasher::CControlManager::CTL_USER, -2);
-//   gtk_dasher_control_connect_node( GTK_DASHER_CONTROL(pDasherWidget), -1, Dasher::CControlManager::CTL_USER + iControlOffset, -2);
-//   ++iControlOffset;
-
-//   EditorAction *pCurrentAction = pPrivate->pActionRing;
-//   bool bStarted = false;
-
-//   while(!bStarted || (pCurrentAction != pPrivate->pActionRing)) {
-//     bStarted = true;
-
-//     if(pCurrentAction->bControl) {
-//       gtk_dasher_control_register_node( GTK_DASHER_CONTROL(pDasherWidget), Dasher::CControlManager::CTL_USER + iControlOffset, dasher_action_get_name(pCurrentAction->pAction), -1 );
-//       gtk_dasher_control_connect_node( GTK_DASHER_CONTROL(pDasherWidget), Dasher::CControlManager::CTL_USER + iControlOffset, Dasher::CControlManager::CTL_USER, -2);
-
-//       int iNSub(dasher_action_get_sub_count(pCurrentAction->pAction));
-
-//       if(iNSub == 0) {
-// 	gtk_dasher_control_connect_node( GTK_DASHER_CONTROL(pDasherWidget), -1, Dasher::CControlManager::CTL_USER + iControlOffset, -2);
-//       }
-//       else {
-// 	for(int i(0); i < iNSub; ++i) {
-// 	  gtk_dasher_control_register_node( GTK_DASHER_CONTROL(pDasherWidget), Dasher::CControlManager::CTL_USER + iControlOffset + i + 1, dasher_action_get_sub_name(pCurrentAction->pAction, i), -1 );
-// 	  gtk_dasher_control_connect_node( GTK_DASHER_CONTROL(pDasherWidget), Dasher::CControlManager::CTL_USER + iControlOffset + i + 1, Dasher::CControlManager::CTL_USER + iControlOffset, -2);
-// 	  gtk_dasher_control_connect_node( GTK_DASHER_CONTROL(pDasherWidget), -1, Dasher::CControlManager::CTL_USER + iControlOffset + i + 1, -2);
-// 	}
-//       }
-
-//       pCurrentAction->iControlID = Dasher::CControlManager::CTL_USER + iControlOffset;
-//       pCurrentAction->iNSub = iNSub;
-//       iControlOffset += iNSub + 1;
-//     }
-
-//     pCurrentAction = pCurrentAction->pNext;
-//   }
-
-#ifndef WITH_MAEMOFULLSCREEN
-  //  dasher_editor_internal_rebuild_action_pane(pSelf);
-#endif
-}
-#endif /* XXXPRLWACTIONSAREFIXED */
-
-#ifdef XXXPRLWACTIONSAREFIXED
-static void
-dasher_editor_internal_add_action(DasherEditor *pSelf, DasherAction *pNewAction) {
-  DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
-
-  EditorAction *pNewEditorAction = new EditorAction;
-  pNewEditorAction->pAction = pNewAction;
-  pNewEditorAction->iID = pPrivate->iNextActionID;
-  ++pPrivate->iNextActionID;
-
-  gchar szRegistryName[256];
-  strncpy(szRegistryName, "Action_", 256);
-  strncat(szRegistryName, dasher_action_get_name(pNewEditorAction->pAction), 255 - strlen(szRegistryName));
-
-  for(unsigned int i(0); i < strlen(szRegistryName); ++i)
-    if(szRegistryName[i] == ' ')
-      szRegistryName[i] = '_';
-
-  gint iState;
-
-  if(!dasher_app_settings_get_free_long(pPrivate->pAppSettings, szRegistryName, iState)) {
-    if(!strcmp(dasher_action_get_name(pNewEditorAction->pAction), "Speak"))
-      iState = 0;
-    else
-      iState = ACTION_STATE_SHOW | ACTION_STATE_CONTROL;
-
-    dasher_app_settings_set_free_long(pPrivate->pAppSettings, szRegistryName, iState);
-  }
-
-  pNewEditorAction->bShow = iState & ACTION_STATE_SHOW;
-  pNewEditorAction->bControl = iState & ACTION_STATE_CONTROL;
-  pNewEditorAction->bAuto = iState & ACTION_STATE_AUTO;
-
-  dasher_editor_internal_check_activity(pSelf, pNewEditorAction);
-
-  if(pPrivate->pActionRing) {
-    pNewEditorAction->pNext = pPrivate->pActionRing;
-    pNewEditorAction->pPrevious = pPrivate->pActionRing->pPrevious;
-    pPrivate->pActionRing->pPrevious->pNext = pNewEditorAction;
-    pPrivate->pActionRing->pPrevious = pNewEditorAction;
-  }
-  else {
-    pNewEditorAction->pNext = pNewEditorAction;
-    pNewEditorAction->pPrevious = pNewEditorAction;
-  }
-
-  pPrivate->pActionRing = pNewEditorAction;
-
-  // TODO: Reimplement
-//   if(iState & ACTION_STATE_SHOW)
-//     gtk_dasher_control_add_action_button(GTK_DASHER_CONTROL(pDasherWidget), dasher_action_get_name(pNewEditorAction->pAction));
-}
-#endif /* XXXPRLWACTIONSAREFIXED */
-
-#ifdef XXXPRLWACTIONSAREFIXED
-static EditorAction *
-dasher_editor_internal_get_action_by_id(DasherEditor *pSelf, int iID){
-  DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
-
-  EditorAction *pCurrentAction = pPrivate->pActionRing;
-  bool bStarted = false;
-
-  while(!bStarted || (pCurrentAction != pPrivate->pActionRing)) {
-    bStarted = true;
-    if(pCurrentAction->iID == iID)
-      return pCurrentAction;
-    pCurrentAction = pCurrentAction->pNext;
-  }
-
-  return 0;
-}
-#endif /* XXXPRLWACTIONSAREFIXED */
-
-#ifdef XXXPRLWACTIONSAREFIXED
-static void
-dasher_editor_internal_rebuild_action_pane(DasherEditor *pSelf) {
-  DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
-
-  // Delete any existing widgets
-  gtk_container_foreach(GTK_CONTAINER(pPrivate->pActionPane), delete_children_callback, 0);
-
-  // Add the cancel button
-  GtkButton *pNewButton = GTK_BUTTON(gtk_button_new_with_label("Clear"));
-  gtk_widget_show(GTK_WIDGET(pNewButton));
-
-  void **pUserData = new void *[2];
-  pUserData[0] = (void *)pSelf;
-  pUserData[1] = 0;
-
-  g_signal_connect(G_OBJECT(pNewButton), "clicked", G_CALLBACK(action_button_callback), pUserData);
-#ifdef WITH_MAEMO
-  // For Maemo we want the packing to expand
-  gtk_box_pack_start(GTK_BOX(pPrivate->pActionPane), GTK_WIDGET(pNewButton), true, true, 0);
-#else
-  gtk_box_pack_start(GTK_BOX(pPrivate->pActionPane), GTK_WIDGET(pNewButton), false, false, 0);
-#endif
-
-
-  EditorAction *pCurrentAction = pPrivate->pActionRing;
-  bool bStarted = false;
-
-  while(!bStarted || (pCurrentAction != pPrivate->pActionRing)) {
-    bStarted = true;
-    if(pCurrentAction->bShow) {
-      GtkButton *pNewButton = GTK_BUTTON(gtk_button_new_with_label(dasher_action_get_name(pCurrentAction->pAction)));
-      gtk_widget_show(GTK_WIDGET(pNewButton));
-
-      pUserData = new void *[2];
-      pUserData[0] = (void *)pSelf;
-      pUserData[1] = (void *)(pCurrentAction->pAction);
-
-      g_signal_connect(G_OBJECT(pNewButton), "clicked", G_CALLBACK(action_button_callback), pUserData);
-#ifdef WITH_MAEMO
-      // For Maemo we want the packing to expand
-      gtk_box_pack_start(GTK_BOX(pPrivate->pActionPane), GTK_WIDGET(pNewButton), true, true, 0);
-#else
-      gtk_box_pack_start(GTK_BOX(pPrivate->pActionPane), GTK_WIDGET(pNewButton), false, false, 0);
-#endif
-    }
-    pCurrentAction = pCurrentAction->pNext;
-  }
-}
-#endif /* XXXPRLWACTIONSAREFIXED */
-
-#ifdef XXXPRLWACTIONSAREFIXED
-static void
-dasher_editor_internal_check_activity(DasherEditor *pSelf, EditorAction *pAction) {
-  gboolean bNeedActive(pAction->bShow || pAction->bControl || pAction->bAuto);
-  gboolean bActive(dasher_action_get_active(pAction->pAction));
-
-  if(bNeedActive && !bActive)
-    dasher_action_activate(pAction->pAction);
-  else if(!bNeedActive && bActive)
-    dasher_action_deactivate(pAction->pAction);
-}
-#endif
-
-#ifdef XXXPRLWACTIONSAREFIXED
-static void
-dasher_editor_internal_action_save_state(DasherEditor *pSelf, EditorAction *pAction) {
-  gchar szRegistryName[256];
-  strncpy(szRegistryName, "Action_", 256);
-  strncat(szRegistryName, dasher_action_get_name(pAction->pAction), 255 - strlen(szRegistryName));
-
-  for(unsigned int i(0); i < strlen(szRegistryName); ++i)
-    if(szRegistryName[i] == ' ')
-      szRegistryName[i] = '_';
-
-  gint iState = 0;
-
-  if(pAction->bShow)
-    iState += ACTION_STATE_SHOW;
-
-  if(pAction->bControl)
-    iState += ACTION_STATE_CONTROL;
-
-  if(pAction->bAuto)
-    iState += ACTION_STATE_AUTO;
-
-  DasherEditorInternalPrivate *pPrivate = DASHER_EDITOR_INTERNAL_GET_PRIVATE(pSelf);
-  dasher_app_settings_set_free_long(pPrivate->pAppSettings, szRegistryName, iState);
-}
-#endif
-
 static void
 dasher_editor_internal_command_new(DasherEditor *pSelf) {
   dasher_editor_internal_new_buffer(pSelf, NULL);
@@ -1750,18 +1219,6 @@ extern "C" void
 main_window_realized(DasherMain *pMain, gpointer pUserData) {
 }
 
-#ifdef XXXPRLWACTIONSAREFIXED
-extern "C" void
-action_button_callback(GtkWidget *pWidget, gpointer pUserData) {
-  void **pPointers((void **)pUserData);
-  dasher_editor_internal_action_button((DasherEditor *)pPointers[0], (DasherAction *)pPointers[1]);
-}
-#endif
-
 extern "C" void mark_set_handler(GtkWidget *widget, GtkTextIter *pIter, GtkTextMark *pMark, gpointer pUserData) {
   dasher_editor_internal_mark_changed(DASHER_EDITOR_INTERNAL(pUserData), pIter, pMark);
 }
-
-
-
-
diff --git a/Src/Gtk2/dasher_editor_internal.h b/Src/Gtk2/dasher_editor_internal.h
index dec96a7..7e32f58 100644
--- a/Src/Gtk2/dasher_editor_internal.h
+++ b/Src/Gtk2/dasher_editor_internal.h
@@ -6,9 +6,6 @@
 #include <gtk/gtk.h>
 
 #include "DasherAppSettings.h"
-#ifdef XXXPRLWACTIONSAREFIXED
-#include "dasher_action.h"
-#endif
 #include "dasher_editor.h"
 
 /* Forward declaration */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]