pageBar/src/gtkPagebar.c File Reference

#include <liberdm/display.h>
#include <liberdm/erdm.h>
#include <liberipc/eripcpagebar.h>
#include <liberipc/eripcviewer.h>
#include <liberipc/eripcbusyd.h>
#include <liberipc/eripccontentlister.h>
#include <liberipc/eripcsetup.h>
#include <liberipc/eripcconnect.h>
#include <liberipc/eripcarinc.h>
#include "gtkPagebar.h"
#include "displayUpdate.h"

Go to the source code of this file.

Defines

#define PRINT_TRACE(X)   ;
#define PRINT_DEBUG(X)   ;
#define PRINT_INFO(X)   ;
#define PRINT_ERROR(X)   printf X
#define ENTER(x)   ;
#define LEAVE(x)   ;
#define RETURN(x)   {ret=x; goto end;}
#define PAGE_BAR_PADDING   2
#define PAGEBAR_BUTTON_PADDING   2
#define PAGEBAR_LISTBLOCKSIZE   128
#define PAGEBAR_ORIENTATION_X   0
#define PAGEBAR_ORIENTATION_Y   1
#define SCROLLBOX_LEFT   0
#define SCROLLBOX_RIGHT   1
#define SCROLLBOX_NONE   -1
#define TIMER_SPAN   1500
#define TRACE()

Enumerations

enum  { PAGE_SELECTED, LAST_SIGNAL }

Functions

static gboolean on_pagebar_exposed (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
static gboolean on_pagebar_configured (GtkWidget *widget, GdkEventConfigure *event, gpointer user_data)
static gboolean on_pagebar_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
static gboolean on_pagebar_button_release_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
static void pagebar_calculate (GtkPagebar *pagebar)
static void pagebar_draw_cpi (GtkPagebar *pagebar)
static void pagebar_draw_left (GtkPagebar *pagebar)
static void pagebar_draw_right (GtkPagebar *pagebar)
static int pagebar_scrollbox_hitTest (GtkPagebar *pagebar, int, int)
static gboolean pagebar_scrollbox_needLeft (GtkPagebar *pagebar)
static gboolean pagebar_scrollbox_needRight (GtkPagebar *pagebar)
static void gtk_pagebar_class_init (GtkPagebarClass *klass)
static void gtk_pagebar_init (GtkPagebar *pagebar)
static int loadBitmap (GdkPixbuf **buf, char *filename)
static int addToList (int **list, int *count, int value)
static int removeFromList (int **list, int *count, int value)
int addBookmark (GtkPagebar *pagebar, int value)
int addNote (GtkPagebar *pagebar, int value)
int removeBookmark (GtkPagebar *pagebar, int value)
int removeNote (GtkPagebar *pagebar, int value)
int pagebar_reset_values (GtkPagebar *pagebar)
int pagebar_load_bitmaps (GtkPagebar *pagebar)
static int currentPageChanged (GtkPagebar *pagebar)
GType gtk_pagebar_get_type (void)
GtkWidget * gtk_pagebar_new ()
static int drawMarkers (GtkPagebar *pagebar, int width, int y, int bitmap, int *markers, int count, int maxValue)
int gtk_pagebar_draw (GtkPagebar *pagebar)
gboolean on_idle (gpointer data)
void pagebar_reportSync (GtkPagebar *pagebar)

Variables

static gint pagebar_signals [LAST_SIGNAL] = { 0 }
static int framebuffer_device
static erClientChannel_t apabiChannel
static erClientChannel_t pdfChannel
static erClientChannel_t xhtmlChannel
static erClientChannel_t contentListerChannel
static erClientChannel_t scribbleChannel
static erClientChannel_t setupChannel
static erClientChannel_t connectChannel
static erClientChannel_t ebaChannel
static erClientChannel_t arincViewerChannel
static erClientChannel_t arincMenuChannel
static erClientChannel_t mobipocketChannel


Define Documentation

#define ENTER (  )     ;

Definition at line 66 of file gtkPagebar.c.

#define LEAVE (  )     ;

Definition at line 67 of file gtkPagebar.c.

#define PAGE_BAR_PADDING   2

Definition at line 72 of file gtkPagebar.c.

#define PAGEBAR_BUTTON_PADDING   2

Definition at line 73 of file gtkPagebar.c.

#define PAGEBAR_LISTBLOCKSIZE   128

Definition at line 75 of file gtkPagebar.c.

#define PAGEBAR_ORIENTATION_X   0

Definition at line 77 of file gtkPagebar.c.

#define PAGEBAR_ORIENTATION_Y   1

Definition at line 78 of file gtkPagebar.c.

#define PRINT_DEBUG (  )     ;

Definition at line 55 of file gtkPagebar.c.

#define PRINT_ERROR (  )     printf X

Definition at line 59 of file gtkPagebar.c.

#define PRINT_INFO (  )     ;

Definition at line 56 of file gtkPagebar.c.

#define PRINT_TRACE (  )     ;

Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.

Definition at line 54 of file gtkPagebar.c.

#define RETURN (  )     {ret=x; goto end;}

Definition at line 70 of file gtkPagebar.c.

#define SCROLLBOX_LEFT   0

Definition at line 79 of file gtkPagebar.c.

#define SCROLLBOX_NONE   -1

Definition at line 81 of file gtkPagebar.c.

#define SCROLLBOX_RIGHT   1

Definition at line 80 of file gtkPagebar.c.

#define TIMER_SPAN   1500

Definition at line 82 of file gtkPagebar.c.

 
#define TRACE (  ) 

Definition at line 84 of file gtkPagebar.c.


Enumeration Type Documentation

anonymous enum

Enumerator:
PAGE_SELECTED 
LAST_SIGNAL 

Definition at line 91 of file gtkPagebar.c.

00092 {
00093     PAGE_SELECTED,  // signals emitted when the user selects a page, using the page bar
00094     LAST_SIGNAL,
00095 };


Function Documentation

int addBookmark ( GtkPagebar pagebar,
int  value 
)

Definition at line 204 of file gtkPagebar.c.

00204                                                 {
00205     return addToList(&pagebar->bookmarks, &pagebar->bookmarkCount, value);
00206 }

Here is the call graph for this function:

int addNote ( GtkPagebar pagebar,
int  value 
)

Definition at line 208 of file gtkPagebar.c.

00208                                             {
00209     return addToList(&pagebar->notes, &pagebar->noteCount, value);
00210 }

Here is the call graph for this function:

static int addToList ( int **  list,
int *  count,
int  value 
) [static]

Definition at line 146 of file gtkPagebar.c.

00146                                                         {
00147     int i;
00148     int ret=0;
00149 
00150     ENTER(1);
00151 
00152     if (value<0)
00153         RETURN(-1);
00154 
00155     if (!(*list)) {
00156         (*list)=(int*)malloc(PAGEBAR_LISTBLOCKSIZE*sizeof(int));
00157         for (i=0; i<PAGEBAR_LISTBLOCKSIZE; i++)
00158             (*list)[i]=-1;
00159         *count = PAGEBAR_LISTBLOCKSIZE;
00160     }
00161 
00162     i=0;
00163     while (i<*count && (*list)[i]!=-1 && (*list)[i]!=value)
00164         i++;
00165 
00166     /* If the value is already present, we exit */
00167     if (i<*count && (*list)[i]==value)
00168         RETURN(0);
00169 
00170 
00171     /* If we ran out of space, we realloc the list */
00172     if (i==*count) {
00173         (*list)=(int*)realloc(*list, (*count+PAGEBAR_LISTBLOCKSIZE)*sizeof(int));
00174         for (i=0; i<PAGEBAR_LISTBLOCKSIZE; i++)
00175             (*list)[i+*count]=-1;
00176         *count += PAGEBAR_LISTBLOCKSIZE;
00177     }
00178 
00179     (*list)[i]=value;
00180 
00181 end:
00182     LEAVE(1);
00183     return ret;
00184 }

static int currentPageChanged ( GtkPagebar pagebar  )  [static]

Definition at line 362 of file gtkPagebar.c.

00362                                                    {
00363     erClientChannel_t channel;
00364     int ret = 0;
00365 
00366     ENTER(1);
00367 
00368     if (pagebar->lastPage==pagebar->currentPage)
00369         RETURN (0);
00370 
00371     pagebar->lastPage=pagebar->currentPage;
00372     gtk_pagebar_draw(pagebar);
00373 
00374     switch (pagebar->currentApp) {
00375         case ER_APABI_VIEWER_UA_ID:
00376             channel = apabiChannel;
00377             break;
00378         case ER_PDF_VIEWER_UA_ID:
00379             channel = pdfChannel;
00380             break;
00381         case ER_XHTML_VIEWER_UA_ID:
00382             channel = xhtmlChannel;
00383             break;
00384         case ER_SCRIBBLE_UA_ID:
00385             channel = scribbleChannel;
00386             break;
00387         case ER_CONTENT_LISTER_UA_ID:
00388             channel = contentListerChannel;
00389             clGotoPage(channel, pagebar->currentPage);
00390             RETURN (0);
00391         case ER_SETUP_UA_ID:
00392             channel = setupChannel;
00393             stGotoPage(channel, pagebar->currentPage);
00394             RETURN (0);
00395         case ER_CONNECT_UA_ID:
00396             channel = connectChannel;
00397             cnGotoPage(channel, pagebar->currentPage);
00398             RETURN (0);
00399         case ER_EBA_VIEWER_UA_ID:
00400             channel = ebaChannel;
00401             break;
00402         case ER_ARINC_VIEWER_UA_ID:
00403             channel = arincViewerChannel;
00404             arincJumpToPage(channel, pagebar->currentApp, pagebar->currentPage);
00405             RETURN (0);
00406         case ER_ARINC_MENU_UA_ID:
00407             channel = arincMenuChannel;
00408             arincJumpToPage(channel, pagebar->currentApp, pagebar->currentPage);
00409             RETURN (0);
00410         case ER_MOBIPOCKET_VIEWER_UA_ID:
00411             channel = mobipocketChannel;
00412             break;
00413         default:
00414             return -1;
00415     }    
00416     vwrJumpToPage(channel, pagebar->currentApp, pagebar->currentPage);
00417 
00418 end:
00419     LEAVE(1);
00420     return ret;
00421 }

Here is the call graph for this function:

static int drawMarkers ( GtkPagebar pagebar,
int  width,
int  y,
int  bitmap,
int *  markers,
int  count,
int  maxValue 
) [static]

Definition at line 735 of file gtkPagebar.c.

00735                                                                                                                  {
00736     int i;
00737     int j;
00738     int x;
00739 
00740     ENTER(1);
00741 
00742     for (i=0; i<count && markers[i]!=-1; i++) {
00743         /* Convert bookmark to pagenumber */
00744         j=markers[i]*pagebar->pagecount/maxValue;
00745         if (j>pagebar->currentPage) {
00746             x = pagebar->barXPos+(pagebar->barWidth+pagebar->cpiWidth)/2;
00747             /* & 0xFFFFFFFC: Align to markers */
00748             if (j>=pagebar->pagecount) 
00749                 x += (((pagebar->pagecount-pagebar->currentPage-1)*width/(pagebar->pagecount-2))&0xFFFFFFFC)+pagebar->pageFieldWidth/2;
00750             else
00751                 x += (((pagebar->pagecount-pagebar->currentPage-1)*width/(pagebar->pagecount-2))*(j-pagebar->currentPage-1)/(pagebar->pagecount-1-pagebar->currentPage-1))&0xFFFFFFFC;
00752             /* Bitmaps aren't transparant so we can't draw over the CPI. In that case we move the marker a little bit to the right */
00753             if (x-(pagebar->barXPos+(pagebar->barWidth+pagebar->cpiWidth)/2)<2)
00754                 x+=3;
00755 
00756 #ifdef USE_BITMAPS
00757             gdk_draw_pixbuf(pagebar->pixmap, NULL, pagebar->bitmaps[bitmap], 0,0,x-2,y,-1,-1,GDK_RGB_DITHER_NONE,0,0);
00758 #else
00759             gdk_draw_line(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, x, y, x, y+6);
00760 #endif
00761         }
00762         else if (j<pagebar->currentPage) {
00763             x = pagebar->barXPos+(pagebar->barWidth-pagebar->cpiWidth)/2-2;
00764             if (j==1)
00765                 x -= ((width*(pagebar->currentPage-2)/(pagebar->pagecount-2))&0xFFFFFFFC) + pagebar->pageFieldWidth/2;
00766             else
00767                 x -= (width*(pagebar->currentPage-2)/(pagebar->pagecount-2)*(pagebar->currentPage-j-1)/(pagebar->currentPage-3))&0xFFFFFFFC;
00768 
00769 #ifdef USE_BITMAPS
00770             gdk_draw_pixbuf(pagebar->pixmap, NULL, pagebar->bitmaps[bitmap], 0,0,x-2,y,-1,-1,GDK_RGB_DITHER_NONE,0,0);
00771 #else
00772             gdk_draw_line(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, x, y, x, y+6);
00773 #endif
00774         }
00775     }
00776 
00777     LEAVE(1);
00778 
00779     return 0;
00780 }

static void gtk_pagebar_class_init ( GtkPagebarClass klass  )  [static]

Definition at line 635 of file gtkPagebar.c.

00636 {
00637     GtkObjectClass *object_class;
00638 
00639     ENTER(0);
00640 
00641     object_class = (GtkObjectClass *) klass;
00642 
00643     // event to notify page update 
00644 
00645     pagebar_signals[PAGE_SELECTED] =
00646         g_signal_new ("pagebar_page_selected",
00647         G_OBJECT_CLASS_TYPE (object_class),
00648         G_SIGNAL_RUN_LAST,
00649         G_STRUCT_OFFSET (GtkPagebarClass, pagebar_page_selected),
00650         NULL, NULL,
00651         gtk_marshal_VOID__INT,
00652         G_TYPE_NONE,
00653         1,
00654         G_TYPE_INT);
00655     LEAVE(0);
00656 }

int gtk_pagebar_draw ( GtkPagebar pagebar  ) 

Definition at line 791 of file gtkPagebar.c.

00792 {
00793     int ret = 0;
00794 
00795     ENTER(1);
00796     
00797 
00798     if (!IS_GTK_PAGEBAR(pagebar)) {
00799         RETURN(-1);
00800     }
00801     
00802   
00803     if (!pagebar->pixmap) 
00804         RETURN(-1);
00805 
00806     /* If the user moved the window, we first have to do that */
00807     if (pagebar->lastDrawAreaXPos!=pagebar->drawAreaXPos || pagebar->lastDrawAreaYPos!=pagebar->drawAreaYPos) {
00808         pagebar->lastDrawAreaXPos=pagebar->drawAreaXPos;
00809         pagebar->lastDrawAreaYPos=pagebar->drawAreaYPos;
00810         gtk_window_move(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(pagebar))), pagebar->drawAreaXPos, pagebar->drawAreaYPos);
00811     }
00812 
00813     /* If the user resized the window, we first have to do that */
00814     if (pagebar->lastDrawAreaWidth!=pagebar->drawAreaWidth || pagebar->lastDrawAreaHeight!=pagebar->drawAreaHeight) {
00815         pagebar->lastDrawAreaWidth=pagebar->drawAreaWidth;
00816         pagebar->lastDrawAreaHeight=pagebar->drawAreaHeight;
00817         gtk_widget_set_size_request(GTK_WIDGET(gtk_widget_get_toplevel(GTK_WIDGET(pagebar))), pagebar->drawAreaWidth, pagebar->drawAreaHeight);
00818     }
00819 
00820     // clear the area
00821     gdk_draw_rectangle (pagebar->pixmap,
00822         GTK_WIDGET(pagebar->drawingArea)->style->white_gc, 
00823         TRUE, 
00824         pagebar->barXPos, 
00825         pagebar->barYPos, 
00826         pagebar->barWidth, 
00827         pagebar->barHeight);
00828 
00829     if (!pagebar->show)
00830         RETURN(-1);
00831 
00832     // calculate
00833     pagebar_calculate(pagebar);
00834 
00835     // draw cpi 
00836     pagebar_draw_cpi(pagebar);
00837 
00838     if (pagebar->pagecount==1)
00839         RETURN(0);
00840 
00841     // draw the others
00842     pagebar_draw_left(pagebar);
00843     pagebar_draw_right(pagebar);
00844 end:
00845     // make things appear on the screen 
00846     gtk_widget_queue_draw(GTK_WIDGET(pagebar->drawingArea));
00847     PRINT_TRACE(("gtk_widget_queue_draw_area called \n"));
00848 
00849     LEAVE(1);
00850 
00851     return ret; 
00852 }

