145 mutt_error(
_(
"Only inline attachments with content-type text/* can be previewed"));
166 int content_lines = 0;
173 bool text_left =
true;
193 if ((content_lines >= wdata->
scroll_offset) && (row < win->state.rows))
212 if ((content_lines != 0) && (content_lines > win->
state.
rows))
214 char title[256] = { 0 };
215 double percent = 100.0;
217 percent = 100.0 / content_lines * (wdata->
scroll_offset + row);
220 snprintf(title,
sizeof(title),
_(
"-- Preview (%.0f%%)"), percent);
407 if (!win || !win->
wdata)
Color and attribute parsing.
void mutt_color_observer_remove(observer_t callback, void *global_data)
Remove an observer.
void mutt_color_observer_add(observer_t callback, void *global_data)
Add an observer.
ColorId
List of all coloured objects.
@ MT_COLOR_STATUS
Status bar (takes a pattern)
@ MT_COLOR_BOLD
Bold text.
@ MT_COLOR_NORMAL
Plain text.
Convenience wrapper for the core headers.
size_t mutt_wstr_trunc(const char *src, size_t maxlen, size_t maxwid, size_t *width)
Work out how to truncate a widechar string.
void mutt_paddstr(struct MuttWindow *win, int n, const char *s)
Display a string on screen, padded if necessary.
const char * dispatcher_get_retval_name(int rv)
Get the name of a return value.
@ FR_SUCCESS
Valid function - successfully performed.
@ FR_UNKNOWN
Unknown function.
@ FR_NO_ACTION
Valid function - no action performed.
Structs that make up an email.
char * mutt_file_read_line(char *line, size_t *size, FILE *fp, int *line_num, ReadLineFlags flags)
Read a line from a file.
long mutt_file_get_size(const char *path)
Get the size of a file.
#define mutt_file_fclose(FP)
#define mutt_file_fopen(PATH, MODE)
#define MUTT_RL_NO_FLAGS
No flags are set.
int preview_function_dispatcher(struct MuttWindow *win, int op)
Perform a preview function - Implements function_dispatcher_t -.
#define mutt_warning(...)
#define mutt_debug(LEVEL,...)
static int preview_email_observer(struct NotifyCallback *nc)
Notification that the Email has changed - Implements observer_t -.
static int preview_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
static int preview_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
static int preview_page_up(struct PreviewWindowData *wdata, int op)
Show the previous page of the message - Implements preview_function_t -.
static int preview_page_down(struct PreviewWindowData *wdata, int op)
Show the previous page of the message - Implements preview_function_t -.
static int preview_recalc(struct MuttWindow *win)
Recalculate the Window data - Implements MuttWindow::recalc() -.
static int preview_repaint(struct MuttWindow *win)
Repaint the Window - Implements MuttWindow::repaint() -.
static void preview_wdata_free(struct MuttWindow *win, void **ptr)
Free the Preview Data - Implements MuttWindow::wdata_free() -.
Convenience wrapper for the gui headers.
@ LL_DEBUG5
Log at debug level 5.
@ LL_DEBUG1
Log at debug level 1.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
@ TYPE_TEXT
Type: 'text/*'.
@ DISP_INLINE
Content is inline.
Convenience wrapper for the library headers.
bool notify_observer_remove(struct Notify *notify, const observer_t callback, const void *global_data)
Remove an observer from an object.
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
void mutt_window_clear(struct MuttWindow *win)
Clear a Window.
struct MuttWindow * mutt_window_new(enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows)
Create a new Window.
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
#define WA_RECALC
Recalculate the contents of the Window.
@ WT_CUSTOM
Window with a custom drawing function.
@ MUTT_WIN_ORIENT_VERTICAL
Window uses all available vertical space.
@ NT_WINDOW_STATE
Window state has changed, e.g. WN_VISIBLE.
@ NT_WINDOW_DELETE
Window is about to be deleted.
#define WA_REPAINT
Redraw the contents of the Window.
#define MUTT_WIN_SIZE_UNLIMITED
Use as much space as possible.
@ MUTT_WIN_SIZE_MAXIMISE
Window wants as much space as possible.
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
@ NT_COLOR
Colour has changed, NotifyColor, EventColor.
@ NT_EMAIL
Email has changed, NotifyEmail, EventEmail.
@ NT_ALL
Register for all notifications.
const char * opcodes_get_name(int op)
Get the name of an opcode.
struct MuttWindow * preview_window_new(struct Email *e, struct MuttWindow *bar)
Create the preview window.
static const struct PreviewFunction PreviewFunctions[]
All the functions that the preview window supports.
int(* preview_function_t)(struct PreviewWindowData *wdata, int op)
static void draw_preview(struct MuttWindow *win, struct PreviewWindowData *wdata)
Write the message preview to the compose window.
const long MAX_PREVIEW_BODY_SIZE
static struct PreviewWindowData * preview_wdata_new(void)
Create new Preview Data.
void sbar_set_title(struct MuttWindow *win, const char *title)
Set the title for the Simple Bar.
unsigned int disposition
content-disposition, ContentDisposition
unsigned int type
content-type primary type, ContentType
char * filename
When sending a message, this is the file to which this structure refers.
The envelope/body of an email.
struct Body * body
List of MIME parts.
struct Notify * notify
Notifications: NotifyEmail, EventEmail.
An Event that happened to a Colour.
enum ColorId cid
Colour ID that has changed.
An Event that happened to a Window.
struct MuttWindow * win
Window that changed.
int(* repaint)(struct MuttWindow *win)
struct WindowState state
Current state of the Window.
void * wdata
Private data.
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
int(* recalc)(struct MuttWindow *win)
void(* wdata_free)(struct MuttWindow *win, void **ptr)
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Data passed to a notification function.
void * event_data
Data from notify_send()
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
void * global_data
Data from notify_observer_add()
A message preview function.
int op
Op code, e.g. OP_NEXT_PAGE.
preview_function_t function
Function to call.
Data to fill the Preview Window.
struct MuttWindow * win
Window holding the message preview.
struct MuttWindow * bar
Status bar above the preview window.
int scroll_offset
Scroll offset.
struct Email * email
Email being composed.
bool more_content
Is there more content to scroll down to?
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.