medit/moo/mooedit/mootextprint.h

131 lines
4.4 KiB
C
Raw Normal View History

2006-03-25 01:40:54 -08:00
/*
* mootextprint.h
*
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* See COPYING file that comes with this distribution.
*/
2006-05-07 11:15:58 -07:00
#ifndef MOOEDIT_COMPILATION
#error "This file may not be used directly"
#endif
2006-03-25 01:40:54 -08:00
#ifndef __MOO_TEXT_PRINT_H__
#define __MOO_TEXT_PRINT_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
2006-05-07 11:15:58 -07:00
#define MOO_TYPE_PRINT_OPERATION (_moo_print_operation_get_type ())
2006-03-25 01:40:54 -08:00
#define MOO_PRINT_OPERATION(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_PRINT_OPERATION, MooPrintOperation))
#define MOO_PRINT_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_PRINT_OPERATION, MooPrintOperationClass))
#define MOO_IS_PRINT_OPERATION(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_PRINT_OPERATION))
#define MOO_IS_PRINT_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_PRINT_OPERATION))
#define MOO_PRINT_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_PRINT_OPERATION, MooPrintOperationClass))
typedef struct _MooPrintOperation MooPrintOperation;
typedef struct _MooPrintOperationClass MooPrintOperationClass;
2006-05-07 16:44:10 -07:00
typedef enum {
MOO_PRINT_WRAP = 1 << 0,
MOO_PRINT_ELLIPSIZE = 1 << 1,
MOO_PRINT_USE_STYLES = 1 << 2,
MOO_PRINT_HEADER = 1 << 3,
MOO_PRINT_FOOTER = 1 << 4
} MooPrintOptions;
typedef enum {
MOO_PRINT_POS_LEFT,
MOO_PRINT_POS_CENTER,
MOO_PRINT_POS_RIGHT
} MooPrintPos;
typedef struct {
gboolean do_print;
PangoFontDescription *font;
char *format[3];
gboolean separator;
PangoLayout *layout;
double text_height;
double separator_before;
double separator_after;
double separator_height;
gpointer parsed_format[3];
} MooPrintHeaderFooter;
2006-03-25 01:40:54 -08:00
struct _MooPrintOperation
{
GtkPrintOperation base;
2006-03-27 02:55:27 -08:00
2006-03-25 01:40:54 -08:00
GtkTextView *doc;
GtkTextBuffer *buffer;
2006-03-26 10:17:51 -08:00
/* print settings */
int first_line;
int last_line; /* -1 to print everything after first_line */
char *font; /* overrides font set in the doc */
2006-05-07 16:44:10 -07:00
MooPrintOptions options;
2006-03-27 17:27:57 -08:00
PangoWrapMode wrap_mode;
2006-05-07 16:44:10 -07:00
char *filename;
char *basename;
MooPrintHeaderFooter header;
MooPrintHeaderFooter footer;
gpointer tm; /* struct tm * */
2006-03-26 10:17:51 -08:00
/* aux stuff */
GArray *pages; /* GtkTextIter's pointing to pages start */
2006-03-25 01:40:54 -08:00
PangoLayout *layout;
2006-03-26 10:17:51 -08:00
struct {
double x;
double y;
double width;
double height;
} page; /* text area */
2006-03-25 01:40:54 -08:00
};
struct _MooPrintOperationClass
{
GtkPrintOperationClass base_class;
};
2006-05-07 16:44:10 -07:00
GType _moo_print_operation_get_type (void) G_GNUC_CONST;
void _moo_print_operation_set_doc (MooPrintOperation *print,
GtkTextView *doc);
void _moo_print_operation_set_buffer (MooPrintOperation *print,
GtkTextBuffer *buffer);
void _moo_print_operation_set_filename (MooPrintOperation *print,
const char *filename,
const char *basename);
void _moo_print_operation_set_header_format (MooPrintOperation *print,
const char *left,
const char *center,
const char *right);
void _moo_print_operation_set_footer_format (MooPrintOperation *print,
const char *left,
const char *center,
const char *right);
void _moo_edit_page_setup (GtkTextView *view,
GtkWidget *parent);
void _moo_edit_print (GtkTextView *view,
GtkWidget *parent);
2006-05-07 21:48:37 -07:00
void _moo_edit_print_options_dialog (GtkWidget *parent);
2006-03-25 01:40:54 -08:00
G_END_DECLS
#endif /* __MOO_TEXT_PRINT_H__ */