Here is the call graph for this function:

GType gtk_pagebar_get_type ( void   ) 

Definition at line 610 of file gtkPagebar.c.

00611 {
00612     static GType pagebar_type = 0;
00613 
00614     if (!pagebar_type)
00615     {
00616         static const GTypeInfo pagebar_info =
00617         {
00618             sizeof (GtkPagebarClass),
00619             NULL, /* base_init */
00620             NULL, /* base_finalize */
00621             (GClassInitFunc) gtk_pagebar_class_init,
00622             NULL, /* class_finalize */
00623             NULL, /* class_data */
00624             sizeof (GtkPagebar),
00625             0,    /* n_preallocs */
00626             (GInstanceInitFunc) gtk_pagebar_init,
00627         };
00628 
00629         pagebar_type = g_type_register_static (GTK_TYPE_EVENT_BOX, "Pagebar", &pagebar_info, 0);  
00630     }
00631 
00632     return pagebar_type;
00633 }

Here is the call graph for this function:

static void gtk_pagebar_init ( GtkPagebar pagebar  )  [static]

Definition at line 658 of file gtkPagebar.c.

00659 {
00660     ENTER(0);
00661 
00662     /* create drawingarea */
00663     pagebar->drawingArea = gtk_drawing_area_new();
00664 
00665     gtk_widget_set_events (GTK_WIDGET(pagebar->drawingArea), GDK_EXPOSURE_MASK | GDK_LEAVE_NOTIFY_MASK |  GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK );
00666 
00667     gtk_container_add(GTK_CONTAINER(pagebar),pagebar->drawingArea);
00668 
00669     gtk_signal_connect(GTK_OBJECT(pagebar->drawingArea), "expose-event", GTK_SIGNAL_FUNC(on_pagebar_exposed),pagebar);
00670     gtk_signal_connect(GTK_OBJECT(pagebar->drawingArea), "configure-event", GTK_SIGNAL_FUNC(on_pagebar_configured),pagebar);
00671 
00672     g_signal_connect (G_OBJECT (pagebar->drawingArea), "button_press_event",  G_CALLBACK (on_pagebar_button_press_event), pagebar);
00673 
00674     g_signal_connect (G_OBJECT (pagebar->drawingArea), "button_release_event",  G_CALLBACK (on_pagebar_button_release_event), pagebar);
00675 
00676     erIpcStartClient(ER_APABI_VIEWER_CHANNEL,      &apabiChannel        );
00677     erIpcStartClient(ER_PDF_VIEWER_CHANNEL,        &pdfChannel          );
00678     erIpcStartClient(ER_XHTML_VIEWER_CHANNEL,      &xhtmlChannel        );
00679     erIpcStartClient(ER_CONTENTLISTER_CHANNEL,     &contentListerChannel);
00680     erIpcStartClient(ER_SCRIBBLE_CHANNEL,          &scribbleChannel     );
00681     erIpcStartClient(ER_SETUP_CHANNEL,             &setupChannel        );
00682     erIpcStartClient(ER_CONNECT_CHANNEL,           &connectChannel      );
00683     erIpcStartClient(ER_EBA_VIEWER_CHANNEL,        &ebaChannel          );
00684     erIpcStartClient(ER_ARINC_VIEWER_CHANNEL,      &arincViewerChannel  );
00685     erIpcStartClient(ER_ARINC_MENU_CHANNEL,        &arincMenuChannel    );
00686     erIpcStartClient(ER_MOBIPOCKET_VIEWER_CHANNEL, &mobipocketChannel   );
00687 
00688     gtk_widget_show(pagebar->drawingArea);
00689 
00690     LEAVE(0);
00691 }

Here is the call graph for this function:

GtkWidget* gtk_pagebar_new (  ) 

Definition at line 693 of file gtkPagebar.c.

00694 {
00695     GtkPagebar* pagebar;
00696     PangoFontDescription* fontdesc;
00697 
00698     ENTER(0);
00699 
00700     pagebar = (GtkPagebar*) g_object_new(GTK_PAGEBAR_TYPE,NULL);
00701 
00702     memset(pagebar->bitmaps, 0, sizeof(pagebar->bitmaps));
00703     pagebar->bookmarks = NULL;
00704     pagebar->notes = NULL;
00705 
00706     // init data fields
00707     pagebar_reset_values(pagebar);
00708     pagebar_load_bitmaps(pagebar);
00709 
00710     framebuffer_device = open("/dev/fb0", O_RDWR);    
00711 
00712     PRINT_DEBUG(("bar format %dx%d\n",pagebar->drawAreaWidth,pagebar->drawAreaHeight));
00713 
00714     gtk_drawing_area_size(GTK_DRAWING_AREA(pagebar->drawingArea),pagebar->drawAreaWidth,pagebar->drawAreaHeight);
00715 
00716     pagebar->pangolayout=gtk_widget_create_pango_layout(GTK_WIDGET(pagebar->drawingArea),"X");
00717     fontdesc = pango_font_description_from_string("Bitstream Vera 6.5");
00718 //    pango_font_description_set_size(fontdesc, PAGEBAR_DEFAULT_CPIFONTHEIGHT);
00719     pango_layout_set_font_description(pagebar->pangolayout, fontdesc);
00720     pango_font_description_free(fontdesc);
00721     pango_layout_get_pixel_size(pagebar->pangolayout,&pagebar->barFontWidth,&pagebar->barFontHeight);
00722 
00723     pagebar->cpiFontWidth = pagebar->barFontWidth;
00724 
00725     PRINT_DEBUG(("text format %dx%d\n",pagebar->barFontWidth,pagebar->barFontHeight));
00726 
00727     //gtk_widget_show(pagebar->drawingArea);
00728 
00729     LEAVE(0);
00730 
00731     return GTK_WIDGET(pagebar);
00732 }

Here is the call graph for this function:

static int loadBitmap ( GdkPixbuf **  buf,
char *  filename 
) [static]

Definition at line 129 of file gtkPagebar.c.

