Logo Search packages:      
Sourcecode: manedit version File versions  Download package


                                Manual Page Editor

#ifndef EDITOR_H
#define EDITOR_H

#include <gtk/gtk.h>
#include "editorfip.h"

typedef struct _editor_struct       editor_struct;
typedef struct _editor_item_struct  editor_item_struct;

 *    Editor Item Types:
typedef enum {
      EditorItemTypeFile,           /* Main trunk */
} editor_item_type;

 *    Editor Item:
 *    Used as row data on the layout_ctree.
 *    When adding new members be sure to update functions
 *    EditorItemNew(), EditorItemDup(), and EditorItemDelete()
 *    so that they properly allocate, duplicate, and delete the
 *    new members.
struct _editor_item_struct {

      editor_item_type  type;
      editor_struct     *editor;
      gboolean    has_changes;

      GtkCTree    *ctree;           /* Layout GtkCTree */
      GtkCTreeNode      *parent;    /* Parent branch */
      GtkCTreeNode      *this_branch;     /* This branch */
      gboolean    is_leaf;

      /* Members for type EditorItemTypeFile */
      gchar       *name;            /* File name without path */
      gchar       *full_path; /* If NULL then implies it has
                               * never been saved before */

      /* Members for type EditorItemTypeHeader */
      gchar       *header_name;
      gchar       *header_section_number;
      gchar       *header_version;
      gchar       *header_author;
      gchar       *header_catagory;

      /* Members for type EditorItemTypeSection */
      gchar       *section_name;

      /* Common members */
      gchar       **line;
      gint        total_lines;

#define EDITOR_ITEM(p)        ((editor_item_struct *)(p))

 *    Editor:
struct _editor_struct {

      gboolean    initialized,

      gpointer    core_ptr;
      gint        viewer_num; /* Index of spawned manual page viewer
                               * (can be -1 for none) */

      GtkWidget   *toplevel,

      GtkWidget   *menu_bar_dock,

      GtkWidget   *layout_ctree;

      /* List of trunk branch nodes on the layout ctree, these may
       * not be in any particular order and not in sync on the
       * ctree
       * These should all have user item data type set to
       * EditorItemTypeFile, which implies the number of files loaded
      GtkCTreeNode      **layout_trunk;
      gint        total_layout_trunks;

      GtkCTreeNode      *selected_branch; /* Can be NULL for none */

      /* Right pane editing widgets parent, note the type
       * corresponds to EditorItemType* and maximum is
       * MEDIT_EDIT_PANEL_MAX which must be one greater than
       * the highest EditorItemType* code
      GtkWidget   *edit_panel_vbox[MEDIT_EDIT_PANEL_MAX];

      GtkWidget   *header_name_entry,
                  *header_text;     /* For comments */

      GtkWidget   *section_name_entry,

      /* Syntax highlight timeout callback values */
      guint       synhl_timeout_cb_id;    /* None if (guint)(-1) */
      gint        synhl_timeout_cb_cursor_pos;
      gint        synhl_timeout_cb_start_pos;
      gint        synhl_timeout_cb_end_pos;

      /* Important menu items */
      GtkWidget   *file_mh,






      /* Tool bar buttons */
      GtkWidget   *new_btn,





      /* Formatting bar buttons */
      GtkWidget   *fmt_bar_dock,

      /* Search bar */
      GtkWidget   *find_bar_dock,

      /* Find bar button find menu */
      GtkWidget   *find_bar_find_menu,

      /* Find bar button replace menu */
      GtkWidget       *find_bar_replace_menu,

      /* Right-click menus */
      GtkWidget *layout_menu, *edit_panel_menu;

      /* Important menu items on right-click menus */
      GtkWidget   *layout_menu_expand_mi,

      GtkWidget   *edit_panel_undo_mi,
      /* Format submenu on edit panel menu */
      GtkWidget   *edit_panel_fmt_sub_menu,

      /* Status bar */
      GtkWidget   *status_bar_dock,
                  *status_bar_toplevel,   /* An hbox */

      /* Last progress position value from 0.0 to 1.0 */
      gfloat            status_bar_progress_pos_last;

      /* Undo/redo structures */
      gpointer    *undo;
      gint        total_undos;

      gpointer    *redo;
      gint        total_redos;

      gint        max_undos;  /* Maximum undos and maximum redos */

      /* Last open file path */
      gchar       *last_open_path;

      /* Last save as file path */
      gchar       *last_save_as_path;

      /* Editor Find In Pages dialog */
      editor_fip_struct *fip_dialog;

#define EDITOR(p) ((editor_struct *)(p))
#define EDITOR_TOPLEVEL(p)    (((p) != NULL) ? \
 (EDITOR(p)->toplevel) : NULL)
#define EDITOR_LAYOUT_CTREE(p)      (((p) != NULL) ? \
 (EDITOR(p)->layout_ctree) : NULL)
#define EDITOR_HEADER_TEXT(p) (((p) != NULL) ? \
 (EDITOR(p)->header_text) : NULL)
#define EDITOR_SECTION_TEXT(p)      (((p) != NULL) ? \
 (EDITOR(p)->section_text) : NULL)
#define EDITOR_LAST_OPEN_PATH(p)    (((p) != NULL) ? \
 (EDITOR(p)->last_open_path) : NULL)
#define EDITOR_LAST_SAVE_AS_PATH(p) (((p) != NULL) ? \
 (EDITOR(p)->last_save_as_path) : NULL)

extern editor_item_struct *EditorItemNew(
      editor_item_type type,
        editor_struct *editor,
        GtkCTree *ctree,
        GtkCTreeNode *parent,
        GtkCTreeNode *this_branch,
        gboolean is_leaf,
        gchar **line,         /* Transfered, not copied */
        gint total_lines
extern editor_item_struct *EditorItemDup(editor_item_struct *item);
extern void EditorItemDelete(editor_item_struct *item);

extern void EditorLayoutTrunkDeleteAll(editor_struct *editor);

extern void EditorBranchSelect(
        editor_struct *editor, GtkCTreeNode *branch

extern void EditorBranchSetData(
      GtkCTree *ctree, GtkCTreeNode *branch,
      editor_item_struct *item, GtkDestroyNotify destroy
extern editor_item_struct *EditorBranchGetData(
      GtkCTree *ctree, GtkCTreeNode *branch
extern void EditorItemSetToplevelHasChanges(
        editor_struct *editor, GtkCTreeNode *branch, gboolean has_changes

extern GtkCTreeNode *EditorItemGetFirstToplevel(editor_struct *editor);
extern GtkCTreeNode *EditorItemGetParent(
        editor_struct *editor, GtkCTreeNode *branch
extern GtkCTreeNode *EditorItemGetToplevel(
        editor_struct *editor, GtkCTreeNode *branch

extern void EditorSetBusy(editor_struct *editor);
extern void EditorSetReady(editor_struct *editor);

extern editor_struct *EditorNew(void *core_ptr);
extern void EditorUpdateMenus(editor_struct *editor);
extern void EditorSetStatusPosition(editor_struct *editor, gint row, gint column);
extern void EditorSetStatusMessage(editor_struct *editor, const gchar *mesg);
extern void EditorSetStatusProgress(editor_struct *editor, gfloat percent);
extern void EditorRecordPositions(editor_struct *editor);
extern void EditorResetUndos(editor_struct *editor);
extern void EditorReset(editor_struct *editor, gboolean need_unmap);
extern void EditorMap(editor_struct *editor);
extern void EditorUnmap(editor_struct *editor);
extern void EditorDelete(editor_struct *editor);

#endif      /* EDITOR_H */

Generated by  Doxygen 1.6.0   Back to index