bin_familia_SOURCES = \
src/dialogs/about_dialog.c \
src/dialogs/openfile_dialog.c \
- src/viewport/drawing_area.c \
+ src/ui/drawing_area.c \
+ src/ui/scrollbars.c \
src/storage/storage.c \
src/storage/individual.c \
src/storage/family.c \
src/storage/positions.c \
src/math/positions.c \
+ src/math/camera.c \
src/graphics/individual.c \
+ src/graphics/family.c \
src/gedcom/familia_gedcom.c \
src/memory_stack.c \
src/gui.c \
AC_INIT([Familia Lignum], [0.1.2-reboot], [bugz@dlugolecki.net.pl], [familia], [http://dlugolecki.net.pl/software/familia/])
+AC_CANONICAL_SYSTEM
AC_PREREQ([2.59])
AM_INIT_AUTOMAKE([1.10 -Wall])
AC_CONFIG_HEADERS([config.h])
<accelerator key="q" modifiers="GDK_CONTROL_MASK"/>
</child>
</object>
+ <object class="GtkAdjustment" id="horizontal-adjustment">
+ <property name="lower">-100</property>
+ <property name="upper">100</property>
+ <property name="step_increment">0.10000000000000001</property>
+ <property name="page_increment">10</property>
+ <signal name="changed" handler="horizontal_scrollbar_changed" swapped="no"/>
+ <signal name="value-changed" handler="horizontal_scrollbar_value_changed" swapped="no"/>
+ </object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can_focus">False</property>
<property name="stock">gtk-missing-image</property>
</object>
- <object class="GtkWindow" id="logger-window">
- <property name="can_focus">False</property>
- <property name="window_position">center</property>
- <child>
- <object class="GtkTextView" id="textview">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- </object>
- </child>
- </object>
<object class="GtkWindow" id="main-window">
<property name="can_focus">False</property>
<property name="default_width">400</property>
</packing>
</child>
<child>
- <object class="GtkViewport" id="viewport">
+ <object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkBox" id="box3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkDrawingArea" id="drawing-area">
+ <property name="width_request">450</property>
+ <property name="height_request">240</property>
+ <property name="visible">True</property>
+ <property name="app_paintable">True</property>
+ <property name="can_focus">False</property>
+ <signal name="draw" handler="drawing_area_draw" swapped="no"/>
+ <signal name="configure-event" handler="drawing_area_configure_event" swapped="no"/>
+ <signal name="unrealize" handler="drawing_area_unrealize" swapped="no"/>
+ <signal name="realize" handler="drawing_area_realize" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrollbar" id="vertical-scrollbar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="adjustment">vertical-adjustment</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
- <object class="GtkDrawingArea" id="drawing-area">
+ <object class="GtkScrollbar" id="horizontal-scrollbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <signal name="draw" handler="drawing_area_draw" swapped="no"/>
- <signal name="configure-event" handler="drawing_area_configure_event" swapped="no"/>
- <signal name="unrealize" handler="drawing_area_unrealize" swapped="no"/>
- <signal name="realize" handler="drawing_area_realize" swapped="no"/>
+ <property name="adjustment">horizontal-adjustment</property>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
<packing>
<action-widget response="-5">openfiledialog-ok</action-widget>
</action-widgets>
</object>
+ <object class="GtkAdjustment" id="vertical-adjustment">
+ <property name="lower">-100</property>
+ <property name="upper">100</property>
+ <property name="step_increment">0.10000000000000001</property>
+ <property name="page_increment">10</property>
+ <signal name="changed" handler="vertical_scrollbar_changed" swapped="no"/>
+ <signal name="value-changed" handler="vertical_scrollbar_value_changed" swapped="no"/>
+ </object>
</interface>
--- /dev/null
+/****************************************************************************
+ * Familia Lignum - Genealogical program *
+ * Copyright (C) 2011-2012 Rafał Długołęcki <rafal@dlugolecki.net.pl> *
+ * *
+ * 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; version 2 of the License. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
+ * *
+ ****************************************************************************/
+
+#ifndef _FAMILIA_GRAPHICS_CONSTANTS_H
+#define _FAMILIA_GRAPHICS_CONSTANTS_H
+
+#define GR_IND_RADIUS 0.5
+#define GR_FAM_RADIUS 0.4
+
+#endif /* _FAMILIA_GRAPHICS_CONSTANTS_H */
--- /dev/null
+/****************************************************************************
+ * Familia Lignum - Genealogical program *
+ * Copyright (C) 2011-2012 Rafał Długołęcki <rafal@dlugolecki.net.pl> *
+ * *
+ * 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; version 2 of the License. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
+ * *
+ ****************************************************************************/
+
+#ifndef _FAMILIA_GRAPHICS_INDIVIDUAL_H
+#define _FAMILIA_GRAPHICS_INDIVIDUAL_H
+
+#include <GL/gl.h>
+#include <GL/glu.h>
+
+#include "constants.h"
+#include "family.h"
+
+void graphics_render_family() {
+ GLUquadric* quad = NULL;
+ quad = gluNewQuadric();
+ gluQuadricDrawStyle(quad, GLU_LINE);
+
+ if (quad) {
+ gluSphere(quad, GR_FAM_RADIUS, 4, 4);
+ gluDeleteQuadric(quad);
+ quad = NULL;
+ }
+}
+
+#endif /* _FAMILIA_GRAPHICS_INDIVIDUAL_H */
#ifndef _FAMILIA_GRAPHICS_FAMILY_H
#define _FAMILIA_GRAPHICS_FAMILY_H
+void graphics_render_family();
#endif /* _FAMILIA_GRAPHICS_FAMILY_H */
#include <GL/gl.h>
#include <GL/glu.h>
+#include "constants.h"
#include "individual.h"
void graphics_render_individual() {
gluQuadricDrawStyle(quad, GLU_LINE);
if (quad) {
- gluSphere(quad, 1, 10, 10);
+ gluSphere(quad, GR_IND_RADIUS, 10, 10);
gluDeleteQuadric(quad);
quad = NULL;
}
#include "storage/storage.h"
#include "gedcom/familia_gedcom.h"
+extern GtkDrawingArea * drawing_area;
+
const char * get_guidatafile()
{
if (g_file_test (DATADIR "/gui.glade", G_FILE_TEST_EXISTS)) {
int main(int argc, char** argv) {
GtkBuilder *builder = NULL;
GtkWidget *window = NULL;
- GtkWidget *area = NULL;
GdkGLConfig *glconfig = NULL;
struct familia_storage * storage = NULL;
gtk_builder_connect_signals(builder, NULL);
window = GTK_WIDGET(gtk_builder_get_object(builder, "main-window"));
- area = GTK_WIDGET(gtk_builder_get_object(builder, "drawing-area"));
+ drawing_area = GTK_WIDGET(gtk_builder_get_object(builder, "drawing-area"));
gtk_window_set_title(GTK_WINDOW(window), g_get_application_name());
/* Set OpenGL-capability to the widget. */
- gtk_widget_set_gl_capability (area, glconfig, NULL, TRUE, GDK_GL_RGBA_TYPE);
+ gtk_widget_set_gl_capability (drawing_area, glconfig, NULL, TRUE, GDK_GL_RGBA_TYPE);
gtk_widget_show(window);
gtk_main();
-
+
if (familia_storage_get_current()) {
storage = familia_storage_get_current();
familia_storage_free(storage);
--- /dev/null
+
+#include <GL/gl.h>
+
+GLdouble camera_pos_x = 0;
+GLdouble camera_pos_y = 0;
+GLdouble camera_pos_z = 0;
\ No newline at end of file
#include "storage/individual.h"
#include "storage/family.h"
-struct position * familia_position_calculate_individual_position(struct familia_individual * individual)
+struct position * calculate_individual_position(struct familia_individual * individual)
{
/* TODO: Implement this function*/
return NULL;
}
-struct position * familia_position_calculate_family_position(struct familia_family * family)
+struct position * calculate_family_position(struct familia_family * family)
{
/* TODO: Implement this function*/
return NULL;
#include "storage/individual.h"
#include "storage/family.h"
+struct objects_boundaries {
+ double top;
+ double right;
+ double bottom;
+ double left;
+};
+
/**
* Calculates local position of given individual
* @parameter individual to calculate position
* @return calculated local position of the individual
*/
-struct position * familia_position_calculate_individual_position(struct familia_individual * individual);
+struct position * calculate_individual_position(struct familia_individual * individual);
/**
* Calculates local position of given family
* @parameter family to calculate position
* @return calculated local position of the family
*/
-struct position * familia_position_calculate_family_position(struct familia_family * family);
+struct position * calculate_family_position(struct familia_family * family);
#endif /* _FAMILIA_MATH_POSITIONS_H */
}
/*
- * Entry not found for a given individual. Return error.
+ * Entry not found for a given individual. Return NULL.
*/
return NULL;
}
#include <gtk/gtk.h>
#include <gtk/gtkgl.h>
#include <GL/gl.h>
+#include <GL/glu.h>
#include "../debug.h"
#include "drawing_area.h"
+#include "../graphics/constants.h"
#include "../graphics/individual.h"
+#include "../graphics/family.h"
+#include "../storage/storage.h"
+
+extern GLdouble camera_pos_x;
+extern GLdouble camera_pos_y;
+extern GLdouble camera_pos_z;
+
+GtkDrawingArea * drawing_area = NULL;
/**
* The "draw" signal handler. All the OpenGL re-drawing should
*/
gboolean drawing_area_draw(GtkWidget *widget, cairo_t *cr, gpointer user_data)
{
+ unsigned int i;
+ unsigned int individuals_no;
+ unsigned int families_no;
+
/*** OpenGL BEGIN ***/
if (!gtk_widget_begin_gl (widget)) {
return FALSE;
}
+ glMatrixMode (GL_MODELVIEW);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ glLoadIdentity ();
+ gluLookAt (camera_pos_x, camera_pos_y, camera_pos_z, 0.0, 0.0, -100.0, 0.0, 1.0, 0.0);
+
+ individuals_no = familia_storage_get_current()->individuals_no;
+
+ for (i = 0; i < individuals_no; i++) {
glPushMatrix ();
- glLoadIdentity ();
- glTranslatef(0, 0, -10);
+ glTranslatef(i * (GR_IND_RADIUS + 1), 0, -10);
glColor3f (1.0, 1.0, 1.0);
graphics_render_individual();
glPopMatrix ();
+ }
+
+ families_no = familia_storage_get_current()->families_no;
+
+ for (i = 0; i < families_no; i++) {
+ glPushMatrix ();
+ glTranslatef(i * (GR_FAM_RADIUS + 1), -3, -10);
+ glColor3f (1.0, 1.0, 1.0);
+ graphics_render_family();
+ glPopMatrix ();
+ }
gtk_widget_end_gl (widget, TRUE);
/*** OpenGL END ***/
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
- gluPerspective (60.0, aspect, 1.0, 60.0);
+ gluPerspective (60.0, aspect, 0.1, 60.0);
glMatrixMode(GL_MODELVIEW);
gtk_widget_end_gl (widget, FALSE);
--- /dev/null
+#include <stdio.h>
+#include <GL/gl.h>
+
+#include "scrollbars.h"
+
+extern GLdouble camera_pos_x;
+extern GLdouble camera_pos_y;
+extern GLdouble camera_pos_z;
+
+extern GtkDrawingArea * drawing_area;
+
+void horizontal_scrollbar_changed (GtkAdjustment *adjustment, gpointer user_data)
+{
+ fprintf (stderr, "HS_changed\n");
+}
+
+void horizontal_scrollbar_value_changed (GtkAdjustment *adjustment, gpointer user_data)
+{
+ //gdk_window_invalidate_rect(gtk_widget_get_window (adjustment), NULL, TRUE);
+ camera_pos_x = gtk_adjustment_get_value(adjustment);
+ fprintf (stderr, "HS_value_changed, camera_pos_x: %f\n", camera_pos_x);
+ gtk_widget_queue_draw(GTK_WIDGET(drawing_area));
+}
+
+void vertical_scrollbar_changed (GtkAdjustment *adjustment, gpointer user_data)
+{
+ fprintf (stderr, "VS_changed\n");
+}
+
+void vertical_scrollbar_value_changed (GtkAdjustment *adjustment, gpointer user_data)
+{
+ //gdk_window_invalidate_rect(gtk_widget_get_window (adjustment), NULL, TRUE);
+ camera_pos_y = -gtk_adjustment_get_value(adjustment);
+ fprintf (stderr, "VS_value_changed, camera_pos_y: %f\n", camera_pos_y);
+ gtk_widget_queue_draw(GTK_WIDGET(drawing_area));
+}
\ No newline at end of file
--- /dev/null
+/****************************************************************************
+ * Familia Lignum - Genealogical program *
+ * Copyright (C) 2011-2012 Rafał Długołęcki <rafal@dlugolecki.net.pl> *
+ * *
+ * 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; version 2 of the License. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
+ * *
+ ****************************************************************************/
+
+#ifndef _UI_SCROLLBARS_H
+#define _UI_SCROLLBARS_H
+
+#include <gtk/gtk.h>
+
+/**
+ * Maintains changes in properties in main horizontal scrollbar.
+ *
+ * Emitted when one or more of the GtkAdjustment properties have been changed, other than the "value" property.
+ * @param adjustment the object which received the signal.
+ * @param user_data user data set when the signal handler was connected.
+ */
+void horizontal_scrollbar_changed (GtkAdjustment *adjustment, gpointer user_data);
+
+/**
+ * Maintains value changes in main horizontal scrollbar.
+ *
+ * Emitted when the "value" property has been changed.
+ * @param adjustment the object which received the signal.
+ * @param user_data user data set when the signal handler was connected.
+ */
+void horizontal_scrollbar_value_changed (GtkAdjustment *adjustment, gpointer user_data);
+
+/**
+ * Maintains changes in properties in main vertical scrollbar.
+ *
+ * Emitted when one or more of the GtkAdjustment properties have been changed, other than the "value" property.
+ * @param adjustment the object which received the signal.
+ * @param user_data user data set when the signal handler was connected.
+ */
+void vertical_scrollbar_changed (GtkAdjustment *adjustment, gpointer user_data);
+
+/**
+ * Maintains value changes in main vertical scrollbar.
+ *
+ * Emitted when the "value" property has been changed.
+ * @param adjustment the object which received the signal.
+ * @param user_data user data set when the signal handler was connected.
+ */
+void vertical_scrollbar_value_changed (GtkAdjustment *adjustment, gpointer user_data);
+
+#endif /* _UI_SCROLLBARS_H */
+++ /dev/null
-/****************************************************************************
- * MnumiEditor - *
- * Copyright (C) 2011-2013 Rafał Długołęcki <bugz@dlugolecki.net.pl> *
- * *
- ****************************************************************************/
-
-#ifndef _DRAWING_AREA_H
-#define _DRAWING_AREA_H
-
-/**
- * Function responsible for drawing content on each frame.
- */
-gboolean drawing_area_draw(GtkWidget *widget, cairo_t *cr,
- gpointer user_data);
-
-/**
- * Function responsible for configuration of drawing area widget.
- */
-gboolean drawing_area_configure_event (GtkWidget *widget,
- GdkEventConfigure *event, gpointer data);
-
-#endif /* _DRAWING_AREA_H */
-