00129                                                        {
00130     GError *error = NULL;
00131     int ret=0;
00132 
00133     ENTER(1);
00134 
00135     (*buf) = gdk_pixbuf_new_from_file(filename, &error);
00136     if ((*buf)==NULL) {
00137         PRINT_ERROR(("Error loading bitmap %s (%s)\n", filename, error->message));
00138         RETURN(-1);
00139     }
00140 
00141 end:
00142     LEAVE(1);
00143     return ret;
00144 }

gboolean on_idle ( gpointer  data  ) 

Definition at line 1168 of file gtkPagebar.c.

01169 {
01170     GtkPagebar *pagebar = (GtkPagebar *)data;
01171     gdk_threads_enter();
01172     gdk_flush();
01173     gdk_threads_leave();
01174     
01175     erClientChannel_t channel;
01176     switch (pagebar->currentApp) 
01177     {
01178     case ER_APABI_VIEWER_UA_ID:
01179         channel = apabiChannel;
01180         break;
01181     case ER_PDF_VIEWER_UA_ID:
01182         channel = pdfChannel;
01183         break;
01184     case ER_XHTML_VIEWER_UA_ID:
01185         channel = xhtmlChannel;
01186         break;
01187     case ER_SCRIBBLE_UA_ID:
01188         channel = scribbleChannel;
01189         break;
01190     case ER_CONTENT_LISTER_UA_ID:
01191         channel = contentListerChannel;
01192         break;
01193     case ER_SETUP_UA_ID:
01194         channel = setupChannel;
01195         break;
01196     case ER_CONNECT_UA_ID:
01197         channel = connectChannel;
01198         break;
01199     case ER_EBA_VIEWER_UA_ID:
01200         channel = ebaChannel;
01201         break;
01202     case ER_ARINC_VIEWER_UA_ID:
01203         channel = arincViewerChannel;
01204         break;
01205     case ER_ARINC_MENU_UA_ID:
01206         channel = arincMenuChannel;
01207         break;
01208     default:
01209         return FALSE;
01210     }    
01211     // printf("\nPagebar reports synchronise message to %d\n", pagebar->currentApp);
01212     pbReportSynchronise(channel, pagebar->currentApp);
01213     return FALSE;
01214 }

Here is the call graph for this function:

static gboolean on_pagebar_button_press_event ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  user_data 
) [static]

Definition at line 474 of file gtkPagebar.c.

00475 {
00476     GtkPagebar* pagebar = GTK_PAGEBAR(user_data);
00477     int x=event->x;
00478     int y=event->y;
00479     int i;
00480     int j;
00481 
00482 
00483     ENTER(0);
00484 
00485     PRINT_TRACE(("button_press_event -- location %dx%d - %dx%d \n",(int)event->x,(int)event->y,(int)event->x_root,(int)event->y_root));
00486 
00487     /* Check if we clicked on the CPI */
00488     if (x>=pagebar->barXPos+(pagebar->barWidth-pagebar->cpiWidth)/2 && x<=pagebar->barXPos+(pagebar->barWidth+pagebar->cpiWidth)/2 &&
00489         y>=pagebar->barYPos+(pagebar->barHeight-pagebar->cpiHeight)/2 && y<=pagebar->barYPos+(pagebar->barHeight+pagebar->cpiHeight)/2)
00490     {
00491         /* Did we press the expand/collapse button?  -- disabled */
00492         /***
00493         if (y<pagebar->barYPos+(pagebar->barHeight-pagebar->cpiHeight)/2+10) {
00494         pagebar->zoomMode=!pagebar->zoomMode;
00495         gtk_pagebar_draw(pagebar);
00496         dmDisplay(dmCmdPriorUrgent, dmQFull);
00497         }
00498         else {
00499         ***/
00500 
00501         /***
00502         gtk_widget_show(pagebar->pageEntry);
00503         gtk_widget_grab_focus(pagebar->pageEntry);
00504         gtk_entry_set_text(GTK_ENTRY(pagebar->pageEntry), "");
00505         gtk_entry_set_alignment(GTK_ENTRY(pagebar->pageEntry), 0.5);
00506         gtk_entry_set_activates_default(GTK_ENTRY(pagebar->pageEntry), TRUE);
00507         g_signal_connect(GTK_OBJECT(pagebar->pageEntry), "activate", G_CALLBACK(on_pageentry_activate),pagebar);
00508         gtk_signal_connect(GTK_OBJECT(pagebar->pageEntry), "changed", GTK_SIGNAL_FUNC(on_text_changed),pagebar);
00509         gtk_signal_connect(GTK_OBJECT(pagebar->drawingArea), "expose-event", GTK_SIGNAL_FUNC(on_pagebar_exposed),pagebar);
00510         ***/
00511 
00512         // zeng. update . according to new design
00513         pagebar->zoomMode=!pagebar->zoomMode;
00514         gtk_pagebar_draw(pagebar);
00515        
00516 
00517         // change to DM_QUALITY_FULL if not acceptable
00518         display_update_request_screen_refresh(MAIN_WINDOW_EXPOSE_LEVEL, (void*) DM_QUALITY_TYPING);
00519     }
00520     else 
00521     {
00522         if (pagebar->zoomMode==0) {
00523             int smallBarWidth;
00524             smallBarWidth = (pagebar->barWidth-pagebar->cpiWidth)/2-pagebar->pageFieldWidth;
00525             /* Check if we clicked on the left part of the bar */
00526             if (x<pagebar->barXPos+(pagebar->barWidth-pagebar->cpiWidth)/2 && pagebar->currentPage!=1) {
00527                 i=pagebar->barXPos+(pagebar->barWidth-pagebar->cpiWidth)/2-x;
00528                 i=i*(pagebar->pagecount-2)/(smallBarWidth);
00529                 if (i<pagebar->currentPage-1) {
00530                     pagebar->currentPage-=(i+1);
00531                 }
00532                 else {
00533                     pagebar->currentPage=1;
00534                 }          
00535                 currentPageChanged(pagebar);
00536             }
00537             /* We clicked on the right part of the bar */ 
00538             else if (x>pagebar->barXPos+(pagebar->barWidth+pagebar->cpiWidth)/2 && pagebar->currentPage!=pagebar->pagecount) {
00539                 i=x-(pagebar->barXPos+(pagebar->barWidth+pagebar->cpiWidth)/2);
00540                 i=i*(pagebar->pagecount-2)/(smallBarWidth);
00541                 if (i<pagebar->pagecount-pagebar->currentPage) {
00542                     pagebar->currentPage+=(i+1);
00543                 }
00544                 else {
00545                     pagebar->currentPage=pagebar->pagecount;
00546                 }          
00547                 currentPageChanged(pagebar);
00548             } 
00549         }
00550         else if (pagebar->zoomMode==1) {
00551 
00552             /* Calculate the number of pages we can show on each side of the CPI */
00553             j = ((pagebar->barWidth-pagebar->cpiWidth)/2-pagebar->scrollButtonWidth)/pagebar->pageFieldWidth;
00554             /* Check if we clicked on the left part of the bar */
00555             if (x<pagebar->barXPos+(pagebar->barWidth-pagebar->cpiWidth)/2 &&
00556                 x>pagebar->barXPos+(pagebar->barWidth-pagebar->cpiWidth)/2-j*pagebar->pageFieldWidth &&
00557                 pagebar->currentPage!=1)
00558             {
00559                 i=pagebar->barXPos+(pagebar->barWidth-pagebar->cpiWidth)/2-x;
00560                 i/=pagebar->pageFieldWidth;
00561                 if (i<pagebar->currentPage-1 && i<j) 
00562                 {
00563                     pagebar->currentPage-=(i+1);
00564                     currentPageChanged(pagebar);
00565                 }
00566             }
00567             /* Check if we clicked on the right part of the bar */ 
00568             else if (x>pagebar->barXPos+(pagebar->barWidth+pagebar->cpiWidth)/2 && 
00569                 x<pagebar->barXPos+(pagebar->barWidth+pagebar->cpiWidth)/2+j*pagebar->pageFieldWidth && 
00570                 pagebar->currentPage!=pagebar->pagecount) 
00571             {
00572                 i=x-(pagebar->barXPos+(pagebar->barWidth+pagebar->cpiWidth)/2);
00573                 i/=pagebar->pageFieldWidth;
00574                 if (i<pagebar->pagecount-pagebar->currentPage && i<j) 
00575                 {
00576                     pagebar->currentPage+=(i+1);
00577                     currentPageChanged(pagebar);
00578                 } 
00579             } 
00580             /* Check if we clicked on the scroll left button */    
00581             /* replace j with pagebar->maxItems */       
00582             else if (SCROLLBOX_LEFT == pagebar_scrollbox_hitTest(pagebar, x, y))
00583             {
00584                 // MvdW: changed this to be non-confusing ;)
00585                 // the left & right were swapped. 
00586                 pagebar->currentPage-=2*pagebar->maxItems+1;
00587                 if (pagebar->currentPage<1)
00588                     pagebar->currentPage=1;
00589 
00590                 currentPageChanged(pagebar);
00591 
00592             }
00593             else if (SCROLLBOX_RIGHT == pagebar_scrollbox_hitTest(pagebar, x, y))
00594             {
00595                 pagebar->currentPage+=2*pagebar->maxItems+1;
00596                 if (pagebar->currentPage>pagebar->pagecount)
00597                     pagebar->currentPage=pagebar->pagecount;
00598 
00599                 currentPageChanged(pagebar);
00600             }
00601         }
00602     }
00603 
00604     LEAVE(0);
00605 
00606     return TRUE;
00607 }

