mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Realign source files gnc-dense-cal*.c/h for spaces
This commit is contained in:
parent
a35af97250
commit
d393c42697
@ -1,34 +1,35 @@
|
|||||||
/*
|
/********************************************************************\
|
||||||
* gnc-dense-cal-model.c
|
* gnc-dense-cal-model.c *
|
||||||
*
|
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org> *
|
||||||
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org>
|
* *
|
||||||
*
|
* This program is free software; you can redistribute it and/or *
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* modify it under the terms of the GNU General Public License as *
|
||||||
* under the terms of version 2 and/or version 3 of the GNU General Public License as
|
* published by the Free Software Foundation, under version 2 and *
|
||||||
* published by the Free Software Foundation.
|
* / or version 3 of the License. *
|
||||||
*
|
* *
|
||||||
* As a special exception, permission is granted to link the binary module
|
* As a special exception, permission is granted to link the binary *
|
||||||
* resultant from this code with the OpenSSL project's "OpenSSL" library (or
|
* module resultant from this code with the OpenSSL project's *
|
||||||
* modified versions of it that use the same license as the "OpenSSL"
|
* "OpenSSL" library (or modified versions of it that use the same *
|
||||||
* library), and distribute the linked executable. You must obey the GNU
|
* license as the "OpenSSL" library), and distribute the linked *
|
||||||
* General Public License in all respects for all of the code used other than
|
* executable. You must obey the GNU General Public License in all *
|
||||||
* "OpenSSL". If you modify this file, you may extend this exception to your
|
* respects for all of the code used other than "OpenSSL". If you *
|
||||||
* version of the file, but you are not obligated to do so. If you do not
|
* modify this file, you may extend this exception to your version *
|
||||||
* wish to do so, delete this exception statement from your version of this
|
* of the file, but you are not obligated to do so. If you do not *
|
||||||
* file.
|
* wish to do so, delete this exception statement from your version *
|
||||||
*
|
* of this file. *
|
||||||
* This program is distributed in the hope that it will be useful,
|
* *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* GNU General Public License for more details.
|
* 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*
|
* You should have received a copy of the GNU General Public License*
|
||||||
* along with this program; if not, contact:
|
* along with this program; if not, contact: *
|
||||||
*
|
* *
|
||||||
* Free Software Foundation Voice: +1-617-542-5942
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
||||||
* Boston, MA 02110-1301, USA gnu@gnu.org
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||||
*/
|
\********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@ -107,7 +108,10 @@ gnc_dense_cal_model_get_instance_count(GncDenseCalModel *model, guint tag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_dense_cal_model_get_instance(GncDenseCalModel *model, guint tag, gint instance_index, GDate *date)
|
gnc_dense_cal_model_get_instance (GncDenseCalModel *model,
|
||||||
|
guint tag,
|
||||||
|
gint instance_index,
|
||||||
|
GDate *date)
|
||||||
{
|
{
|
||||||
(*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_instance)(model, tag, instance_index, date);
|
(*GNC_DENSE_CAL_MODEL_GET_IFACE(model)->get_instance)(model, tag, instance_index, date);
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
/*
|
/********************************************************************\
|
||||||
* gnc-dense-cal-model.h
|
* gnc-dense-cal-model.h *
|
||||||
*
|
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org> *
|
||||||
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org>
|
* *
|
||||||
*
|
* This program is free software; you can redistribute it and/or *
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* modify it under the terms of the GNU General Public License as *
|
||||||
* under the terms of version 2 and/or version 3 of the GNU General Public License as
|
* published by the Free Software Foundation, under version 2 and *
|
||||||
* published by the Free Software Foundation.
|
* / or version 3 of the License. *
|
||||||
*
|
* *
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details. *
|
||||||
*
|
* *
|
||||||
* You should have received a copy of the GNU General Public License*
|
* You should have received a copy of the GNU General Public License*
|
||||||
* along with this program; if not, contact:
|
* along with this program; if not, contact: *
|
||||||
*
|
* *
|
||||||
* Free Software Foundation Voice: +1-617-542-5942
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
||||||
* Boston, MA 02110-1301, USA gnu@gnu.org
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||||
*/
|
\********************************************************************/
|
||||||
|
|
||||||
#ifndef _GNC_DENSE_CAL_MODEL_H
|
#ifndef _GNC_DENSE_CAL_MODEL_H
|
||||||
#define _GNC_DENSE_CAL_MODEL_H
|
#define _GNC_DENSE_CAL_MODEL_H
|
||||||
@ -49,7 +49,10 @@ GList* gnc_dense_cal_model_get_contained(GncDenseCalModel *model);
|
|||||||
gchar* gnc_dense_cal_model_get_name (GncDenseCalModel *model, guint tag);
|
gchar* gnc_dense_cal_model_get_name (GncDenseCalModel *model, guint tag);
|
||||||
gchar* gnc_dense_cal_model_get_info (GncDenseCalModel *model, guint tag);
|
gchar* gnc_dense_cal_model_get_info (GncDenseCalModel *model, guint tag);
|
||||||
gint gnc_dense_cal_model_get_instance_count (GncDenseCalModel *model, guint tag);
|
gint gnc_dense_cal_model_get_instance_count (GncDenseCalModel *model, guint tag);
|
||||||
void gnc_dense_cal_model_get_instance(GncDenseCalModel *model, guint tag, gint instance_index, GDate *date);
|
void gnc_dense_cal_model_get_instance (GncDenseCalModel *model,
|
||||||
|
guint tag,
|
||||||
|
gint instance_index,
|
||||||
|
GDate *date);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -1,34 +1,35 @@
|
|||||||
/*
|
/********************************************************************\
|
||||||
* gnc-dense-cal-store.h
|
* gnc-dense-cal-store.h *
|
||||||
*
|
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org> *
|
||||||
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org>
|
* *
|
||||||
*
|
* This program is free software; you can redistribute it and/or *
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* modify it under the terms of the GNU General Public License as *
|
||||||
* under the terms of version 2 and/or version 3 of the GNU General Public License as
|
* published by the Free Software Foundation, under version 2 and *
|
||||||
* published by the Free Software Foundation.
|
* / or version 3 of the License. *
|
||||||
*
|
* *
|
||||||
* As a special exception, permission is granted to link the binary module
|
* As a special exception, permission is granted to link the binary *
|
||||||
* resultant from this code with the OpenSSL project's "OpenSSL" library (or
|
* module resultant from this code with the OpenSSL project's *
|
||||||
* modified versions of it that use the same license as the "OpenSSL"
|
* "OpenSSL" library (or modified versions of it that use the same *
|
||||||
* library), and distribute the linked executable. You must obey the GNU
|
* license as the "OpenSSL" library), and distribute the linked *
|
||||||
* General Public License in all respects for all of the code used other than
|
* executable. You must obey the GNU General Public License in all *
|
||||||
* "OpenSSL". If you modify this file, you may extend this exception to your
|
* respects for all of the code used other than "OpenSSL". If you *
|
||||||
* version of the file, but you are not obligated to do so. If you do not
|
* modify this file, you may extend this exception to your version *
|
||||||
* wish to do so, delete this exception statement from your version of this
|
* of the file, but you are not obligated to do so. If you do not *
|
||||||
* file.
|
* wish to do so, delete this exception statement from your version *
|
||||||
*
|
* of this file. *
|
||||||
* This program is distributed in the hope that it will be useful,
|
* *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* GNU General Public License for more details.
|
* 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, contact:
|
* You should have received a copy of the GNU General Public License*
|
||||||
*
|
* along with this program; if not, contact: *
|
||||||
* Free Software Foundation Voice: +1-617-542-5942
|
* *
|
||||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||||
* Boston, MA 02110-1301, USA gnu@gnu.org
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
||||||
*/
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||||
|
\********************************************************************/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
@ -96,8 +97,7 @@ gnc_dense_cal_store_new(int num_marks)
|
|||||||
model->num_marks = num_marks;
|
model->num_marks = num_marks;
|
||||||
model->cal_marks = g_new0 (GDate*, num_marks);
|
model->cal_marks = g_new0 (GDate*, num_marks);
|
||||||
{
|
{
|
||||||
int i = 0;
|
for (int i = 0; i < model->num_marks; i++)
|
||||||
for (i = 0; i < model->num_marks; i++)
|
|
||||||
{
|
{
|
||||||
model->cal_marks[i] = g_date_new();
|
model->cal_marks[i] = g_date_new();
|
||||||
}
|
}
|
||||||
@ -123,9 +123,8 @@ void
|
|||||||
gnc_dense_cal_store_update_name (GncDenseCalStore *model, const gchar *name)
|
gnc_dense_cal_store_update_name (GncDenseCalStore *model, const gchar *name)
|
||||||
{
|
{
|
||||||
if (model->name != NULL)
|
if (model->name != NULL)
|
||||||
{
|
|
||||||
g_free (model->name);
|
g_free (model->name);
|
||||||
}
|
|
||||||
model->name = g_strdup (name);
|
model->name = g_strdup (name);
|
||||||
//g_signal_emit_by_name(model, "update", GUINT_TO_POINTER(1));
|
//g_signal_emit_by_name(model, "update", GUINT_TO_POINTER(1));
|
||||||
}
|
}
|
||||||
@ -134,9 +133,8 @@ void
|
|||||||
gnc_dense_cal_store_update_info (GncDenseCalStore *model, const gchar *info)
|
gnc_dense_cal_store_update_info (GncDenseCalStore *model, const gchar *info)
|
||||||
{
|
{
|
||||||
if (model->info != NULL)
|
if (model->info != NULL)
|
||||||
{
|
|
||||||
g_free (model->info);
|
g_free (model->info);
|
||||||
}
|
|
||||||
model->info = g_strdup (info);
|
model->info = g_strdup (info);
|
||||||
//g_signal_emit_by_name(model, "update", GUINT_TO_POINTER(1));
|
//g_signal_emit_by_name(model, "update", GUINT_TO_POINTER(1));
|
||||||
}
|
}
|
||||||
@ -144,13 +142,12 @@ gnc_dense_cal_store_update_info(GncDenseCalStore *model, const gchar *info)
|
|||||||
static void
|
static void
|
||||||
gdcs_generic_update_recurrences (GncDenseCalStore *trans, GDate *start, GList *recurrences)
|
gdcs_generic_update_recurrences (GncDenseCalStore *trans, GDate *start, GList *recurrences)
|
||||||
{
|
{
|
||||||
int i;
|
int i = 0;
|
||||||
GDate date, next;
|
GDate date, next;
|
||||||
|
|
||||||
date = *start;
|
date = *start;
|
||||||
recurrenceListNextInstance (recurrences, &date, &next);
|
recurrenceListNextInstance (recurrences, &date, &next);
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while ((i < trans->num_marks)
|
while ((i < trans->num_marks)
|
||||||
&& g_date_valid (&next)
|
&& g_date_valid (&next)
|
||||||
/* Do checking against end restriction. */
|
/* Do checking against end restriction. */
|
||||||
@ -174,14 +171,19 @@ gdcs_generic_update_recurrences(GncDenseCalStore *trans, GDate *start, GList *re
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_dense_cal_store_update_recurrences_no_end(GncDenseCalStore *model, GDate *start, GList *recurrences)
|
gnc_dense_cal_store_update_recurrences_no_end (GncDenseCalStore *model,
|
||||||
|
GDate *start,
|
||||||
|
GList *recurrences)
|
||||||
{
|
{
|
||||||
model->end_type = NEVER_END;
|
model->end_type = NEVER_END;
|
||||||
gdcs_generic_update_recurrences (model, start, recurrences);
|
gdcs_generic_update_recurrences (model, start, recurrences);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_dense_cal_store_update_recurrences_count_end(GncDenseCalStore *model, GDate *start, GList *recurrences, int num_occur)
|
gnc_dense_cal_store_update_recurrences_count_end (GncDenseCalStore *model,
|
||||||
|
GDate *start,
|
||||||
|
GList *recurrences,
|
||||||
|
int num_occur)
|
||||||
{
|
{
|
||||||
model->end_type = END_AFTER_N_OCCS;
|
model->end_type = END_AFTER_N_OCCS;
|
||||||
model->n_occurrences = num_occur;
|
model->n_occurrences = num_occur;
|
||||||
@ -189,7 +191,10 @@ gnc_dense_cal_store_update_recurrences_count_end(GncDenseCalStore *model, GDate
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_dense_cal_store_update_recurrences_date_end(GncDenseCalStore *model, GDate *start, GList *recurrences, GDate *end_date)
|
gnc_dense_cal_store_update_recurrences_date_end (GncDenseCalStore *model,
|
||||||
|
GDate *start,
|
||||||
|
GList *recurrences,
|
||||||
|
GDate *end_date)
|
||||||
{
|
{
|
||||||
model->end_type = END_ON_DATE;
|
model->end_type = END_ON_DATE;
|
||||||
model->end_date = *end_date;
|
model->end_date = *end_date;
|
||||||
@ -240,7 +245,6 @@ gdcs_get_instance(GncDenseCalModel *model, guint tag, gint instance_index, GDate
|
|||||||
static void
|
static void
|
||||||
gnc_dense_cal_store_finalize (GObject *obj)
|
gnc_dense_cal_store_finalize (GObject *obj)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
GncDenseCalStore *store;
|
GncDenseCalStore *store;
|
||||||
g_return_if_fail (obj != NULL);
|
g_return_if_fail (obj != NULL);
|
||||||
|
|
||||||
@ -258,7 +262,7 @@ gnc_dense_cal_store_finalize(GObject *obj)
|
|||||||
store->info = NULL;
|
store->info = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < store->num_marks; i++)
|
for (int i = 0; i < store->num_marks; i++)
|
||||||
{
|
{
|
||||||
g_free (store->cal_marks[i]);
|
g_free (store->cal_marks[i]);
|
||||||
store->cal_marks[i] = NULL;
|
store->cal_marks[i] = NULL;
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
/*
|
/********************************************************************\
|
||||||
* gnc-dense-cal-store.h
|
* gnc-dense-cal-store.h *
|
||||||
*
|
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org> *
|
||||||
* Copyright (C) 2006 Joshua Sled <jsled@asynchronous.org>
|
* *
|
||||||
*
|
* This program is free software; you can redistribute it and/or *
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* modify it under the terms of the GNU General Public License as *
|
||||||
* under the terms of version 2 and/or version 3 of the GNU General Public License as
|
* published by the Free Software Foundation, under version 2 and *
|
||||||
* published by the Free Software Foundation.
|
* / or version 3 of the License. *
|
||||||
*
|
* *
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details. *
|
||||||
*
|
* *
|
||||||
* You should have received a copy of the GNU General Public License*
|
* You should have received a copy of the GNU General Public License*
|
||||||
* along with this program; if not, contact:
|
* along with this program; if not, contact: *
|
||||||
*
|
* *
|
||||||
* Free Software Foundation Voice: +1-617-542-5942
|
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
||||||
* Boston, MA 02110-1301, USA gnu@gnu.org
|
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||||
*/
|
\********************************************************************/
|
||||||
|
|
||||||
#ifndef _GNC_DENSE_CAL_STORE_H
|
#ifndef _GNC_DENSE_CAL_STORE_H
|
||||||
#define _GNC_DENSE_CAL_STORE_H
|
#define _GNC_DENSE_CAL_STORE_H
|
||||||
@ -41,9 +41,17 @@ void gnc_dense_cal_store_clear(GncDenseCalStore *model);
|
|||||||
void gnc_dense_cal_store_update_name (GncDenseCalStore *model, const gchar* name);
|
void gnc_dense_cal_store_update_name (GncDenseCalStore *model, const gchar* name);
|
||||||
void gnc_dense_cal_store_update_info (GncDenseCalStore *model, const gchar* info);
|
void gnc_dense_cal_store_update_info (GncDenseCalStore *model, const gchar* info);
|
||||||
|
|
||||||
void gnc_dense_cal_store_update_recurrences_no_end(GncDenseCalStore *model, GDate *start, GList *recurrences);
|
void gnc_dense_cal_store_update_recurrences_no_end (GncDenseCalStore *model,
|
||||||
void gnc_dense_cal_store_update_recurrences_count_end(GncDenseCalStore *model, GDate *start, GList *recurrences, int num_occur);
|
GDate *start,
|
||||||
void gnc_dense_cal_store_update_recurrences_date_end(GncDenseCalStore *model, GDate *start, GList *recurrences, GDate *end_date);
|
GList *recurrences);
|
||||||
|
void gnc_dense_cal_store_update_recurrences_count_end (GncDenseCalStore *model,
|
||||||
|
GDate *start,
|
||||||
|
GList *recurrences,
|
||||||
|
int num_occur);
|
||||||
|
void gnc_dense_cal_store_update_recurrences_date_end (GncDenseCalStore *model,
|
||||||
|
GDate *start,
|
||||||
|
GList *recurrences,
|
||||||
|
GDate *end_date);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -79,7 +79,9 @@ static const int COL_BORDER_SIZE = 3;
|
|||||||
static void gnc_dense_cal_finalize (GObject *object);
|
static void gnc_dense_cal_finalize (GObject *object);
|
||||||
static void gnc_dense_cal_dispose (GObject *object);
|
static void gnc_dense_cal_dispose (GObject *object);
|
||||||
static void gnc_dense_cal_realize (GtkWidget *widget, gpointer user_data);
|
static void gnc_dense_cal_realize (GtkWidget *widget, gpointer user_data);
|
||||||
static void gnc_dense_cal_configure(GtkWidget *widget, GdkEventConfigure *event, gpointer user_data);
|
static void gnc_dense_cal_configure (GtkWidget *widget,
|
||||||
|
GdkEventConfigure *event,
|
||||||
|
gpointer user_data);
|
||||||
static void gnc_dense_cal_draw_to_buffer (GncDenseCal *dcal);
|
static void gnc_dense_cal_draw_to_buffer (GncDenseCal *dcal);
|
||||||
static gboolean gnc_dense_cal_draw (GtkWidget *widget, cairo_t *cr, gpointer user_data);
|
static gboolean gnc_dense_cal_draw (GtkWidget *widget, cairo_t *cr, gpointer user_data);
|
||||||
|
|
||||||
@ -114,7 +116,6 @@ static inline int num_cols(GncDenseCal *dcal);
|
|||||||
static void _gnc_dense_cal_set_month (GncDenseCal *dcal, GDateMonth mon, gboolean redraw);
|
static void _gnc_dense_cal_set_month (GncDenseCal *dcal, GDateMonth mon, gboolean redraw);
|
||||||
static void _gnc_dense_cal_set_year (GncDenseCal *dcal, guint year, gboolean redraw);
|
static void _gnc_dense_cal_set_year (GncDenseCal *dcal, guint year, gboolean redraw);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the total number of weeks to display in the calendar [irrespective
|
* Returns the total number of weeks to display in the calendar [irrespective
|
||||||
* of columns/weeks-per-col].
|
* of columns/weeks-per-col].
|
||||||
@ -138,7 +139,8 @@ static void month_coords(GncDenseCal *dcal, int monthOfCal, GList **outList);
|
|||||||
static void doc_coords (GncDenseCal *dcal, int dayOfCal,
|
static void doc_coords (GncDenseCal *dcal, int dayOfCal,
|
||||||
int *x1, int *y1, int *x2, int *y2);
|
int *x1, int *y1, int *x2, int *y2);
|
||||||
|
|
||||||
static void gdc_mark_add(GncDenseCal *dcal, guint tag, gchar *name, gchar *info, guint size, GDate **dateArray);
|
static void gdc_mark_add (GncDenseCal *dcal, guint tag, gchar *name,
|
||||||
|
gchar *info, guint size, GDate **dateArray);
|
||||||
static void gdc_mark_remove (GncDenseCal *dcal, guint mark_to_remove, gboolean redraw);
|
static void gdc_mark_remove (GncDenseCal *dcal, guint mark_to_remove, gboolean redraw);
|
||||||
|
|
||||||
static void gdc_add_tag_markings (GncDenseCal *cal, guint tag);
|
static void gdc_add_tag_markings (GncDenseCal *cal, guint tag);
|
||||||
@ -261,11 +263,8 @@ day_label(gchar *buf, int buf_len, int dow)
|
|||||||
static void
|
static void
|
||||||
gnc_dense_cal_class_init (GncDenseCalClass *klass)
|
gnc_dense_cal_class_init (GncDenseCalClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class;
|
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
||||||
GtkWidgetClass *widget_class;
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
|
||||||
|
|
||||||
object_class = G_OBJECT_CLASS (klass);
|
|
||||||
widget_class = GTK_WIDGET_CLASS (klass);
|
|
||||||
|
|
||||||
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(klass), "calendar");
|
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS(klass), "calendar");
|
||||||
|
|
||||||
@ -315,17 +314,16 @@ gnc_dense_cal_init(GncDenseCal *dcal)
|
|||||||
|
|
||||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_CALENDAR);
|
gtk_style_context_add_class (context, GTK_STYLE_CLASS_CALENDAR);
|
||||||
{
|
{
|
||||||
GtkTreeModel *options;
|
GtkTreeModel *options = GTK_TREE_MODEL(_gdc_get_view_options());
|
||||||
GtkCellRenderer *text_rend;
|
GtkCellRenderer *text_rend = GTK_CELL_RENDERER(gtk_cell_renderer_text_new ());
|
||||||
|
|
||||||
options = GTK_TREE_MODEL(_gdc_get_view_options());
|
|
||||||
dcal->view_options = GTK_COMBO_BOX(gtk_combo_box_new_with_model (options));
|
dcal->view_options = GTK_COMBO_BOX(gtk_combo_box_new_with_model (options));
|
||||||
gtk_combo_box_set_active (GTK_COMBO_BOX(dcal->view_options), 0);
|
gtk_combo_box_set_active (GTK_COMBO_BOX(dcal->view_options), 0);
|
||||||
text_rend = GTK_CELL_RENDERER(gtk_cell_renderer_text_new());
|
|
||||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(dcal->view_options), text_rend, TRUE);
|
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(dcal->view_options), text_rend, TRUE);
|
||||||
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT(dcal->view_options),
|
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT(dcal->view_options),
|
||||||
text_rend, "text", VIEW_OPTS_COLUMN_LABEL);
|
text_rend, "text", VIEW_OPTS_COLUMN_LABEL);
|
||||||
g_signal_connect(G_OBJECT(dcal->view_options), "changed", G_CALLBACK(_gdc_view_option_changed), (gpointer)dcal);
|
g_signal_connect (G_OBJECT(dcal->view_options), "changed",
|
||||||
|
G_CALLBACK(_gdc_view_option_changed), (gpointer)dcal);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -348,9 +346,12 @@ gnc_dense_cal_init(GncDenseCal *dcal)
|
|||||||
| GDK_POINTER_MOTION_MASK
|
| GDK_POINTER_MOTION_MASK
|
||||||
| GDK_POINTER_MOTION_HINT_MASK));
|
| GDK_POINTER_MOTION_HINT_MASK));
|
||||||
gtk_box_pack_start (GTK_BOX(dcal), GTK_WIDGET(dcal->cal_drawing_area), TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX(dcal), GTK_WIDGET(dcal->cal_drawing_area), TRUE, TRUE, 0);
|
||||||
g_signal_connect(G_OBJECT(dcal->cal_drawing_area), "draw", G_CALLBACK(gnc_dense_cal_draw), (gpointer)dcal);
|
g_signal_connect (G_OBJECT(dcal->cal_drawing_area), "draw",
|
||||||
g_signal_connect(G_OBJECT(dcal->cal_drawing_area), "realize", G_CALLBACK(gnc_dense_cal_realize), (gpointer)dcal);
|
G_CALLBACK(gnc_dense_cal_draw), (gpointer)dcal);
|
||||||
g_signal_connect(G_OBJECT(dcal->cal_drawing_area), "configure_event", G_CALLBACK(gnc_dense_cal_configure), (gpointer)dcal);
|
g_signal_connect (G_OBJECT(dcal->cal_drawing_area), "realize",
|
||||||
|
G_CALLBACK(gnc_dense_cal_realize), (gpointer)dcal);
|
||||||
|
g_signal_connect (G_OBJECT(dcal->cal_drawing_area), "configure_event",
|
||||||
|
G_CALLBACK(gnc_dense_cal_configure), (gpointer)dcal);
|
||||||
|
|
||||||
dcal->disposed = FALSE;
|
dcal->disposed = FALSE;
|
||||||
dcal->initialized = FALSE;
|
dcal->initialized = FALSE;
|
||||||
@ -387,13 +388,15 @@ gnc_dense_cal_init(GncDenseCal *dcal)
|
|||||||
|
|
||||||
tree_data = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
|
tree_data = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
|
||||||
tree_view = GTK_TREE_VIEW(gtk_tree_view_new_with_model (GTK_TREE_MODEL(tree_data)));
|
tree_view = GTK_TREE_VIEW(gtk_tree_view_new_with_model (GTK_TREE_MODEL(tree_data)));
|
||||||
gtk_tree_view_insert_column_with_attributes(tree_view, -1, _("Name"), gtk_cell_renderer_text_new(), "text", 0, NULL);
|
gtk_tree_view_insert_column_with_attributes (tree_view, -1, _("Name"),
|
||||||
gtk_tree_view_insert_column_with_attributes(tree_view, -1, _("Frequency"), gtk_cell_renderer_text_new(), "text", 1, NULL);
|
gtk_cell_renderer_text_new (), "text", 0, NULL);
|
||||||
|
gtk_tree_view_insert_column_with_attributes (tree_view, -1, _("Frequency"),
|
||||||
|
gtk_cell_renderer_text_new (), "text", 1, NULL);
|
||||||
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW(tree_view)), GTK_SELECTION_NONE);
|
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW(tree_view)), GTK_SELECTION_NONE);
|
||||||
g_object_set_data (G_OBJECT(dcal->transPopup), "model", tree_data);
|
g_object_set_data (G_OBJECT(dcal->transPopup), "model", tree_data);
|
||||||
g_object_unref (tree_data);
|
g_object_unref (tree_data);
|
||||||
gtk_container_add(GTK_CONTAINER(vbox), GTK_WIDGET(tree_view));
|
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER(vbox), GTK_WIDGET(tree_view));
|
||||||
gtk_container_add (GTK_CONTAINER(dcal->transPopup), vbox);
|
gtk_container_add (GTK_CONTAINER(dcal->transPopup), vbox);
|
||||||
|
|
||||||
gtk_window_set_resizable (GTK_WINDOW(dcal->transPopup), FALSE);
|
gtk_window_set_resizable (GTK_WINDOW(dcal->transPopup), FALSE);
|
||||||
@ -639,7 +642,8 @@ gnc_dense_cal_set_num_months(GncDenseCal *dcal, guint num_months)
|
|||||||
{
|
{
|
||||||
gint months_val, delta_months;
|
gint months_val, delta_months;
|
||||||
|
|
||||||
gtk_tree_model_get(GTK_TREE_MODEL(options), &view_opts_iter, VIEW_OPTS_COLUMN_NUM_MONTHS, &months_val, -1);
|
gtk_tree_model_get (GTK_TREE_MODEL(options), &view_opts_iter,
|
||||||
|
VIEW_OPTS_COLUMN_NUM_MONTHS, &months_val, -1);
|
||||||
delta_months = abs (months_val - (int)num_months);
|
delta_months = abs (months_val - (int)num_months);
|
||||||
if (delta_months < closest_index_distance)
|
if (delta_months < closest_index_distance)
|
||||||
{
|
{
|
||||||
@ -909,7 +913,7 @@ recompute_extents(GncDenseCal *dcal)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
free_rect(gpointer data, gpointer ud)
|
free_rect (gpointer data, gpointer user_data)
|
||||||
{
|
{
|
||||||
g_free ((GdkRectangle*)data);
|
g_free ((GdkRectangle*)data);
|
||||||
}
|
}
|
||||||
@ -1011,8 +1015,7 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
|
|||||||
{
|
{
|
||||||
mcList = NULL;
|
mcList = NULL;
|
||||||
month_coords (dcal, i, &mcList);
|
month_coords (dcal, i, &mcList);
|
||||||
dcal->monthPositions[i].x
|
dcal->monthPositions[i].x = floor (i / dcal->monthsPerCol)
|
||||||
= floor(i / dcal->monthsPerCol)
|
|
||||||
* (col_width (dcal) + COL_BORDER_SIZE);
|
* (col_width (dcal) + COL_BORDER_SIZE);
|
||||||
dcal->monthPositions[i].y = ((GdkRectangle*)mcList->next->next->next->data)->y;
|
dcal->monthPositions[i].y = ((GdkRectangle*)mcList->next->next->next->data)->y;
|
||||||
for (mcListIter = mcList; mcListIter != NULL; mcListIter = mcListIter->next)
|
for (mcListIter = mcList; mcListIter != NULL; mcListIter = mcListIter->next)
|
||||||
@ -1130,7 +1133,10 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
|
|||||||
gtk_style_context_save (stylectxt);
|
gtk_style_context_save (stylectxt);
|
||||||
gtk_style_context_add_class (stylectxt, GTK_STYLE_CLASS_HEADER);
|
gtk_style_context_add_class (stylectxt, GTK_STYLE_CLASS_HEADER);
|
||||||
|
|
||||||
gtk_render_background (stylectxt, cr, x, y - dcal->dayLabelHeight, (day_width(dcal) * 7) + 1, dcal->dayLabelHeight);
|
gtk_render_background (stylectxt, cr, x,
|
||||||
|
y - dcal->dayLabelHeight,
|
||||||
|
(day_width(dcal) * 7) + 1,
|
||||||
|
dcal->dayLabelHeight);
|
||||||
|
|
||||||
for (j = 0; j < 7; j++)
|
for (j = 0; j < 7; j++)
|
||||||
{
|
{
|
||||||
@ -1168,8 +1174,10 @@ gnc_dense_cal_draw_to_buffer(GncDenseCal *dcal)
|
|||||||
if (dcal->monthPositions[i].x == -1)
|
if (dcal->monthPositions[i].x == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
gtk_render_background (stylectxt, cr, dcal->monthPositions[i].x + x_offset, dcal->topPadding,
|
gtk_render_background (stylectxt, cr, dcal->monthPositions[i].x + x_offset,
|
||||||
dcal->dayLabelHeight + 1, col_height(dcal) + dcal->dayLabelHeight + 1);
|
dcal->topPadding,
|
||||||
|
dcal->dayLabelHeight + 1,
|
||||||
|
col_height(dcal) + dcal->dayLabelHeight + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 12; i++)
|
for (i = 0; i < 12; i++)
|
||||||
@ -1278,7 +1286,8 @@ populate_hover_window(GncDenseCal *dcal)
|
|||||||
|
|
||||||
gdcmd = (gdc_mark_data*)l->data;
|
gdcmd = (gdc_mark_data*)l->data;
|
||||||
gtk_list_store_insert (model, &iter, INT_MAX);
|
gtk_list_store_insert (model, &iter, INT_MAX);
|
||||||
gtk_list_store_set(model, &iter, 0, (gdcmd->name ? gdcmd->name : _("(unnamed)")), 1, gdcmd->info, -1);
|
gtk_list_store_set (model, &iter, 0, (gdcmd->name ? gdcmd->name : _("(unnamed)")),
|
||||||
|
1, gdcmd->info, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if there are no rows, add one
|
// if there are no rows, add one
|
||||||
@ -1956,7 +1965,7 @@ static void
|
|||||||
gdc_model_added_cb (GncDenseCalModel *model, guint added_tag, gpointer user_data)
|
gdc_model_added_cb (GncDenseCalModel *model, guint added_tag, gpointer user_data)
|
||||||
{
|
{
|
||||||
GncDenseCal *cal = GNC_DENSE_CAL(user_data);
|
GncDenseCal *cal = GNC_DENSE_CAL(user_data);
|
||||||
DEBUG("gdc_model_added_cb update\n");
|
DEBUG("gdc_model_added_cb update");
|
||||||
gdc_add_tag_markings (cal, added_tag);
|
gdc_add_tag_markings (cal, added_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1965,7 +1974,7 @@ gdc_model_update_cb(GncDenseCalModel *model, guint update_tag, gpointer user_dat
|
|||||||
{
|
{
|
||||||
GncDenseCal *cal = GNC_DENSE_CAL(user_data);
|
GncDenseCal *cal = GNC_DENSE_CAL(user_data);
|
||||||
gint num_marks = 0;
|
gint num_marks = 0;
|
||||||
DEBUG ("gdc_model_update_cb update for tag [%d]\n", update_tag);
|
DEBUG("gdc_model_update_cb update for tag [%d]", update_tag);
|
||||||
num_marks = gnc_dense_cal_model_get_instance_count (cal->model, update_tag);
|
num_marks = gnc_dense_cal_model_get_instance_count (cal->model, update_tag);
|
||||||
// We need to redraw if there are no mark, to ensure they're all erased.
|
// We need to redraw if there are no mark, to ensure they're all erased.
|
||||||
gdc_mark_remove (cal, update_tag, num_marks==0);
|
gdc_mark_remove (cal, update_tag, num_marks==0);
|
||||||
@ -1977,7 +1986,7 @@ static void
|
|||||||
gdc_model_removing_cb (GncDenseCalModel *model, guint remove_tag, gpointer user_data)
|
gdc_model_removing_cb (GncDenseCalModel *model, guint remove_tag, gpointer user_data)
|
||||||
{
|
{
|
||||||
GncDenseCal *cal = GNC_DENSE_CAL(user_data);
|
GncDenseCal *cal = GNC_DENSE_CAL(user_data);
|
||||||
DEBUG("gdc_model_removing_cb update [%d]\n", remove_tag);
|
DEBUG("gdc_model_removing_cb update [%d]", remove_tag);
|
||||||
gdc_mark_remove (cal, remove_tag, TRUE);
|
gdc_mark_remove (cal, remove_tag, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2017,7 +2026,7 @@ gdc_mark_add(GncDenseCal *dcal,
|
|||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
{
|
{
|
||||||
g_error("0 size not allowed\n");
|
g_error ("0 size not allowed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2030,7 +2039,7 @@ gdc_mark_add(GncDenseCal *dcal,
|
|||||||
newMark->info = g_strdup (info);
|
newMark->info = g_strdup (info);
|
||||||
newMark->tag = tag;
|
newMark->tag = tag;
|
||||||
newMark->ourMarks = NULL;
|
newMark->ourMarks = NULL;
|
||||||
DEBUG("saving mark with tag [%d]\n", newMark->tag);
|
DEBUG("saving mark with tag [%d]", newMark->tag);
|
||||||
|
|
||||||
for (i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or *
|
* This program is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU General Public License as *
|
* modify it under the terms of the GNU General Public License as *
|
||||||
* published by the Free Software Foundation, under version 2 and/or version 3 of *
|
* published by the Free Software Foundation, under version 2 and *
|
||||||
* the License. *
|
* / or version 3 of the License. *
|
||||||
* *
|
* *
|
||||||
* This program is distributed in the hope that it will be useful, *
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
Loading…
Reference in New Issue
Block a user