2013-09-08 11:39:44 +00:00
|
|
|
#include <stdlib.h>
|
2013-07-27 21:26:12 +00:00
|
|
|
#include <glib.h>
|
2013-09-03 16:10:12 +00:00
|
|
|
#include <gtk/gtk.h>
|
2013-09-07 21:17:59 +00:00
|
|
|
#include <glib/gi18n.h>
|
2013-07-14 12:40:26 +00:00
|
|
|
|
2013-09-08 11:38:48 +00:00
|
|
|
#include <libgd/gd.h>
|
|
|
|
|
2013-09-06 09:34:24 +00:00
|
|
|
#include <swe-glib.h>
|
2013-07-14 12:40:26 +00:00
|
|
|
|
2013-09-08 11:39:44 +00:00
|
|
|
#include "ag-app.h"
|
2013-09-08 21:02:05 +00:00
|
|
|
#include "ag-window.h"
|
2013-09-08 11:39:44 +00:00
|
|
|
|
2013-09-06 14:28:00 +00:00
|
|
|
#define UI_FILE PKGDATADIR "/astrognome.ui"
|
2013-09-03 16:10:12 +00:00
|
|
|
|
|
|
|
GtkBuilder *builder;
|
2013-09-08 11:39:44 +00:00
|
|
|
static gboolean option_quit;
|
|
|
|
static gboolean option_version;
|
|
|
|
|
|
|
|
static GOptionEntry options[] = {
|
|
|
|
{ "version", 'v', 0, G_OPTION_ARG_NONE, &option_version, N_("Display version and exit"), NULL },
|
|
|
|
{ "quit", 'q', 0, G_OPTION_ARG_NONE, &option_quit, N_("Quit any running Astrognome"), NULL },
|
|
|
|
{ NULL }
|
|
|
|
};
|
2013-07-14 12:40:26 +00:00
|
|
|
|
2013-07-26 14:53:08 +00:00
|
|
|
const char *moonStateName[] = {
|
|
|
|
"New Moon",
|
|
|
|
"Waxing Crescent Moon",
|
|
|
|
"Waxing Half Moon",
|
|
|
|
"Waxing Gibbous Moon",
|
|
|
|
"Full Moon",
|
|
|
|
"Waning Gibbous Moon",
|
|
|
|
"Waning Half Moon",
|
|
|
|
"Waning Crescent Moon",
|
|
|
|
"Dark Moon"
|
|
|
|
};
|
|
|
|
|
2013-09-03 16:10:12 +00:00
|
|
|
struct print_data {
|
|
|
|
GString *line;
|
|
|
|
GswePlanet planet;
|
|
|
|
};
|
|
|
|
|
2013-08-21 15:07:57 +00:00
|
|
|
void
|
2013-09-03 16:10:12 +00:00
|
|
|
print_house_cusp(GsweHouseData *house_data, GString *line)
|
2013-08-21 15:07:57 +00:00
|
|
|
{
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(line, "House %d: %s (%f)\n", house_data->house, house_data->sign->name, house_data->cusp_position);
|
2013-08-21 15:07:57 +00:00
|
|
|
}
|
|
|
|
|
2013-08-22 21:39:15 +00:00
|
|
|
void
|
2013-09-03 16:10:12 +00:00
|
|
|
print_aspects(GsweAspectData *aspect_data, struct print_data *data)
|
2013-08-22 21:39:15 +00:00
|
|
|
{
|
2013-09-03 16:10:12 +00:00
|
|
|
GswePlanetData *other_planet = (aspect_data->planet1->planet_id == data->planet) ? aspect_data->planet2 : aspect_data->planet1;
|
2013-08-22 21:39:15 +00:00
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
if (aspect_data->aspect != GSWE_ASPECT_NONE) {
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data->line, " %s: %s (±%f%%)\n", other_planet->planet_info->name, aspect_data->aspect_info->name, aspect_data->difference);
|
2013-08-22 21:39:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-09-03 16:10:12 +00:00
|
|
|
print_mirrorpoints(GsweMirrorData *mirror_data, struct print_data *data)
|
2013-09-03 09:40:57 +00:00
|
|
|
{
|
2013-09-03 16:10:12 +00:00
|
|
|
GswePlanetData *other_planet = (mirror_data->planet1->planet_id == data->planet) ? mirror_data->planet2 : mirror_data->planet1;
|
2013-09-03 09:40:57 +00:00
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
if (mirror_data->mirror != GSWE_MIRROR_NONE) {
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data->line, " %s: %s (±%f°)\n", other_planet->planet_info->name, mirror_data->mirror_info->name, mirror_data->difference);
|
2013-09-03 09:40:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-03 16:10:12 +00:00
|
|
|
void
|
|
|
|
create_new_chart(void)
|
|
|
|
{
|
|
|
|
guint year,
|
|
|
|
month,
|
|
|
|
day,
|
|
|
|
hour,
|
|
|
|
minute,
|
|
|
|
second;
|
|
|
|
gdouble longitude,
|
|
|
|
latitude,
|
|
|
|
altitude,
|
|
|
|
time_zone;
|
2013-09-01 20:30:51 +00:00
|
|
|
GsweTimestamp *timestamp;
|
|
|
|
GsweMoment *moment;
|
2013-09-03 16:10:12 +00:00
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
GtkWidget *view;
|
|
|
|
GtkWidget *label;
|
2013-09-02 21:14:30 +00:00
|
|
|
GswePlanetData *planet_data;
|
2013-09-03 16:10:12 +00:00
|
|
|
GsweMoonPhaseData *moon_phase;
|
2013-09-03 11:14:28 +00:00
|
|
|
GList *aspects,
|
|
|
|
*mirrorpoints;
|
2013-09-03 16:10:12 +00:00
|
|
|
GtkWidget *scrolled_window;
|
|
|
|
struct print_data data;
|
|
|
|
|
|
|
|
gtk_calendar_get_date(GTK_CALENDAR(gtk_builder_get_object(builder, "calendar_new_date")), &year, &month, &day);
|
|
|
|
month++;
|
|
|
|
hour = (guint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "spin_new_hour")));
|
|
|
|
minute = (guint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "spin_new_minute")));
|
|
|
|
second = (guint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "spin_new_second")));
|
|
|
|
longitude = gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "spin_new_longitude")));
|
|
|
|
latitude = gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "spin_new_latitude")));
|
|
|
|
// TODO: these should be real values (at least time_zone)!
|
|
|
|
time_zone = 1.0;
|
|
|
|
altitude = 200.0;
|
|
|
|
|
|
|
|
timestamp = gswe_timestamp_new_from_gregorian_full(year, month, day, hour, minute, second, 0, time_zone);
|
|
|
|
// TODO: Make house system configurable
|
|
|
|
moment = gswe_moment_new_full(timestamp, longitude, latitude, altitude, GSWE_HOUSE_SYSTEM_PLACIDUS);
|
|
|
|
// TODO: Make planet list customizable
|
2013-09-02 21:04:05 +00:00
|
|
|
gswe_moment_add_all_planets(moment);
|
2013-07-14 12:40:26 +00:00
|
|
|
|
2013-09-03 16:10:12 +00:00
|
|
|
data.line = g_string_sized_new(300);
|
2013-07-14 12:40:26 +00:00
|
|
|
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, "Date: %02d.%02d.%d at %02d:%02d:%02d, at %f, %f\n", year, month, day, hour, minute, second, longitude, latitude);
|
|
|
|
g_string_append_printf(data.line, "\nHOUSES\n======\n\n");
|
|
|
|
g_list_foreach(gswe_moment_get_house_cusps(moment), (GFunc)print_house_cusp, data.line);
|
|
|
|
g_string_append_printf(data.line, "\nPLANETS AND POINTS\n==================\n\n");
|
2013-07-14 12:40:26 +00:00
|
|
|
|
2013-09-02 21:14:30 +00:00
|
|
|
// Ascendent
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_ASCENDENT);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_ASCENDENT;
|
|
|
|
g_string_append_printf(data.line, "%s: %s (%f)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->position);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_ASCENDENT);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_ASCENDENT);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Midheaven
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_MC);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_MC;
|
|
|
|
g_string_append_printf(data.line, "%s: %s (%f)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->position);
|
2013-08-19 22:35:47 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_MC);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_MC);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Vertex
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_VERTEX);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_VERTEX;
|
|
|
|
g_string_append_printf(data.line, "%s: %s (%f)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->position);
|
2013-07-14 12:40:26 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_VERTEX);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_VERTEX);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Sun
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_SUN);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_SUN;
|
|
|
|
g_string_append_printf(data.line, "%s: %s, House: %d (%f%s)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-08-24 12:52:59 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_SUN);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_SUN);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Moon
|
|
|
|
moon_phase = gswe_moment_get_moon_phase(moment);
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_MOON);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_MOON;
|
|
|
|
g_string_append_printf(data.line, "%s: %s (%.2f%% visibility), %s, House: %d (%f%s)\n", planet_data->planet_info->name, moonStateName[moon_phase->phase], moon_phase->illumination, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-07-14 12:40:26 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_MOON);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_MOON);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Mercury
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_MERCURY);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_MERCURY;
|
|
|
|
g_string_append_printf(data.line, "%s: %s, House: %d (%f%s)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-07-14 16:13:41 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_MERCURY);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_MERCURY);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Venus
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_VENUS);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_VENUS;
|
|
|
|
g_string_append_printf(data.line, "%s: %s, House: %d (%f%s)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-07-14 16:13:41 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_VENUS);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_VENUS);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Mars
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_MARS);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_MARS;
|
|
|
|
g_string_append_printf(data.line, "%s: %s, House: %d (%f%s)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-07-14 16:13:41 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_MARS);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_MARS);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Jupiter
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_JUPITER);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_JUPITER;
|
|
|
|
g_string_append_printf(data.line, "%s: %s, House: %d (%f%s)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-07-14 16:13:41 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_JUPITER);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_JUPITER);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Saturn
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_SATURN);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_SATURN;
|
|
|
|
g_string_append_printf(data.line, "%s: %s, House: %d (%f%s)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-07-14 16:13:41 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_SATURN);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_SATURN);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Uranus
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_URANUS);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_URANUS;
|
|
|
|
g_string_append_printf(data.line, "%s: %s, House: %d (%f%s)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-07-14 16:13:41 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_URANUS);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_URANUS);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Neptune
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_NEPTUNE);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_NEPTUNE;
|
|
|
|
g_string_append_printf(data.line, "%s: %s, House: %d (%f%s)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-07-14 16:13:41 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_NEPTUNE);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_NEPTUNE);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Pluto
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_PLUTO);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_PLUTO;
|
|
|
|
g_string_append_printf(data.line, "%s: %s, House: %d (%f%s)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-07-26 15:06:43 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_PLUTO);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_PLUTO);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-07-26 15:06:43 +00:00
|
|
|
|
2013-09-02 21:14:30 +00:00
|
|
|
// Mean node
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_MOON_NODE);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_MOON_NODE;
|
|
|
|
g_string_append_printf(data.line, "%s: %s, House: %d (%f%s)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-07-26 15:06:43 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_MOON_NODE);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_MOON_NODE);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Mean apogee
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_MOON_APOGEE);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_MOON_APOGEE;
|
|
|
|
g_string_append_printf(data.line, "%s: %s, House: %d (%f%s)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-07-14 16:13:41 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_MOON_APOGEE);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_MOON_APOGEE);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Chiron
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_CHIRON);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_CHIRON;
|
|
|
|
g_string_append_printf(data.line, "%s: %s, House: %d (%f%s)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-09-02 21:14:30 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_CHIRON);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_CHIRON);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Ceres
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_CERES);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_CERES;
|
|
|
|
g_string_append_printf(data.line, "%s: %s, House: %d (%f%s)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-07-14 12:40:26 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_CERES);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_CERES);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Pallas
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_PALLAS);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_PALLAS;
|
|
|
|
g_string_append_printf(data.line, "%s: %s, House: %d (%f%s)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-07-26 23:31:19 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_PALLAS);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_PALLAS);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Juno
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_JUNO);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_JUNO;
|
|
|
|
g_string_append_printf(data.line, "%s: %s, House: %d (%f%s)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-07-26 23:31:19 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_JUNO);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_JUNO);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-09-02 21:14:30 +00:00
|
|
|
|
|
|
|
// Vesta
|
|
|
|
planet_data = gswe_moment_get_planet(moment, GSWE_PLANET_VESTA);
|
2013-09-03 16:10:12 +00:00
|
|
|
data.planet = GSWE_PLANET_VESTA;
|
|
|
|
g_string_append_printf(data.line, "%s: %s, House: %d (%f%s)\n", planet_data->planet_info->name, planet_data->sign->name, planet_data->house, planet_data->position, (planet_data->retrograde) ? ", retrograde" : "");
|
2013-07-26 23:31:19 +00:00
|
|
|
|
2013-09-03 09:40:57 +00:00
|
|
|
aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_VESTA);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Aspects:\n");
|
|
|
|
g_list_foreach(aspects, (GFunc)print_aspects, &data);
|
2013-09-03 09:40:57 +00:00
|
|
|
g_list_free(aspects);
|
|
|
|
|
2013-09-03 11:14:28 +00:00
|
|
|
mirrorpoints = gswe_moment_get_all_planet_mirrorpoints(moment, GSWE_PLANET_VESTA);
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, " Antiscia:\n");
|
|
|
|
g_list_foreach(mirrorpoints, (GFunc)print_mirrorpoints, &data);
|
2013-09-03 11:14:28 +00:00
|
|
|
g_list_free(mirrorpoints);
|
2013-08-19 22:36:55 +00:00
|
|
|
|
2013-09-03 16:10:12 +00:00
|
|
|
g_string_append_printf(data.line, "\nELEMENTS\n========\n\n");
|
|
|
|
|
|
|
|
g_string_append_printf(data.line, "Fire: %d\n", gswe_moment_get_element_points(moment, GSWE_ELEMENT_FIRE));
|
|
|
|
g_string_append_printf(data.line, "Earth: %d\n", gswe_moment_get_element_points(moment, GSWE_ELEMENT_EARTH));
|
|
|
|
g_string_append_printf(data.line, "Air: %d\n", gswe_moment_get_element_points(moment, GSWE_ELEMENT_AIR));
|
|
|
|
g_string_append_printf(data.line, "Water: %d\n", gswe_moment_get_element_points(moment, GSWE_ELEMENT_WATER));
|
|
|
|
|
|
|
|
g_string_append_printf(data.line, "\nQUALITIES\n=========\n\n");
|
|
|
|
|
|
|
|
g_string_append_printf(data.line, "Cardinal: %d\n", gswe_moment_get_quality_points(moment, GSWE_QUALITY_CARDINAL));
|
|
|
|
g_string_append_printf(data.line, "Fix: %d\n", gswe_moment_get_quality_points(moment, GSWE_QUALITY_FIX));
|
|
|
|
g_string_append_printf(data.line, "Mutable: %d\n", gswe_moment_get_quality_points(moment, GSWE_QUALITY_MUTABLE));
|
|
|
|
|
|
|
|
|
|
|
|
buffer = gtk_text_buffer_new(NULL);
|
|
|
|
gtk_text_buffer_insert_at_cursor(buffer, data.line->str, data.line->len);
|
|
|
|
view = gtk_text_view_new_with_buffer(buffer);
|
|
|
|
scrolled_window = gtk_scrolled_window_new(NULL, NULL);
|
|
|
|
gtk_container_add(GTK_CONTAINER(scrolled_window), view);
|
|
|
|
|
|
|
|
label = gtk_label_new(gtk_entry_get_text(GTK_ENTRY(gtk_builder_get_object(builder, "entry_new_name"))));
|
|
|
|
gtk_notebook_append_page(GTK_NOTEBOOK(gtk_builder_get_object(builder, "notebook_chartlist")), scrolled_window, label);
|
|
|
|
gtk_widget_show_all(scrolled_window);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
action_new_activate_cb(GtkAction *action, gpointer user_data)
|
|
|
|
{
|
|
|
|
gboolean cont = TRUE;
|
|
|
|
GtkDialog *dialog_new = GTK_DIALOG(gtk_builder_get_object(builder, "dialog_new"));
|
|
|
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(dialog_new), "New chart");
|
|
|
|
|
|
|
|
while (cont) {
|
|
|
|
gint response = gtk_dialog_run(dialog_new);
|
|
|
|
|
|
|
|
switch (response) {
|
|
|
|
case GTK_RESPONSE_OK:
|
|
|
|
g_print("OK\n");
|
|
|
|
|
|
|
|
{
|
|
|
|
gint name_length = gtk_entry_get_text_length(GTK_ENTRY(gtk_builder_get_object(builder, "entry_new_name")));
|
|
|
|
gboolean lat_selected = (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "radio_new_north"))) || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "radio_new_south"))));
|
|
|
|
gboolean long_selected = (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "radio_new_east"))) || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "radio_new_west"))));
|
|
|
|
|
|
|
|
if ((name_length > 0) && (lat_selected == TRUE) && (long_selected == TRUE)) {
|
|
|
|
cont = FALSE;
|
|
|
|
|
|
|
|
create_new_chart();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_RESPONSE_CANCEL:
|
|
|
|
case GTK_RESPONSE_DELETE_EVENT:
|
|
|
|
cont = FALSE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_warning("Unknown respons from dialog!");
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_hide(GTK_WIDGET(dialog_new));
|
|
|
|
}
|
|
|
|
|
2013-09-08 11:39:44 +00:00
|
|
|
static void
|
|
|
|
run_action(AgApp *app, gboolean is_remote)
|
|
|
|
{
|
|
|
|
if (option_quit) {
|
|
|
|
ag_app_quit(app);
|
|
|
|
} else if (is_remote) {
|
|
|
|
ag_app_raise(app);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-07 21:17:59 +00:00
|
|
|
static void
|
|
|
|
application_activate_cb(GtkApplication *app, gpointer user_data)
|
2013-09-03 16:10:12 +00:00
|
|
|
{
|
2013-09-08 21:02:05 +00:00
|
|
|
ag_app_new_window(AG_APP(app));
|
|
|
|
run_action(AG_APP(app), FALSE);
|
2013-09-07 21:17:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
gint status;
|
2013-09-08 11:39:44 +00:00
|
|
|
AgApp *app;
|
|
|
|
GError *err = NULL;
|
|
|
|
|
|
|
|
setlocale(LC_ALL, "");
|
|
|
|
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
|
|
|
|
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
|
|
|
|
textdomain(GETTEXT_PACKAGE);
|
2013-09-07 21:17:59 +00:00
|
|
|
|
|
|
|
gswe_init();
|
|
|
|
|
2013-09-08 11:39:44 +00:00
|
|
|
if (!gtk_init_with_args(&argc, &argv, NULL, options, GETTEXT_PACKAGE, &err)) {
|
|
|
|
g_printerr("%s\n", err->message);
|
|
|
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (option_version) {
|
|
|
|
g_print("%s\n", PACKAGE_STRING);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
app = ag_app_new();
|
2013-09-07 21:17:59 +00:00
|
|
|
g_signal_connect(app, "activate", G_CALLBACK(application_activate_cb), NULL);
|
2013-09-08 11:39:44 +00:00
|
|
|
g_application_set_default(G_APPLICATION(app));
|
|
|
|
|
|
|
|
if (!g_application_register(G_APPLICATION(app), NULL, &err)) {
|
|
|
|
g_printerr("Couldn't register Astrognome instance: '%s'\n", (err) ? err->message : "");
|
|
|
|
g_object_unref(app);
|
|
|
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g_application_get_is_remote(G_APPLICATION(app))) {
|
|
|
|
run_action(app, TRUE);
|
|
|
|
g_object_unref(app);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
2013-09-07 21:17:59 +00:00
|
|
|
|
|
|
|
status = g_application_run(G_APPLICATION(app), argc, argv);
|
|
|
|
|
|
|
|
g_object_unref(app);
|
2013-08-19 21:36:54 +00:00
|
|
|
|
2013-09-07 21:17:59 +00:00
|
|
|
return status;
|
2013-07-14 12:40:26 +00:00
|
|
|
}
|
|
|
|
|