Here is the call graph for this function:

static gboolean on_pagebar_button_release_event ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  user_data 
) [static]

Definition at line 351 of file gtkPagebar.c.

00352 {
00353     ENTER(1);
00354 
00355     PRINT_TRACE(("button_release_event -- location %dx%d - %dx%d \n",(int)event->x,(int)event->y,(int)event->x_root,(int)event->y_root));
00356 
00357     LEAVE(1);
00358 
00359     return TRUE;        
00360 }

static gboolean on_pagebar_configured ( GtkWidget *  widget,
GdkEventConfigure *  event,
gpointer  user_data 
) [static]

Definition at line 306 of file gtkPagebar.c.

00307 {
00308     GtkPagebar* pagebar = GTK_PAGEBAR(user_data);
00309 
00310     ENTER(0);
00311 
00312     if (pagebar->pixmap)
00313         g_object_unref (pagebar->pixmap);
00314 
00315     pagebar->pixmap = gdk_pixmap_new (widget->window,
00316         widget->allocation.width,
00317         widget->allocation.height,
00318         -1);
00319     gdk_draw_rectangle (pagebar->pixmap,
00320         widget->style->white_gc,
00321         TRUE,
00322         0, 0,
00323         widget->allocation.width,
00324         widget->allocation.height);
00325 
00326     gtk_pagebar_draw(pagebar);
00327     LEAVE(0);
00328     return TRUE;
00329 }

Here is the call graph for this function:

static gboolean on_pagebar_exposed ( GtkWidget *  widget,
GdkEventExpose *  event,
gpointer  user_data 
) [static]

Definition at line 332 of file gtkPagebar.c.

00333 {
00334 
00335     GtkPagebar* pagebar = GTK_PAGEBAR(user_data);
00336 
00337     ENTER(0);
00338 
00339     /* Copy image from pixmap to output */
00340     gdk_draw_drawable (widget->window,  
00341         widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
00342         pagebar->pixmap,
00343         event->area.x, event->area.y,
00344         event->area.x, event->area.y,
00345         event->area.width, event->area.height);
00346     
00347     LEAVE(0);
00348     return FALSE;
00349 }

void pagebar_calculate ( GtkPagebar pagebar  )  [static]

Definition at line 900 of file gtkPagebar.c.

00901 {
00902     if (PAGEBAR_ORIENTATION_X == pagebar->orientation)
00903     {
00904         pagebar->cpiXPos  = pagebar->barXPos + (pagebar->barWidth-pagebar->cpiWidth)/2;
00905         pagebar->cpiYPos  = pagebar->barYPos - (pagebar->cpiHeight -pagebar->barHeight)/2;
00906         pagebar->maxItems = ((pagebar->barWidth-pagebar->cpiWidth)/2-pagebar->scrollButtonWidth)/pagebar->pageFieldWidth; 
00907     }
00908     else if (PAGEBAR_ORIENTATION_Y == pagebar->orientation)
00909     {
00910         // make sure bar height is larger than cpi height
00911         pagebar->cpiXPos  = (pagebar->barWidth-pagebar->cpiWidth)/2;
00912         pagebar->cpiYPos  = pagebar->barYPos + (pagebar->barHeight - pagebar->cpiHeight)/2;        
00913         pagebar->maxItems = ((pagebar->barHeight - pagebar->cpiHeight)/2-pagebar->scrollButtonHeight)/pagebar->pageFieldHeight; 
00914     }
00915 }

void pagebar_draw_cpi ( GtkPagebar pagebar  )  [static]

Definition at line 920 of file gtkPagebar.c.

