mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 20:06:00 +01:00
Document structure
This commit is contained in:
parent
ade141aadc
commit
6d5ac53aa3
5 changed files with 187 additions and 8 deletions
6
Makefile
6
Makefile
|
@ -4,9 +4,9 @@
|
|||
include config.mk
|
||||
|
||||
PROJECT = zathura
|
||||
SOURCE = callbacks.c commands.c config.c shortcuts.c utils.c zathura.c
|
||||
OBJECTS = ${SOURCE:.c=.o}
|
||||
DOBJECTS = ${SOURCE:.c=.do}
|
||||
SOURCE = $(shell find . -iname "*.c" -a ! -iwholename "*./doc*")
|
||||
OBJECTS = $(patsubst %.c, %.o, $(SOURCE))
|
||||
DOBJECTS = $(patsubst %.c, %.do, $(SOURCE))
|
||||
|
||||
all: options ${PROJECT}
|
||||
|
||||
|
|
77
ft/document.c
Normal file
77
ft/document.c
Normal file
|
@ -0,0 +1,77 @@
|
|||
/* See LICENSE file for license and copyright information */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "document.h"
|
||||
|
||||
zathura_page_t*
|
||||
zathura_page_get(zathura_document_t* document, unsigned int page)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
zathura_list_t*
|
||||
zathura_page_search_text(zathura_page_t* page, const char* text)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
zathura_list_t*
|
||||
zathura_page_links_get(zathura_page_t* page)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
zathura_page_links_free(zathura_list_t* list)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
zathura_list_t*
|
||||
zathura_page_form_fields_get(zathura_page_t* page)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
zathura_page_form_fields_free(zathura_list_t* list)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
cairo_surface_t*
|
||||
zathura_page_render(zathura_page_t* page)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
zathura_list_t*
|
||||
zathura_document_index_generate(zathura_document_t* document)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
zathura_document_index_free(zathura_list_t* list)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
zathura_document_save_as(zathura_document_t* document, const char* path)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
zathura_list_t*
|
||||
zathura_document_attachments_get(zathura_document_t* document)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
zathura_document_attachments_free(zathura_list_t* list)
|
||||
{
|
||||
return false;
|
||||
}
|
100
ft/document.h
100
ft/document.h
|
@ -0,0 +1,100 @@
|
|||
/* See LICENSE file for license and copyright information */
|
||||
|
||||
#ifndef DOCUMENT_H
|
||||
#define DOCUMENT_H
|
||||
|
||||
#include <cairo.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct zathura_list_s zathura_list_t;
|
||||
typedef struct zathura_document_s zathura_document_t;
|
||||
|
||||
struct zathura_list_s
|
||||
{
|
||||
void* data;
|
||||
struct zathura_list_s* next;
|
||||
};
|
||||
|
||||
typedef struct zathura_rectangle_s
|
||||
{
|
||||
double x1;
|
||||
double y1;
|
||||
double x2;
|
||||
double y2;
|
||||
} zathura_rectangle_t;
|
||||
|
||||
typedef enum zathura_link_type_e
|
||||
{
|
||||
ZATHURA_LINK_TO_PAGE,
|
||||
ZATHURA_LINK_EXTERNAL,
|
||||
} zathura_link_type_t;
|
||||
|
||||
typedef struct zathura_link_s
|
||||
{
|
||||
zathura_rectangle_t position;
|
||||
zathura_link_type_t type;
|
||||
union
|
||||
{
|
||||
unsigned int page_number;
|
||||
char* value;
|
||||
} target;
|
||||
} zathura_link_t;
|
||||
|
||||
typedef enum zathura_form_type_e
|
||||
{
|
||||
ZATHURA_FORM_CHECKBOX,
|
||||
ZATHURA_FORM_TEXTFIELD
|
||||
} zathura_form_type_t;
|
||||
|
||||
typedef struct zathura_form_s
|
||||
{
|
||||
zathura_rectangle_t position;
|
||||
zathura_form_type_t type;
|
||||
} zathura_form_t;
|
||||
|
||||
typedef struct zathura_page_s
|
||||
{
|
||||
unsigned int height;
|
||||
unsigned int width;
|
||||
zathura_document_t* document;
|
||||
void* data;
|
||||
} zathura_page_t;
|
||||
|
||||
struct zathura_document_s
|
||||
{
|
||||
char* file_path;
|
||||
char* password;
|
||||
unsigned int current_page_number;
|
||||
unsigned int number_of_pages;
|
||||
int scale;
|
||||
int rotate;
|
||||
|
||||
struct
|
||||
{
|
||||
zathura_page_t* (*page_get)(zathura_document_t* document, unsigned int page);
|
||||
zathura_list_t* (*page_search_text)(zathura_page_t* page, const char* text);
|
||||
zathura_list_t* (*page_links_get)(zathura_page_t* page);
|
||||
zathura_list_t* (*page_form_fields_get)(zathura_page_t* page);
|
||||
cairo_surface_t* (*page_render)(zathura_page_t* page);
|
||||
|
||||
zathura_list_t* (*document_index_generate)(zathura_document_t* document);
|
||||
bool (*document_save_as)(zathura_document_t* document, const char* path);
|
||||
zathura_list_t* (*document_attachments_get)(zathura_document_t* document);
|
||||
} functions;
|
||||
};
|
||||
|
||||
zathura_page_t* zathura_page_get(zathura_document_t* document, unsigned int page);
|
||||
zathura_list_t* zathura_page_search_text(zathura_page_t* page, const char* text);
|
||||
zathura_list_t* zathura_page_links_get(zathura_page_t* page);
|
||||
bool zathura_page_links_free(zathura_list_t* list);
|
||||
zathura_list_t* zathura_page_form_fields_get(zathura_page_t* page);
|
||||
bool zathura_page_form_fields_free(zathura_list_t* list);
|
||||
cairo_surface_t* zathura_page_render(zathura_page_t* page);
|
||||
|
||||
zathura_list_t* zathura_document_index_generate(zathura_document_t* document);
|
||||
bool zathura_document_index_free(zathura_list_t* list);
|
||||
bool zathura_document_save_as(zathura_document_t* document, const char* path);
|
||||
zathura_list_t* zathura_document_attachments_get(zathura_document_t* document);
|
||||
bool zathura_document_attachments_free(zathura_list_t* list);
|
||||
|
||||
#endif // DOCUMENT_H
|
|
@ -44,11 +44,11 @@ sc_focus_inputbar(girara_session_t* session, girara_argument_t* argument)
|
|||
{
|
||||
g_return_val_if_fail(session != NULL, false);
|
||||
|
||||
if(!(GTK_WIDGET_VISIBLE(GTK_WIDGET(session->gtk.inputbar))))
|
||||
if(!(GTK_WIDGET_VISIBLE(GTK_WIDGET(session->gtk.inputbar)))) {
|
||||
gtk_widget_show(GTK_WIDGET(session->gtk.inputbar));
|
||||
}
|
||||
|
||||
if(argument->data)
|
||||
{
|
||||
if(argument->data) {
|
||||
gtk_entry_set_text(session->gtk.inputbar, (char*) argument->data);
|
||||
gtk_widget_grab_focus(GTK_WIDGET(session->gtk.inputbar));
|
||||
gtk_editable_set_position(GTK_EDITABLE(session->gtk.inputbar), -1);
|
||||
|
|
|
@ -9,11 +9,13 @@
|
|||
bool
|
||||
init_zathura()
|
||||
{
|
||||
if(!(Zathura.UI.session = girara_session_create()))
|
||||
if(!(Zathura.UI.session = girara_session_create())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!girara_session_init(Zathura.UI.session))
|
||||
if(!girara_session_init(Zathura.UI.session)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* UI */
|
||||
Zathura.UI.buffer = girara_statusbar_item_add(Zathura.UI.session, FALSE, FALSE, FALSE, NULL);
|
||||
|
|
Loading…
Reference in a new issue