Remove obsoleted and unused pieces

This commit is contained in:
Dorota Czaplejewicz
2019-08-16 10:56:37 +00:00
parent 524040cf00
commit 2e201b67a7
6 changed files with 2 additions and 248 deletions

View File

@ -83,21 +83,10 @@ struct _EekKeyboardClass
gpointer set_symbol_index;
gpointer get_symbol_index;
/*< public >*/
EekKey *(* find_key_by_name) (EekKeyboard *self,
const gchar *name);
/*< private >*/
/* obsolete members moved to EekElement */
gpointer symbol_index_changed;
/*< public >*/
/* signals */
void (* key_locked) (EekKeyboard *self,
EekKey *key);
void (* key_unlocked) (EekKeyboard *self,
EekKey *key);
/*< private >*/
/* padding */
gpointer pdummy[21];
@ -154,8 +143,6 @@ void eek_keyboard_set_size
gdouble width,
gdouble height);
EekSection *eek_keyboard_create_section
(EekKeyboard *keyboard);
struct squeek_row *eek_keyboard_get_row(EekKeyboard *keyboard,
struct squeek_button *button);
struct squeek_button *eek_keyboard_find_button_by_name(LevelKeyboard *keyboard,

View File

@ -83,10 +83,6 @@ void eek_renderer_set_scale_factor (EekRenderer *renderer,
PangoLayout *eek_renderer_create_pango_layout
(EekRenderer *renderer);
void eek_renderer_render_key_label (EekRenderer *renderer,
PangoLayout *layout,
EekKey *key);
void eek_renderer_render_key_outline
(EekRenderer *renderer,
cairo_t *cr,

View File

@ -18,152 +18,10 @@
* 02110-1301 USA
*/
/**
* SECTION:eek-section
* @short_description: Base class of a section
* @see_also: #EekKey
*
* The #EekSectionClass class represents a section, which consists
* of one or more keys of the #EekKeyClass class.
*/
#include "config.h"
#include <string.h>
#include "eek-keyboard.h"
#include "layout.h"
#include "eek-section.h"
enum {
PROP_0,
PROP_ANGLE,
PROP_LAST
};
typedef struct _EekSectionPrivate
{
struct squeek_row *row;
} EekSectionPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (EekSection, eek_section, EEK_TYPE_ELEMENT)
static void
eek_section_finalize (GObject *object)
{
G_OBJECT_CLASS (eek_section_parent_class)->finalize (object);
}
static void
eek_section_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
switch (prop_id) {
case PROP_ANGLE:
eek_section_set_angle (EEK_SECTION(object),
g_value_get_int (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
eek_section_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
switch (prop_id) {
case PROP_ANGLE:
g_value_set_int (value, eek_section_get_angle (EEK_SECTION(object)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
eek_section_class_init (EekSectionClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
/* signals */
gobject_class->set_property = eek_section_set_property;
gobject_class->get_property = eek_section_get_property;
gobject_class->finalize = eek_section_finalize;
/**
* EekSection:angle:
*
* The rotation angle of #EekSection.
*/
pspec = g_param_spec_int ("angle",
"Angle",
"Rotation angle of the section",
-360, 360, 0,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class,
PROP_ANGLE,
pspec);
}
static void
eek_section_init (EekSection *self)
{
EekSectionPrivate *priv = eek_section_get_instance_private (self);
priv->row = squeek_row_new(0);
}
/**
* eek_section_set_angle:
* @section: an #EekSection
* @angle: rotation angle
*
* Set rotation angle of @section to @angle.
*/
void
eek_section_set_angle (EekSection *section,
gint angle)
{
g_return_if_fail (EEK_IS_SECTION(section));
EekSectionPrivate *priv = eek_section_get_instance_private (section);
squeek_row_set_angle(priv->row, angle);
}
/**
* eek_section_get_angle:
* @section: an #EekSection
*
* Get rotation angle of @section.
*/
gint
eek_section_get_angle (EekSection *section)
{
g_return_val_if_fail (EEK_IS_SECTION(section), -1);
EekSectionPrivate *priv = eek_section_get_instance_private (section);
return squeek_row_get_angle(priv->row);
}
struct squeek_row *
eek_section_get_row (EekSection *section)
{
g_return_val_if_fail (EEK_IS_SECTION(section), NULL);
EekSectionPrivate *priv = eek_section_get_instance_private (section);
return priv->row;
}
EekBounds eek_get_outline_size(LevelKeyboard *keyboard, uint32_t oref) {
EekOutline *outline = level_keyboard_get_outline (keyboard, oref);
if (outline && outline->num_points > 0) {
@ -197,16 +55,6 @@ EekBounds eek_get_outline_size(LevelKeyboard *keyboard, uint32_t oref) {
return bounds;
}
void eek_section_set_bounds(EekSection *section, EekBounds bounds) {
EekSectionPrivate *priv = eek_section_get_instance_private (section);
squeek_row_set_bounds(priv->row, bounds);
}
EekBounds eek_section_get_bounds(EekSection *section) {
EekSectionPrivate *priv = eek_section_get_instance_private (section);
return squeek_row_get_bounds(priv->row);
}
void
eek_row_place_buttons(struct squeek_row *row, LevelKeyboard *keyboard)
{
@ -220,22 +68,3 @@ eek_row_place_buttons(struct squeek_row *row, LevelKeyboard *keyboard)
row_bounds.height = row_size.height;
squeek_row_set_bounds(row, row_bounds);
}
void eek_section_foreach (EekSection *section,
ButtonCallback func,
gpointer user_data) {
EekSectionPrivate *priv = eek_section_get_instance_private (section);
squeek_row_foreach(priv->row, func, user_data);
}
gboolean eek_section_find(EekSection *section,
struct squeek_button *button) {
EekSectionPrivate *priv = eek_section_get_instance_private (section);
return squeek_row_contains(priv->row, button) != 0;
}
struct squeek_button *eek_section_find_key(EekSection *section,
struct squeek_key *key) {
EekSectionPrivate *priv = eek_section_get_instance_private (section);
return squeek_row_find_key(priv->row, key);
}

View File

@ -25,66 +25,12 @@
#ifndef EEK_SECTION_H
#define EEK_SECTION_H 1
/* Contains row-related functions that couldn't be done in Rust easily. */
#include <glib-object.h>
#include "eek-element.h"
#include "eek-types.h"
#include "eek-keyboard.h"
#include "src/keyboard.h"
#include "src/layout.h"
G_BEGIN_DECLS
#define EEK_TYPE_SECTION (eek_section_get_type())
G_DECLARE_DERIVABLE_TYPE(EekSection, eek_section, EEK, SECTION, EekElement)
/**
* EekSectionClass:
* @get_n_rows: virtual function for getting the number of rows in the section
* @add_row: virtual function for adding a new row to the section
* @get_row: virtual function for accessing a row in the section
* @create_key: virtual function for creating key in the section
* @key_pressed: class handler for #EekSection::key-pressed signal
* @key_released: class handler for #EekSection::key-released signal
* @key_locked: class handler for #EekSection::key-locked signal
* @key_unlocked: class handler for #EekSection::key-unlocked signal
* @key_cancelled: class handler for #EekSection::key-cancelled signal
*/
struct _EekSectionClass
{
/*< private >*/
EekElementClass parent_class;
/*< private >*/
/* padding */
gpointer pdummy[19];
};
GType eek_section_get_type (void) G_GNUC_CONST;
void eek_section_set_angle (EekSection *section,
gint angle);
gint eek_section_get_angle (EekSection *section);
struct squeek_row *
eek_section_get_row (EekSection *section);
struct squeek_button *eek_section_create_button (EekSection *section,
const gchar *name,
guint keycode, guint oref);
struct squeek_button *eek_section_create_button_with_state(EekSection *self,
const gchar *name,
struct squeek_button *source);
void
eek_row_place_buttons(struct squeek_row *row, LevelKeyboard *keyboard);
void eek_section_foreach (EekSection *section,
ButtonCallback func,
gpointer user_data);
gboolean eek_section_find(EekSection *section,
struct squeek_button *button);
struct squeek_button *eek_section_find_key(EekSection *section,
struct squeek_key *key);
void eek_section_set_bounds(EekSection *section, EekBounds bounds);
EekBounds eek_section_get_bounds(EekSection *section);
G_END_DECLS
#endif /* EEK_SECTION_H */

View File

@ -134,9 +134,6 @@ typedef enum
#define EEK_INVALID_KEYCODE (0)
typedef struct _EekElement EekElement;
typedef struct _EekContainer EekContainer;
typedef struct _EekKey EekKey;
typedef struct _EekSection EekSection;
typedef struct _EekKeyboard EekKeyboard;
typedef struct _EekSymbol EekSymbol;
typedef struct _EekText EekText;