summaryrefslogtreecommitdiff
path: root/src/math-equation.h
blob: 954334c6276bf888740410c76c05be8f63c86bd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
 * Copyright (C) 1987-2008 Sun Microsystems, Inc. All Rights Reserved.
 * Copyright (C) 2008-2011 Robert Ancell
 *
 * 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 http://www.gnu.org/copyleft/gpl.html the full text of the
 * license.
 */

#ifndef MATH_EQUATION_H
#define MATH_EQUATION_H

#include <glib-object.h>
#include <gtk/gtk.h>

#include "mp.h"
#include "math-variables.h"
#include "mp-serializer.h"

G_BEGIN_DECLS

#define MATH_TYPE_EQUATION (math_equation_get_type ())
#define MATH_EQUATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), math_equation_get_type(), MathEquation))
#define MATH_EQUATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATH_TYPE_EQUATION, MathEquationClass))

typedef struct MathEquationPrivate MathEquationPrivate;

typedef struct
{
    GtkTextBuffer parent_instance;
    MathEquationPrivate *priv;
} MathEquation;

typedef struct
{
    GtkTextBufferClass parent_class;
} MathEquationClass;

typedef enum {
    NORMAL,
    SUPERSCRIPT,
    SUBSCRIPT
} NumberMode;

GType math_equation_get_type(void);
MathEquation *math_equation_new(void);

MathVariables *math_equation_get_variables(MathEquation *equation);

gunichar math_equation_get_digit_text(MathEquation *equation, guint digit);

void math_equation_set_status(MathEquation *equation, const gchar *status);
const gchar *math_equation_get_status(MathEquation *equation);

gboolean math_equation_is_empty(MathEquation *equation);
gboolean math_equation_is_result(MathEquation *equation);
gchar *math_equation_get_display(MathEquation *equation);
gchar *math_equation_get_equation(MathEquation *equation);
gboolean math_equation_get_number(MathEquation *equation, MPNumber *z);

void math_equation_set_number_mode(MathEquation *equation, NumberMode mode);
NumberMode math_equation_get_number_mode(MathEquation *equation);

void math_equation_set_accuracy(MathEquation *equation, gint accuracy);
gint math_equation_get_accuracy(MathEquation *equation);

void math_equation_set_show_thousands_separators(MathEquation *equation, gboolean visible);
gboolean math_equation_get_show_thousands_separators(MathEquation *equation);

void math_equation_set_show_trailing_zeroes(MathEquation *equation, gboolean visible);
gboolean math_equation_get_show_trailing_zeroes(MathEquation *equation);

void math_equation_set_number_format(MathEquation *equation, MpDisplayFormat format);
MpDisplayFormat math_equation_get_number_format(MathEquation *equation);

void math_equation_set_base(MathEquation *equation, gint base);
gint math_equation_get_base(MathEquation *equation);

void math_equation_set_word_size(MathEquation *equation, gint word_size);
gint math_equation_get_word_size(MathEquation *equation);

void math_equation_set_angle_units(MathEquation *equation, MPAngleUnit angle_unit);
MPAngleUnit math_equation_get_angle_units(MathEquation *equation);

void math_equation_set_source_currency(MathEquation *equation, const gchar *currency);
const gchar *math_equation_get_source_currency(MathEquation *equation);

void math_equation_set_target_currency(MathEquation *equation, const gchar *currency);
const gchar *math_equation_get_target_currency(MathEquation *equation);

void math_equation_set_source_units(MathEquation *equation, const gchar *units);
const gchar *math_equation_get_source_units(MathEquation *equation);

void math_equation_set_target_units(MathEquation *equation, const gchar *units);
const gchar *math_equation_get_target_units(MathEquation *equation);

gboolean math_equation_in_solve(MathEquation *equation);

const MPNumber *math_equation_get_answer(MathEquation *equation);
MpSerializer *math_equation_get_serializer(MathEquation *equation);

void math_equation_copy(MathEquation *equation);
void math_equation_paste(MathEquation *equation);
void math_equation_undo(MathEquation *equation);
void math_equation_redo(MathEquation *equation);
void math_equation_store(MathEquation *equation, const gchar *name);
void math_equation_recall(MathEquation *equation, const gchar *name);
void math_equation_set(MathEquation *equation, const gchar *text);
void math_equation_set_number(MathEquation *equation, const MPNumber *x);
void math_equation_insert(MathEquation *equation, const gchar *text);
void math_equation_insert_digit(MathEquation *equation, guint digit);
void math_equation_insert_numeric_point(MathEquation *equation);
void math_equation_insert_number(MathEquation *equation, const MPNumber *x);
void math_equation_insert_subtract(MathEquation *equation);
void math_equation_insert_exponent(MathEquation *equation);
void math_equation_solve(MathEquation *equation);
void math_equation_factorize(MathEquation *equation);
void math_equation_delete(MathEquation *equation);
void math_equation_backspace(MathEquation *equation);
void math_equation_clear(MathEquation *equation);
void math_equation_shift(MathEquation *equation, gint count);
void math_equation_toggle_bit(MathEquation *equation, guint bit);

G_END_DECLS

#endif /* MATH_EQUATION_H */