Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Marius
zathura
Commits
5b1a07e3
Commit
5b1a07e3
authored
May 03, 2012
by
Moritz Lipp
Browse files
Introduced some new text annotation functions
parent
33ec398a
Changes
2
Hide whitespace changes
Inline
Side-by-side
annotations.c
View file @
5b1a07e3
...
...
@@ -20,7 +20,13 @@ struct zathura_annotation_s {
char
*
label
;
/**< Label */
char
*
subject
;
/**< Subject of the annotation */
zathura_annotation_popup_t
*
popup
;
/**< Optional popup */
time_t
creation_date
;
/**< Creation date */
}
markup
;
struct
{
zathura_annotation_text_icon_t
icon
;
/**< The icon of the text annotation */
zathura_annotation_text_state_t
state
;
/**< The state of the text annotation */
bool
opened
;
/**< Open status of the text annotation */
}
text
;
}
data
;
};
...
...
@@ -42,13 +48,18 @@ zathura_annotation_new(zathura_annotation_type_t type)
switch
(
type
)
{
case
ZATHURA_ANNOTATION_MARKUP
:
annotation
->
data
.
markup
.
creation_date
=
(
time_t
)
-
1
;
break
;
case
ZATHURA_ANNOTATION_TEXT
:
annotation
->
data
.
text
.
icon
=
ZATHURA_ANNOTATION_TEXT_ICON_UNKNOWN
;
annotation
->
data
.
text
.
state
=
ZATHURA_ANNOTATION_TEXT_STATE_UNKNOWN
;
default:
free
(
annotation
);
return
NULL
;
}
annotation
->
type
=
type
;
annotation
->
type
=
type
;
annotation
->
modification_date
=
(
time_t
)
-
1
;
return
annotation
;
}
...
...
@@ -331,6 +342,86 @@ zathura_annotation_markup_set_popup(zathura_annotation_t* annotation, zathura_an
annotation
->
data
.
markup
.
popup
=
popup
;
}
time_t
zathura_annotation_markup_get_creation_date
(
zathura_annotation_t
*
annotation
)
{
if
(
annotation
==
NULL
||
annotation
->
type
!=
ZATHURA_ANNOTATION_MARKUP
)
{
return
(
time_t
)
-
1
;
}
return
annotation
->
data
.
markup
.
creation_date
;
}
void
zathura_annotation_markup_set_creation_date
(
zathura_annotation_t
*
annotation
,
time_t
creation_date
)
{
if
(
annotation
==
NULL
||
annotation
->
type
!=
ZATHURA_ANNOTATION_MARKUP
)
{
return
;
}
annotation
->
data
.
markup
.
creation_date
=
creation_date
;
}
zathura_annotation_text_icon_t
zathura_annotation_text_get_icon
(
zathura_annotation_t
*
annotation
)
{
if
(
annotation
==
NULL
||
annotation
->
type
!=
ZATHURA_ANNOTATION_TEXT
)
{
return
ZATHURA_ANNOTATION_TEXT_ICON_UNKNOWN
;
}
return
annotation
->
data
.
text
.
icon
;
}
void
zathura_annotation_text_set_icon
(
zathura_annotation_t
*
annotation
,
zathura_annotation_text_icon_t
icon
)
{
if
(
annotation
==
NULL
||
annotation
->
type
!=
ZATHURA_ANNOTATION_TEXT
)
{
return
;
}
annotation
->
data
.
text
.
icon
=
icon
;
}
zathura_annotation_text_state_t
zathura_annotation_text_get_state
(
zathura_annotation_t
*
annotation
)
{
if
(
annotation
==
NULL
||
annotation
->
type
!=
ZATHURA_ANNOTATION_TEXT
)
{
return
ZATHURA_ANNOTATION_TEXT_STATE_UNKNOWN
;
}
return
annotation
->
data
.
text
.
state
;
}
void
zathura_annotation_text_set_state
(
zathura_annotation_t
*
annotation
,
zathura_annotation_text_state_t
state
)
{
if
(
annotation
==
NULL
||
annotation
->
type
!=
ZATHURA_ANNOTATION_TEXT
)
{
return
;
}
annotation
->
data
.
text
.
state
=
state
;
}
bool
zathura_annotation_text_get_open_status
(
zathura_annotation_t
*
annotation
)
{
if
(
annotation
==
NULL
||
annotation
->
type
!=
ZATHURA_ANNOTATION_TEXT
)
{
return
false
;
}
return
annotation
->
data
.
text
.
opened
;
}
void
zathura_annotation_text_set_open_status
(
zathura_annotation_t
*
annotation
,
bool
opened
)
{
if
(
annotation
==
NULL
||
annotation
->
type
!=
ZATHURA_ANNOTATION_TEXT
)
{
return
;
}
annotation
->
data
.
text
.
opened
=
opened
;
}
zathura_annotation_popup_t
*
zathura_annotation_popup_new
()
{
...
...
annotations.h
View file @
5b1a07e3
...
...
@@ -56,6 +56,30 @@ typedef enum zathura_annotation_flag_s {
ZATHURA_ANNOTATION_FLAG_LOCKED_CONTENTS
=
1
<<
9
,
}
zathura_annotation_flag_t
;
typedef
enum
zathura_annotation_text_icon_s
{
ZATHURA_ANNOTATION_TEXT_ICON_UNKNOWN
,
ZATHURA_ANNOTATION_TEXT_ICON_NOTE
,
ZATHURA_ANNOTATION_TEXT_ICON_COMMENT
,
ZATHURA_ANNOTATION_TEXT_ICON_KEY
,
ZATHURA_ANNOTATION_TEXT_ICON_HELP
,
ZATHURA_ANNOTATION_TEXT_ICON_NEW_PARAGRAPH
,
ZATHURA_ANNOTATION_TEXT_ICON_PARAGRAPH
,
ZATHURA_ANNOTATION_TEXT_ICON_INSERT
,
ZATHURA_ANNOTATION_TEXT_ICON_CROSS
,
ZATHURA_ANNOTATION_TEXT_ICON_CIRCLE
}
zathura_annotation_text_icon_t
;
typedef
enum
zathura_annotation_text_state_s
{
ZATHURA_ANNOTATION_TEXT_STATE_UNKNOWN
,
ZATHURA_ANNOTATION_TEXT_STATE_NONE
,
ZATHURA_ANNOTATION_TEXT_STATE_MARKED
,
ZATHURA_ANNOTATION_TEXT_STATE_UNMARKED
,
ZATHURA_ANNOTATION_TEXT_STATE_ACCEPTED
,
ZATHURA_ANNOTATION_TEXT_STATE_REJECTED
,
ZATHURA_ANNOTATION_TEXT_STATE_CANCELLED
,
ZATHURA_ANNOTATION_TEXT_STATE_COMPLETED
}
zathura_annotation_text_state_t
;
/**
* Creates a new annotation
*
...
...
@@ -240,6 +264,70 @@ zathura_annotation_popup_t* zathura_annotation_markup_get_popup(zathura_annotati
*/
void
zathura_annotation_markup_set_popup
(
zathura_annotation_t
*
annotation
,
zathura_annotation_popup_t
*
popup
);
/**
* Returns the creation date of the annotation
*
* @param annotation The annotation
* @retun The creation date
*/
time_t
zathura_annotation_markup_get_creation_date
(
zathura_annotation_t
*
annotation
);
/**
* Sets the creation date of the annotation
*
* @param annotation The annotation
* @param creation_date The creation date
*/
void
zathura_annotation_markup_set_creation_date
(
zathura_annotation_t
*
annotation
,
time_t
creation_date
);
/**
* Returns the defined icon of the text annotation
*
* @param annotation The annotation
* @return The set icon of the text annotation
*/
zathura_annotation_text_icon_t
zathura_annotation_text_get_icon
(
zathura_annotation_t
*
annotation
);
/**
* Sets the icon of the text annotation
*
* @param annotation The annotation
* @param icon The icon of the text annotation
*/
void
zathura_annotation_text_set_icon
(
zathura_annotation_t
*
annotation
,
zathura_annotation_text_icon_t
icon
);
/**
* Returns the state of the text annotation
*
* @param annotation The annotation
* @return The state of the text annotation
*/
zathura_annotation_text_state_t
zathura_annotation_text_get_state
(
zathura_annotation_t
*
annotation
);
/**
* Sets the state of the text annotation
*
* @param annotation The annotation
* @param state The new state of the text annotation
*/
void
zathura_annotation_text_set_state
(
zathura_annotation_t
*
annotation
,
zathura_annotation_text_state_t
state
);
/**
* Returns whether the text annotation is open or not
*
* @param annotation The annotation
* @return true if the annotation is open otherwise false
*/
bool
zathura_annotation_text_get_open_status
(
zathura_annotation_t
*
annotation
);
/**
* Sets the text annotation open status
*
* @param annotation The annotation
* @param opened The new open status
*/
void
zathura_annotation_text_set_open_status
(
zathura_annotation_t
*
annotation
,
bool
opened
);
/**
* Creates a new annotation popup
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment