aboutsummaryrefslogtreecommitdiffstats
path: root/libical
Commit message (Expand)AuthorAgeFilesLines
* We don't need AC_PROG_RANLIB and AM_PROG_LIBTOOLJP Rosevear2000-09-013-2/+11
* Kill off more old, dead filesJP Rosevear2000-09-0129-11872/+4
* This dir is not in 0.19JP Rosevear2000-09-019-213/+4
* This file is not in 0.19JP Rosevear2000-09-012-222/+4
* oopsJP Rosevear2000-09-011-0/+2
* Kill fileJP Rosevear2000-09-013-460/+4
* Don't list config.h in AC_OUTPUTJP Rosevear2000-09-012-1/+4
* Kill old fileJP Rosevear2000-09-016-562/+30
* Add/fix .cvsignores.Ettore Perazzoli2000-08-282-0/+13
* builddir != srcdir fixes.Ettore Perazzoli2000-08-273-2/+9
* Got rid of some warnings.Christopher James Lahey2000-08-264-4/+12
* Fixed an incorrect struct name.Christopher James Lahey2000-08-262-2/+6
* Compile fix for libicalPeter Williams2000-08-252-2/+8
* Remove this duplicate file to fix buildJP Rosevear2000-08-252-39/+4
* Baby seal eyes are good with soy sauce! - FedericoFederico Mena Quintero2000-08-251-3/+3
* Fixety fix - FedericoFederico Mena Quintero2000-08-252-2/+6
* More import tidying.JP Rosevear2000-08-254-618/+7
* Fix minor conflicts.JP Rosevear2000-08-2553-3742/+5026
* Initial revisionJP Rosevear2000-08-2546-0/+15040
* You have to wonder what a file called foo was doing here... - FedericoFederico Mena Quintero2000-08-011-1578/+0
* add textual exception printout. (set_editor_text): close pre tags & checkMichael Meeks2000-07-261-0/+1706
* Make gnome-print-0.20 mandatory. We will bail out with CVS HEAD versionsFederico Mena Quintero2000-07-131-18/+46
* fixed various problemsSeth Alves2000-07-132-0/+11
* Fixed some make distcheck errors.Christopher James Lahey2000-07-061-13/+13
* Generated files, go away - FedericoFederico Mena Quintero2000-07-063-4068/+0
* Added the array of objects and the hash table of UID->array index.Federico Mena Quintero2000-06-131-1/+1
* Removing generated filesÉRDI Gergo2000-06-103-138/+1
* Now this derives from GtkObject. It follows the same strategy as theFederico Mena Quintero2000-06-091-21/+59
* Fix Makefiles so that (guess what?) they work with builddir != srcdir.Ettore Perazzoli2000-06-083-2/+19
* update some .cvsignoresSeth Alves2000-06-081-0/+1
* *** empty log message ***Seth Alves2000-06-075-12/+542
* merge libical-0.17 onto the headSeth Alves2000-06-0732-1653/+1634
* Initial revisionSeth Alves2000-06-075-0/+4208
* reparing damage from removing filesEric Busboom2000-05-15141-0/+42278
* removing all filesEric Busboom2000-05-15152-44434/+0
* This commit was generated by cvs2svn to compensate for changes in r3037,Eric Busboom2000-05-155-30/+49
* Initial revisionEric Busboom2000-05-1511-0/+2150
* Fix Makefile to use generated include files that are in the buildEttore Perazzoli2000-05-142-0/+7
* Removed dist-hook section.Christopher James Lahey2000-05-102-13/+18
* Stylistic fix - FedericoFederico Mena Quintero2000-05-011-0/+376
* Further Makefile loving.Ettore Perazzoli2000-04-273-2/+10
* Fix broken `Makefile.am' again. I am frustrated.Ettore Perazzoli2000-04-272-1/+9
* + * tests/.cvsignore: Added test13.Matthew Loper2000-04-273-3/+7
* Removed.Christopher James Lahey2000-04-262-376/+4
* Fix compile with builddir != srcdir.Ettore Perazzoli2000-04-263-2/+6
* convert from a time_t to an icaldurationtype.Seth Alves2000-04-252-0/+24
* *** empty log message ***Seth Alves2000-04-212-1/+3
* Use "e-minicard" as the log domain.Federico Mena Quintero2000-04-211-0/+376
* This file does not belong in CVS.Peter Williams2000-04-201-376/+0
* build libtool libraries instead of just .aSeth Alves2000-04-193-11/+12
* added some stuff to cvs ignore files, build .la instead of just .aSeth Alves2000-04-198-22/+97
* import of libical-0.16Seth Alves2000-04-1968-1355/+8265
* added AC_PROG_MAKE_SET.Damon Chaplin2000-04-112-0/+5
* Shut up!Ettore Perazzoli2000-03-021-8/+14
* Various building fixes. At least, now it builds for me.Ettore Perazzoli2000-03-022-2/+8
* required fileSeth Alves2000-02-261-0/+12
* required filesSeth Alves2000-02-262-0/+2
* added autogen.sh so this library can be build on its ownSeth Alves2000-02-263-1/+116
* start using ChangeLog in this librarySeth Alves2000-02-261-0/+9
* make libicalss installableSeth Alves2000-02-261-2/+2
* renamed a couple files so that automake will be my friendSeth Alves2000-02-264-14/+15
* added the generated file icalitip.tab.c until i can figure outSeth Alves2000-02-245-16/+1683
* + * libical/src/libical/.cvsignore: Added *.lo, *.la, and .libs.Matthew Loper2000-02-222-1/+7
* + * libical/Makefile.in: autogenerated file removed from cvs, andMatthew Loper2000-02-228-1517/+6
* generatedSeth Alves2000-02-211-2164/+0
* *** empty log message ***Seth Alves2000-02-211-31/+0
* more fallout from import of 0.15aSeth Alves2000-02-213-5/+3
* generatedSeth Alves2000-02-212-1699/+0
* This commit was generated by cvs2svn to compensate for changes in r1879,Seth Alves2000-02-2111-39/+141
* Initial revisionSeth Alves2000-02-213-0/+183
* ignore a flex output fileSeth Alves2000-02-211-0/+2
* ignore .depsSeth Alves2000-02-212-1/+3
* some Makefile.ams to use until eric moves his code to cvsSeth Alves2000-02-2110-176/+1516
* + * libical/src/test/.cvsignore: Added Makefile.Matthew Loper2000-02-203-0/+5
* + * libical/Makefile: autogenerated file removed from cvs.Matthew Loper2000-02-205-2040/+0
* + * widgets/e-minicard/.cvsignore: Added minicard-label-test,Matthew Loper2000-02-204-0/+8
* Make gnomeui the last library on the command line, as its path is the oneMiguel de Icaza2000-02-192-8/+8
* didn't want these checked inSeth Alves2000-02-188-222/+0
* This commit was generated by cvs2svn to compensate for changes in r1827,Seth Alves2000-02-184-44/+23
* Initial revisionSeth Alves2000-02-18123-0/+39827
iv class='alt'>
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
  
  



                                                                
  

                                                                  
                                                                    


                                                                   
                                                                             





                                                        
  















                                                                         
 
             
                                                                      
 

                                 

                                                     
                         






                                                                       
                              
 




                                                               

                                                                               
                      


 

                                                                                    

                             
                            
 

                                                    
 
                                                           
                                                                       
               
                                                                                                     
 
                                                           
                                                                       
               
                                                                                                     
 





                                                                                           
 





                                                         




                                                                                     
                            
 



















                                                                                            
 





                                                                 












                                   
                                                                            
                                     







                                                                                                               
 

                                                       
 








                                              
                                    

                                                     
/*
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) version 3.
 *
 * 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with the program; if not, see <http://www.gnu.org/licenses/>
 *
 *
 * Authors:
 *      Chris Lahey <clahey@ximian.com>
 *
 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
 *
 */

#include "e-canvas-utils.h"

void
e_canvas_item_move_absolute (GnomeCanvasItem *item, double dx, double dy)
{
    double translate[6];

    g_return_if_fail (item != NULL);
    g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));

    art_affine_translate (translate, dx, dy);

    gnome_canvas_item_affine_absolute (item, translate);
}

static double
compute_offset(gint top, gint bottom, gint page_top, gint page_bottom)
{
    gint size = bottom - top;
    gint offset = 0;

    if (top <= page_top && bottom >= page_bottom)
        return 0;

    if (bottom > page_bottom)
        offset = (bottom - page_bottom);
    if (top < page_top + offset)
        offset = (top - page_top);

    if (top <= page_top + offset && bottom >= page_bottom + offset)
        return offset;

    if (top < page_top + size * 3 / 2 + offset)
        offset = top - (page_top + size * 3 / 2);
    if (bottom > page_bottom - size * 3 / 2 + offset)
        offset = bottom - (page_bottom - size * 3 / 2);
    if (top < page_top + size * 3 / 2 + offset)
        offset = top - ((page_top + page_bottom - (bottom - top)) / 2);

    return offset;
}


static void
e_canvas_show_area (GnomeCanvas *canvas, double x1, double y1, double x2, double y2)
{
    GtkAdjustment *h, *v;
    gint dx = 0, dy = 0;

    g_return_if_fail (canvas != NULL);
    g_return_if_fail (GNOME_IS_CANVAS (canvas));

    h = gtk_layout_get_hadjustment(GTK_LAYOUT(canvas));
    dx = compute_offset(x1, x2, h->value, h->value + h->page_size);
    if (dx)
        gtk_adjustment_set_value(h, CLAMP(h->value + dx, h->lower, h->upper - h->page_size));

    v = gtk_layout_get_vadjustment(GTK_LAYOUT(canvas));
    dy = compute_offset(y1, y2, v->value, v->value + v->page_size);
    if (dy)
        gtk_adjustment_set_value(v, CLAMP(v->value + dy, v->lower, v->upper - v->page_size));
}

void
e_canvas_item_show_area (GnomeCanvasItem *item, double x1, double y1, double x2, double y2)
{
    g_return_if_fail (item != NULL);
    g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));

    gnome_canvas_item_i2w(item, &x1, &y1);
    gnome_canvas_item_i2w(item, &x2, &y2);

    e_canvas_show_area(item->canvas, x1, y1, x2, y2);
}


static gboolean
e_canvas_area_shown (GnomeCanvas *canvas, double x1, double y1, double x2, double y2)
{
    GtkAdjustment *h, *v;
    gint dx = 0, dy = 0;

    g_return_val_if_fail (canvas != NULL, FALSE);
    g_return_val_if_fail (GNOME_IS_CANVAS (canvas), FALSE);

    h = gtk_layout_get_hadjustment(GTK_LAYOUT(canvas));
    dx = compute_offset(x1, x2, h->value, h->value + h->page_size);
    if (CLAMP(h->value + dx, h->lower, h->upper - h->page_size) - h->value != 0)
        return FALSE;

    v = gtk_layout_get_vadjustment(GTK_LAYOUT(canvas));
    dy = compute_offset(y1, y2, v->value, v->value + v->page_size);
    if (CLAMP(v->value + dy, v->lower, v->upper - v->page_size) - v->value != 0)
        return FALSE;
    return TRUE;
}

gboolean
e_canvas_item_area_shown (GnomeCanvasItem *item, double x1, double y1, double x2, double y2)
{
    g_return_val_if_fail (item != NULL, FALSE);
    g_return_val_if_fail (GNOME_IS_CANVAS_ITEM (item), FALSE);

    gnome_canvas_item_i2w(item, &x1, &y1);
    gnome_canvas_item_i2w(item, &x2, &y2);

    return e_canvas_area_shown(item->canvas, x1, y1, x2, y2);
}

typedef struct {
    double x1;
    double y1;
    double x2;
    double y2;
    GnomeCanvas *canvas;
} DoubsAndCanvas;

static gboolean
show_area_timeout (gpointer data)
{
    DoubsAndCanvas *dac = data;

    e_canvas_show_area(dac->canvas, dac->x1, dac->y1, dac->x2, dac->y2);
    g_object_unref (dac->canvas);
    g_free(dac);
    return FALSE;
}

void
e_canvas_item_show_area_delayed (GnomeCanvasItem *item, double x1, double y1, double x2, double y2, gint delay)
{
    DoubsAndCanvas *dac;

    g_return_if_fail (item != NULL);
    g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));

    gnome_canvas_item_i2w(item, &x1, &y1);
    gnome_canvas_item_i2w(item, &x2, &y2);

    dac = g_new(DoubsAndCanvas, 1);
    dac->x1 = x1;
    dac->y1 = y1;
    dac->x2 = x2;
    dac->y2 = y2;
    dac->canvas = item->canvas;
    g_object_ref (item->canvas);
    g_timeout_add(delay, show_area_timeout, dac);
}