#include <liberipc/eripc.h>
#include <liberipc/eripctoolbar.h>
#include <liberipc/eripcviewer.h>
#include <liberipc/eripcicons.h>
#include "browserTypes.h"
#include "toolbar.h"
#include "pagebar.h"
#include "browserSettings.h"
#include "mozilla_api.h"
#include "find.h"
#include "browserLog.h"
#include "displayUpdate.h"
#include "erbusy.h"
Go to the source code of this file.
Functions | |
| void | toolbar_init () |
| void | toolbar_key_selected (int iconID, int iconState, Ereader *browser) |
Variables | |
| static erClientChannel_t | toolbarChannel |
<File description>="">
Definition in file toolbar.cpp.
| void toolbar_init | ( | void | ) |
Init toolbar (open communication channel and enable/set the correct icons)
Definition at line 47 of file toolbar.cpp.
00048 { 00049 int returnValue; 00050 00051 // TODO: check this function, it seems broken... 00052 // MvdW, 2006-03-13 00053 00054 BR_IPCPRINTF("entry"); 00055 00056 // create/init the channel to communicate with the toolbar service 00057 returnValue = erIpcStartClient(ER_TOOLBAR_CHANNEL, &toolbarChannel); 00058 00059 if (returnValue != 0) 00060 { 00061 BR_WARNPRINTF("erIpcStartClient returned %d", returnValue); 00062 return; 00063 } 00064 00065 // tell toolbar which icons set to display 00066 tbSelectIconSet(toolbarChannel, ER_XHTML_VIEWER_UA_ID); 00067 00068 // clear the toolbar 00069 tbClearIconSet(toolbarChannel, ER_XHTML_VIEWER_UA_ID); 00070 00071 // add the zoom/unzoom icon to the toolbar 00072 tbAppendPlatformIcon(toolbarChannel, ER_XHTML_VIEWER_UA_ID, iconID_fontlarger, ccVwrToolbar); 00073 tbAppendPlatformIcon(toolbarChannel, ER_XHTML_VIEWER_UA_ID, iconID_fontsmaller, ccVwrToolbar); 00074 //tbAppendPlatformIcon(toolbarChannel, ER_XHTML_VIEWER_UA_ID, ER_IC_JUMP_TO_PAGE); 00075 //tbAppendPlatformIcon(toolbarChannel, ER_XHTML_VIEWER_UA_ID, ER_IC_JUMP_TO_PAGE); 00076 //tbAppendPlatformIcon(toolbarChannel, ER_XHTML_VIEWER_UA_ID, ER_IC_JUMP_TO_PAGE); 00077 00078 // In the browser, the keyboard is enabled 00079 tbSetStatePlatformIcon(toolbarChannel, ER_XHTML_VIEWER_UA_ID, iconID_keyboard, iconState_normal); 00080 00081 }

| void toolbar_key_selected | ( | int | iconID, | |
| int | iconState, | |||
| Ereader * | browser | |||
| ) |
Outdated: replaced by e_iconID_t in eripctoolbar.h ** typedef enum { sigVwrIgnoreThisCommand = 0, sigVwrBookmarkPage, sigVwrInvokeFindDialog, sigVwrZoomIn, sigVwrZoomOut, sigVwrStoreSelection, sigVwrUndefined } eSigVwr; Outdated A key is selected on the toolbar
| command | the command associated with the selected key | |
| Ereader | datastructure containing the "mozembed" reference |
case ccVwrInvokeFindDialog: BR_IPCPRINTF("INVOKE FIND DIALOG"); browser_find_dialog_create(browser); break;
Definition at line 84 of file toolbar.cpp.
00085 { 00086 float zoomSize; 00087 gint offset; 00088 00089 BR_IPCPRINTF("iconID %d - iconState %d - browser 0x%x \n", iconID, iconState, browser); 00090 00091 // Busy indication when a toolbar icon is clicked 00092 erbusy_blink(); 00093 00094 switch (iconID) 00095 { 00096 case iconID_fontlarger: 00097 zoomSize = browser_settings_get_zoom_factor(); 00098 BR_IPCPRINTF("ZOOM IN %f + 0,1", zoomSize); 00099 zoomSize = zoomSize + ZOOM_STEPSIZE; 00100 00101 if (zoomSize <= MAX_ZOOM_IN) 00102 { 00103 if (zoomSize + ZOOM_STEPSIZE > MAX_ZOOM_IN) 00104 { 00105 tbSetStatePlatformIcon(toolbarChannel, ER_XHTML_VIEWER_UA_ID, iconID_fontlarger, iconState_grey); 00106 } 00107 tbSetStatePlatformIcon(toolbarChannel, ER_XHTML_VIEWER_UA_ID, iconID_fontsmaller, iconState_normal); 00108 00109 mozilla_zoom(GTK_MOZ_EMBED(browser->mozEmbed), zoomSize); 00110 00111 // Pagebar offset needs to be updated after fontchange 00112 offset = mozilla_determine_page_offset(GTK_MOZ_EMBED(browser->mozEmbed)); 00113 pagebar_set_offset(offset); 00114 pagebar_redraw(); 00115 00116 display_update_request_screen_refresh(MOZEMBED_UPDATE_LEVEL, NULL); 00117 browser_settings_set_zoom_factor(zoomSize); 00118 } 00119 else 00120 { 00121 BR_IPCPRINTF("new zoom size %f > %f", zoomSize, MAX_ZOOM_IN); 00122 erbusy_off(); // No longer busy 00123 } 00124 break; 00125 00126 case iconID_fontsmaller: 00127 zoomSize = browser_settings_get_zoom_factor(); 00128 BR_IPCPRINTF("ZOOM OUT %f - 0,1", zoomSize); 00129 zoomSize = zoomSize - ZOOM_STEPSIZE; 00130 00131 if (zoomSize > MAX_ZOOM_OUT) 00132 { 00133 if (zoomSize - ZOOM_STEPSIZE <= MAX_ZOOM_OUT) 00134 { 00135 tbSetStatePlatformIcon(toolbarChannel, ER_XHTML_VIEWER_UA_ID, iconID_fontsmaller, iconState_grey); 00136 } 00137 tbSetStatePlatformIcon(toolbarChannel, ER_XHTML_VIEWER_UA_ID, iconID_fontlarger, iconState_normal); 00138 00139 mozilla_zoom(GTK_MOZ_EMBED(browser->mozEmbed), zoomSize); 00140 if (mozilla_scrollable(pageDown_t, GTK_MOZ_EMBED(browser->mozEmbed)) == false) 00141 { 00142 // We are at the end of the page. Testing if scrolling down restores 00143 // normal view --> at the end of document instead of showing black screen 00144 mozilla_scroll(1, GTK_MOZ_EMBED(browser->mozEmbed)); 00145 } 00146 00147 // Pagebar offset needs to be updated after fontchange 00148 offset = mozilla_determine_page_offset(GTK_MOZ_EMBED(browser->mozEmbed)); 00149 pagebar_set_offset(offset); 00150 pagebar_redraw(); 00151 00152 display_update_request_screen_refresh(MOZEMBED_UPDATE_LEVEL, NULL); 00153 browser_settings_set_zoom_factor(zoomSize); 00154 } 00155 else 00156 { 00157 BR_IPCPRINTF("new zoom size %f < %f", zoomSize, MAX_ZOOM_OUT); 00158 erbusy_off(); // No longer busy 00159 } 00160 break; 00161 00169 default: 00170 BR_IPCPRINTF("Unknown iconID [%d]", iconID); 00171 erbusy_off(); // No longer busy 00172 break; 00173 } 00174 00175 return; 00176 }

erClientChannel_t toolbarChannel [static] |
Definition at line 45 of file toolbar.cpp.
1.5.6