00921 {
00922     // If there are less pages than we can show, overview mode is not used 
00923     // mode can only be changed when user click cpi
00924     int canZoom  = 1;
00925     int x = 0, y = 0, w = 0, h = 0;
00926     char pageStr[16] = {0};
00927     if (pagebar->pagecount<= pagebar->maxItems *2+1) {
00928         pagebar->zoomMode = 1;
00929         canZoom = 0;
00930     }
00931 
00932     /* Once we have to redraw the pagebar, we don't need the pageEntry anymore */
00933     gtk_widget_hide(pagebar->pageEntry);
00934 
00935     /* Draw Current Page Indicator, load differnet indicator according orientation*/
00936 #ifdef USE_BITMAPS
00937     gdk_draw_pixbuf(pagebar->pixmap, NULL, pagebar->bitmaps[bitmap_CPI], 0, 0,
00938         pagebar->cpiXPos, pagebar->cpiYPos, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
00939 #else
00940     gdk_draw_rectangle(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, FALSE, 
00941         pagebar->cpiXPos, pagebar->cpiYPos, pagebar->cpiWidth, h);
00942 #endif
00943 
00944     /* Draw pageoffset */
00945     if (pagebar->currentPageOffset <= PAGEBAR_DEFAULT_CURRENTPAGEOFFSET)
00946     {
00947         int i = pagebar->currentPageOffset*pagebar->pageOffsetWidth/PAGEBAR_DEFAULT_CURRENTPAGEOFFSET;
00948         x = pagebar->cpiXPos;
00949         y = pagebar->cpiYPos;
00950         gdk_draw_rectangle(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, TRUE, 
00951             x+pagebar->pageOffsetXOffset, 
00952             y+pagebar->pageOffsetYOffset, 
00953             i, 
00954             pagebar->pageOffsetHeight);
00955         gdk_draw_rectangle(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->white_gc, TRUE, 
00956             x+pagebar->pageOffsetXOffset+i, 
00957             y+pagebar->pageOffsetYOffset, 
00958             pagebar->pageOffsetWidth-i, 
00959             pagebar->pageOffsetHeight);
00960     }
00961 
00962     /* Draw pagenumber */
00963     sprintf(pageStr, "%d", pagebar->currentPage);
00964     pango_layout_set_text(pagebar->pangolayout, pageStr, -1);
00965     pango_layout_get_pixel_size(pagebar->pangolayout,&w,&h);
00966     x = pagebar->barXPos + (pagebar->barWidth-w)/2;
00967     y = pagebar->barYPos + (pagebar->barHeight-h)/2;
00968     gdk_draw_layout(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, x, y, pagebar->pangolayout);
00969 }

void pagebar_draw_left ( GtkPagebar pagebar  )  [static]

Definition at line 976 of file gtkPagebar.c.

00977 {
00978     int w = 0, x = 0, y = 0;
00979     int i = 0, j = 0;
00980     char pageStr[16] = {0};
00981     int left = 1;
00982 
00983     // init 
00984     x = pagebar->cpiXPos;
00985     y = pagebar->cpiYPos + (pagebar->cpiHeight - pagebar->pageFieldHeight)/2;
00986 
00987     // check can we display all. 
00988     if (pagebar->pagecount > 2 * pagebar->maxItems + 1 && 0 == pagebar->zoomMode)
00989     {
00990         // can not display all
00991         w = (pagebar->barWidth-pagebar->cpiWidth)/2-pagebar->pageFieldWidth;
00992         y = pagebar->barYPos+(pagebar->barHeight-pagebar->pageFieldHeight)/2;
00993         x = pagebar->barXPos+(pagebar->barWidth-pagebar->cpiWidth)/2-2;
00994         if (pagebar->currentPage!=1) 
00995         {
00996             for (i=0; i<w*(pagebar->currentPage-2)/(pagebar->pagecount-2)/4; i++) 
00997             {
00998                 gdk_draw_rectangle(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, FALSE, x, y, 1, pagebar->pageFieldHeight);
00999                 x-=4;
01000             }
01001             x=x-pagebar->pageFieldWidth+1;
01002 #ifdef USE_BITMAPS
01003             gdk_draw_pixbuf(pagebar->pixmap, NULL, pagebar->bitmaps[bitmap_PageField], 0,0,x,y,-1,-1,GDK_RGB_DITHER_NONE,0,0);
01004 #else
01005             gdk_draw_rectangle(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, FALSE, x, y, pagebar->pageFieldWidth, pagebar->pageFieldHeight);
01006 #endif
01007             sprintf(pageStr, "1");
01008             pango_layout_set_text(pagebar->pangolayout, pageStr, -1);
01009             pango_layout_get_pixel_size(pagebar->pangolayout,&i,&j);
01010             gdk_draw_layout(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, x+(pagebar->pageFieldWidth-i)/2, y+(pagebar->pageFieldHeight-j)/2, pagebar->pangolayout);
01011         }
01012         /* Draw bookmarks */
01013         if (pagebar->bookmarkMaxValue)
01014             drawMarkers(pagebar, w, y-6, bitmap_Bookmark, pagebar->bookmarks, pagebar->bookmarkCount, pagebar->bookmarkMaxValue);
01015         if (pagebar->notesMaxValue)
01016             drawMarkers(pagebar, w, y+pagebar->pageFieldHeight, bitmap_Note, pagebar->notes, pagebar->noteCount, pagebar->notesMaxValue);
01017     }
01018     else
01019     {
01020         // display in detail
01021         for(left; left < pagebar->currentPage && left <= pagebar->maxItems; ++left)
01022         {
01023             x -= pagebar->pageFieldWidth;  
01024             gdk_draw_rectangle(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->white_gc, FALSE, x, y, 1, pagebar->pageFieldHeight);
01025 
01026 #ifdef USE_BITMAPS
01027             gdk_draw_pixbuf(pagebar->pixmap, NULL, pagebar->bitmaps[bitmap_PageField], 0,0,x,y,-1,-1,GDK_RGB_DITHER_NONE,0,0);
01028 #else
01029             gdk_draw_rectangle(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, FALSE, x, y, pagebar->pageFieldWidth, pagebar->pageFieldHeight);
01030 #endif
01031 
01032             sprintf(pageStr, "%d", pagebar->currentPage - left );
01033             pango_layout_set_text(pagebar->pangolayout, pageStr, -1);
01034             pango_layout_get_pixel_size(pagebar->pangolayout,&i,&j);
01035             gdk_draw_layout(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, x+(pagebar->pageFieldWidth-i)/2, y+(pagebar->pageFieldHeight-j)/2, pagebar->pangolayout);
01036         }
01037         /* need scroll bar or not */
01038         /* something confused. left one indicates right, right one indicates left. understand? */
01039         if (pagebar_scrollbox_needLeft(pagebar))
01040         {
01041             x = pagebar->cpiXPos - pagebar->maxItems * pagebar->pageFieldWidth;
01042             x-=pagebar->scrollButtonWidth;
01043 #ifdef USE_BITMAPS
01044             gdk_draw_pixbuf(pagebar->pixmap, NULL, pagebar->bitmaps[bitmap_ScrollLeft], 0,0,x,y,-1,-1,GDK_RGB_DITHER_NONE,0,0);
01045 #else
01046             gdk_draw_rectangle(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, TRUE, x, y, pagebar->scrollButtonWidth, pagebar->pageFieldHeight);
01047 #endif
01048         }
01049         else
01050         {
01051             // load a gray one. 
01052         }
01053         /* draw bookmarkers */
01054         i = pagebar->maxItems;
01055         for (j=0; pagebar->bookmarkMaxValue > 0 && j<pagebar->bookmarkCount && pagebar->bookmarks[j]!=-1; j++)
01056         {
01057             int page;
01058             page=pagebar->bookmarks[j]*pagebar->pagecount/pagebar->bookmarkMaxValue;
01059             if (page<pagebar->currentPage && page>=pagebar->currentPage-i)
01060                 x=pagebar->barXPos+(pagebar->barWidth-pagebar->cpiWidth)/2-(pagebar->currentPage-page)*pagebar->pageFieldWidth+pagebar->pageFieldWidth/2;
01061             else if (page>pagebar->currentPage && page<=pagebar->currentPage+i)
01062                 x=pagebar->barXPos+(pagebar->barWidth+pagebar->cpiWidth)/2+(page-pagebar->currentPage-1)*pagebar->pageFieldWidth+pagebar->pageFieldWidth/2;
01063             else
01064                 continue;
01065 
01066 #ifdef USE_BITMAPS
01067             gdk_draw_pixbuf(pagebar->pixmap, NULL, pagebar->bitmaps[bitmap_Bookmark], 0,0,x,y-6,-1,-1,GDK_RGB_DITHER_NONE,0,0);
01068 #else
01069             gdk_draw_line(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, x, y-6, x, y);
01070 #endif        
01071         }    
01072         for (j=0; pagebar->notesMaxValue > 0 && j<pagebar->noteCount && pagebar->notes[j]!=-1; j++)
01073         {
01074             int page;
01075             page=pagebar->notes[j]*pagebar->pagecount/pagebar->notesMaxValue;
01076             if (page<pagebar->currentPage && page>=pagebar->currentPage-i)
01077                 x=pagebar->barXPos+(pagebar->barWidth-pagebar->cpiWidth)/2-(pagebar->currentPage-page)*pagebar->pageFieldWidth+pagebar->pageFieldWidth/2;
01078             else if (page>pagebar->currentPage && page<=pagebar->currentPage+i)
01079                 x=pagebar->barXPos+(pagebar->barWidth+pagebar->cpiWidth)/2+(page-pagebar->currentPage-1)*pagebar->pageFieldWidth+pagebar->pageFieldWidth/2;
01080             else
01081                 continue;
01082 
01083 #ifdef USE_BITMAPS
01084             gdk_draw_pixbuf(pagebar->pixmap, NULL, pagebar->bitmaps[bitmap_Note], 0,0,x,y+pagebar->pageFieldHeight,-1,-1,GDK_RGB_DITHER_NONE,0,0);
01085 #else
01086             gdk_draw_line(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, x, y+pagebar->pageFieldHeight, x, y+pagebar->pageFieldHeight+6);
01087 #endif        
01088         }  
01089     }
01090 }

Here is the call graph for this function:

void pagebar_draw_right ( GtkPagebar pagebar  )  [static]

Definition at line 1092 of file gtkPagebar.c.

01093 {
01094     int w = 0, x = 0, y = 0;
01095     int i = 0, j = 0;
01096     char pageStr[16] = {0};
01097     int right = 1;
01098 
01099     // init 
01100     x = pagebar->cpiXPos + pagebar->cpiWidth;
01101     y = pagebar->cpiYPos + (pagebar->cpiHeight - pagebar->pageFieldHeight)/2;
01102 
01103     // check can we display all 
01104     if (pagebar->pagecount > 2 * pagebar->maxItems + 1  && 0 == pagebar->zoomMode)
01105     {
01106         // can not display all
01107         w = (pagebar->barWidth-pagebar->cpiWidth)/2-pagebar->pageFieldWidth;
01108         x = pagebar->barXPos+(pagebar->barWidth+pagebar->cpiWidth)/2;
01109         y = pagebar->barYPos+(pagebar->barHeight-pagebar->pageFieldHeight)/2;
01110         if (pagebar->currentPage!=pagebar->pagecount) 
01111         {
01112             for (i=0; i<w*(pagebar->pagecount-pagebar->currentPage-1)/(pagebar->pagecount-2)/4; i++) 
01113             {
01114                 gdk_draw_rectangle(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, FALSE, x, y, 1, pagebar->pageFieldHeight);
01115                 x+=4;
01116             }
01117 #ifdef USE_BITMAPS
01118             gdk_draw_pixbuf(pagebar->pixmap, NULL, pagebar->bitmaps[bitmap_PageField], 0,0,x,y,-1,-1,GDK_RGB_DITHER_NONE,0,0);
01119 #else
01120             gdk_draw_rectangle(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, FALSE, x, y, pagebar->pageFieldWidth, pagebar->pageFieldHeight);
01121 #endif      
01122             sprintf(pageStr, "%d", pagebar->pagecount);
01123             pango_layout_set_text(pagebar->pangolayout, pageStr, -1);
01124             pango_layout_get_pixel_size(pagebar->pangolayout,&i,&j);
01125             gdk_draw_layout(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, x+(pagebar->pageFieldWidth-i)/2, y+(pagebar->pageFieldHeight-j)/2, pagebar->pangolayout);
01126         }
01127     }
01128     else
01129     {
01130         // display in detail
01131         for(right; right <= pagebar->pagecount - pagebar->currentPage && right <= pagebar->maxItems; ++right)
01132         {
01133             gdk_draw_rectangle(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->white_gc, FALSE, x, y, 1, pagebar->pageFieldHeight);
01134 
01135 #ifdef USE_BITMAPS
01136             gdk_draw_pixbuf(pagebar->pixmap, NULL, pagebar->bitmaps[bitmap_PageField], 0,0,x,y,-1,-1,GDK_RGB_DITHER_NONE,0,0);
01137 #else
01138             gdk_draw_rectangle(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, FALSE, x, y, pagebar->pageFieldWidth, pagebar->pageFieldHeight);
01139 #endif
01140 
01141             sprintf(pageStr, "%d", pagebar->currentPage + right );
01142             pango_layout_set_text(pagebar->pangolayout, pageStr, -1);
01143             pango_layout_get_pixel_size(pagebar->pangolayout,&i,&j);
01144             gdk_draw_layout(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, x+(pagebar->pageFieldWidth-i)/2, y+(pagebar->pageFieldHeight-j)/2, pagebar->pangolayout);
01145             x += pagebar->pageFieldWidth;
01146         }
01147 
01148         /* draw the right scroll box if needed*/
01149         if (pagebar_scrollbox_needRight(pagebar))
01150         {
01151             x = pagebar->cpiXPos + pagebar->maxItems * pagebar->pageFieldWidth; 
01152             x += pagebar->cpiWidth;
01153 #ifdef USE_BITMAPS
01154             gdk_draw_pixbuf(pagebar->pixmap, NULL, pagebar->bitmaps[bitmap_ScrollRight], 0,0,x,y,-1,-1,GDK_RGB_DITHER_NONE,0,0);
01155 #else
01156             gdk_draw_rectangle(pagebar->pixmap, GTK_WIDGET(pagebar->drawingArea)->style->black_gc, TRUE, x, y, pagebar->scrollButtonWidth, pagebar->pageFieldHeight);
01157 #endif
01158 
01159         }
01160         else
01161         {
01162             // Load a gray one. 
01163         }
01164     }
01165 }

Here is the call graph for this function:

int pagebar_load_bitmaps ( GtkPagebar pagebar  ) 

Definition at line 272 of file gtkPagebar.c.

00273 {
00274     int ret = 0;
00275 #ifdef USE_BITMAPS
00276     /* Load bitmaps */
00277     if (loadBitmap(&(pagebar->bitmaps[bitmap_CPI]), DATA_DIR "/pagebar_cpi.png"))
00278         RETURN(-1);
00279     pagebar->cpiWidth = gdk_pixbuf_get_width(pagebar->bitmaps[bitmap_CPI]);
00280     pagebar->cpiHeight = gdk_pixbuf_get_height(pagebar->bitmaps[bitmap_CPI]);
00281     /* MvdW: removed collapse/expand bitmaps
00282     if (loadBitmap(&(pagebar->bitmaps[bitmap_CPIExpand]), DATA_DIR "/pagebar_cpiexpand.png"))
00283     RETURN(-1);
00284     if (loadBitmap(&(pagebar->bitmaps[bitmap_CPICollapse]), DATA_DIR "/pagebar_cpicollapse.png"))
00285     RETURN(-1); */
00286     if (loadBitmap(&(pagebar->bitmaps[bitmap_PageField]), DATA_DIR "/pagebar_pagefield.png"))
00287         RETURN(-1);
00288     pagebar->pageFieldWidth = gdk_pixbuf_get_width(pagebar->bitmaps[bitmap_PageField]);
00289     pagebar->pageFieldHeight = gdk_pixbuf_get_height(pagebar->bitmaps[bitmap_PageField]);
00290     if (loadBitmap(&(pagebar->bitmaps[bitmap_ScrollLeft]), DATA_DIR "/pagebar_scrollleft.png"))
00291         RETURN(-1);
00292     pagebar->scrollButtonWidth = gdk_pixbuf_get_width(pagebar->bitmaps[bitmap_ScrollLeft]);
00293     if (loadBitmap(&(pagebar->bitmaps[bitmap_ScrollRight]), DATA_DIR "/pagebar_scrollright.png"))
00294         RETURN(-1);
00295     if (loadBitmap(&(pagebar->bitmaps[bitmap_Bookmark]), DATA_DIR "/pagebar_bookmark.png"))
00296         RETURN(-1);
00297     if (loadBitmap(&(pagebar->bitmaps[bitmap_Note]), DATA_DIR "/pagebar_note.png"))
00298         RETURN(-1);
00299 #endif
00300 
00301 end:
00302     return ret;
00303 }

Here is the call graph for this function:

void pagebar_reportSync ( GtkPagebar pagebar  ) 

Definition at line 1216 of file gtkPagebar.c.

01217 {
01218     gtk_idle_add(on_idle, (gpointer) pagebar);
01219 }

Here is the call graph for this function:

int pagebar_reset_values ( GtkPagebar pagebar  ) 

Definition at line 220 of file gtkPagebar.c.

00220                                               {
00221     ENTER(0);
00222 
00223     pagebar->pagecount = PAGEBAR_DEFAULT_PAGECOUNT;
00224     pagebar->currentPage = PAGEBAR_DEFAULT_CURRENTPAGE;
00225     pagebar->currentPageOffset = PAGEBAR_DEFAULT_CURRENTPAGEOFFSET;
00226     pagebar->zoomMode = PAGEBAR_DEFAULT_ZOOMMODE;
00227     pagebar->orientation = PAGEBAR_DEFAULT_ORIENTATION;
00228     pagebar->drawAreaXPos = PAGEBAR_DEFAULT_DRAWAREAXPOS;
00229     pagebar->drawAreaYPos = PAGEBAR_DEFAULT_DRAWAREAYPOS;
00230     pagebar->drawAreaWidth = PAGEBAR_DEFAULT_DRAWAREAWIDTH;
00231     pagebar->drawAreaHeight = PAGEBAR_DEFAULT_DRAWAREAHEIGHT;
00232     pagebar->barXPos = PAGEBAR_DEFAULT_BARXPOS;
00233     pagebar->barYPos = PAGEBAR_DEFAULT_BARYPOS;
00234     pagebar->barWidth = PAGEBAR_DEFAULT_BARWIDTH;
00235     pagebar->barHeight = PAGEBAR_DEFAULT_BARHEIGHT;
00236     pagebar->cpiHeight = PAGEBAR_DEFAULT_CPIHEIGHT;
00237     pagebar->cpiWidth = PAGEBAR_DEFAULT_CPIWIDTH;
00238     pagebar->barFontType = PAGEBAR_DEFAULT_BARFONTTYPE;
00239     pagebar->barFontHeight = PAGEBAR_DEFAULT_BARFONTHEIGHT;
00240     pagebar->cpiFontType = PAGEBAR_DEFAULT_CPIFONTTYPE;
00241     pagebar->cpiFontHeight = PAGEBAR_DEFAULT_CPIFONTHEIGHT;
00242     pagebar->pageFieldWidth = PAGEBAR_DEFAULT_PAGEFIELDWIDTH;
00243     pagebar->pageFieldHeight = PAGEBAR_DEFAULT_PAGEFIELDHEIGHT;
00244     pagebar->pageOffsetWidth = PAGEBAR_DEFAULT_PAGEOFFSETWIDTH;
00245     pagebar->pageOffsetHeight = PAGEBAR_DEFAULT_PAGEOFFSETHEIGHT;
00246     pagebar->pageOffsetXOffset = PAGEBAR_DEFAULT_PAGEOFFSETXOFFSET;
00247     pagebar->pageOffsetYOffset = PAGEBAR_DEFAULT_PAGEOFFSETYOFFSET;
00248     pagebar->bookmarkCount = PAGEBAR_DEFAULT_BOOKMARKCOUNT;
00249     pagebar->bookmarkMaxValue = PAGEBAR_DEFAULT_BOOKMARKMAXVALUE;
00250     pagebar->noteCount = PAGEBAR_DEFAULT_NOTECOUNT;
00251     pagebar->notesMaxValue = PAGEBAR_DEFAULT_NOTESMAXVALUE;
00252     pagebar->scrollButtonWidth = PAGEBAR_DEFAULT_SCROLLBUTTONWIDTH;
00253     pagebar->show = PAGEBAR_DEFAULT_SHOW;
00254     if (PAGEBAR_TIMER_PROGRESS  != pagebar->currentTimer)
00255         pagebar->currentTimer = PAGEBAR_TIMER_NONE;
00256 
00257     pagebar->lastPage = -1;
00258     pagebar->lastDrawAreaXPos = pagebar->lastDrawAreaYPos = -1;
00259 
00260     if (pagebar->bookmarks)
00261         free(pagebar->bookmarks);
00262     if (pagebar->notes)
00263         free(pagebar->notes);
00264 
00265     pagebar->bookmarks = NULL;
00266     pagebar->notes = NULL;
00267 
00268     LEAVE(0);
00269     return 0;
00270 }

int pagebar_scrollbox_hitTest ( GtkPagebar pagebar,
int  x,
int  y 
) [static]

Definition at line 873 of file gtkPagebar.c.

00874 {
00875     int width = pagebar->maxItems *pagebar->pageFieldWidth;
00876 
00877     // position and scroll box enabled
00878     if (x < pagebar->cpiXPos - width &&
00879         x > pagebar->cpiXPos - width - pagebar->scrollButtonWidth &&
00880         pagebar_scrollbox_needLeft(pagebar))
00881     {
00882         return SCROLLBOX_LEFT;
00883     }
00884 
00885     if (x > pagebar->cpiXPos + pagebar->cpiWidth + width &&
00886         x < pagebar->cpiXPos + pagebar->cpiWidth + width + pagebar->scrollButtonWidth && 
00887         pagebar_scrollbox_needRight(pagebar))
00888     {
00889         return SCROLLBOX_RIGHT;
00890     }
00891 
00892     return SCROLLBOX_NONE;
00893 }

Here is the call graph for this function:

gboolean pagebar_scrollbox_needLeft ( GtkPagebar pagebar  )  [static]

Definition at line 859 of file gtkPagebar.c.

00860 {
00861     if (pagebar->currentPage > pagebar->maxItems + 1) 
00862         return TRUE;
00863     return FALSE;
00864 }

gboolean pagebar_scrollbox_needRight ( GtkPagebar pagebar  )  [static]

Definition at line 866 of file gtkPagebar.c.

00867 {
00868     if (pagebar->pagecount - pagebar->currentPage > pagebar->maxItems) 
00869         return TRUE;
00870     return FALSE;
00871 }

int removeBookmark ( GtkPagebar pagebar,
int  value 
)

Definition at line 212 of file gtkPagebar.c.

00212                                                    {
00213     return removeFromList(&pagebar->bookmarks, &pagebar->bookmarkCount, value);
00214 }

Here is the call graph for this function:

static int removeFromList ( int **  list,
int *  count,
int  value 
) [static]

Definition at line 186 of file gtkPagebar.c.

00186                                                              {
00187     int i;
00188 
00189     ENTER(1);
00190 
00191     i=0;
00192     while (i<*count && (*list)[i]!=value && (*list)[i]!=-1)
00193         i++;
00194     if (i<*count && (*list)[i]==value) {
00195         memmove(*list, (*list)+1, *count-i-1);
00196         (*list)[*count-1]=-1;
00197         *count--;
00198     }
00199 
00200     LEAVE(1);
00201     return 0;
00202 }

int removeNote ( GtkPagebar pagebar,
int  value 
)

Definition at line 216 of file gtkPagebar.c.

00216                                                {
00217     return removeFromList(&pagebar->notes, &pagebar->noteCount, value);
00218 }

Here is the call graph for this function:


Variable Documentation

Definition at line 117 of file gtkPagebar.c.

Definition at line 126 of file gtkPagebar.c.

Definition at line 125 of file gtkPagebar.c.

Definition at line 123 of file gtkPagebar.c.

Definition at line 120 of file gtkPagebar.c.

Definition at line 124 of file gtkPagebar.c.

int framebuffer_device [static]

Definition at line 112 of file gtkPagebar.c.

Definition at line 127 of file gtkPagebar.c.

gint pagebar_signals[LAST_SIGNAL] = { 0 } [static]

Definition at line 97 of file gtkPagebar.c.

Definition at line 118 of file gtkPagebar.c.

Definition at line 121 of file gtkPagebar.c.

Definition at line 122 of file gtkPagebar.c.

Definition at line 119 of file gtkPagebar.c.


Generated on Sun Dec 14 17:15:18 2008 by  doxygen 1.5.6